1

I have built gstreamer_ndk_bundle for platforms 8, 10 and 13 without any errors and problems. Now I am trying to make gstreamer-java work on android, and I guess I made it work. JNA works great (tested it on my lib), I have added all missing Structure.setFieldOrder() calls to the gstreamer-java code, removed all classes and packages that don't exist on Android, and it compiles and runs on emulator. Also, I have used gstreamer libs compiled for specific platform on that platform emulator.

I use this code to play Mp3 file:

File file = new File(getExternalFilesDir(null),"demo_tunes.mp3" );

try 
{
    InputStream is = getResources().openRawResource(R.raw.test);
    OutputStream os = new FileOutputStream(file);
    byte[] data = new byte[is.available()];
    is.read(data);
    os.write(data);
    is.close();
    os.close();
} 
catch (IOException e) 
{
    Log.w("ExternalStorage", "Error writing " + file, e);
}

Gst.init("AudioPlayer", new String[]{"--gst-plugin-path=/data/data/org.gstreamer.marko/lib"});

Pipeline pipe  = new Pipeline("PipeLine"); 
Element src = ElementFactory.make("filesrc","Input File"); 
src.set("location", file.getAbsolutePath()); 
Element decode = ElementFactory.make("decodebin2", "Decode");
Element sink = ElementFactory.make("audioflingersink", "Sink");
pipe.addMany(src, decode, sink); 
Element.linkMany(src, decode, sink);

pipe.play();

All needed libs and their dependencies are loaded like this:

static
{

    System.loadLibrary("glib-2.0");
    System.loadLibrary("gmodule-2.0");
    System.loadLibrary("gthread-2.0");
    System.loadLibrary("gobject-2.0");
    System.loadLibrary("gstreamer-0.10");

    //Libraries for base plugins
    System.loadLibrary("gstbase-0.10");
    System.loadLibrary("gstpbutils-0.10");          
    System.loadLibrary("gstinterfaces-0.10");
    System.loadLibrary("gstvideo-0.10");
    System.loadLibrary("gstplaybin");

    //Base plugins
    System.loadLibrary("gstcoreelements");
    System.loadLibrary("gstautodetect");

    System.loadLibrary("gsttag-0.10");
    System.loadLibrary("gstaudio-0.10");
    System.loadLibrary("gstriff-0.10");
    System.loadLibrary("ogg");
    System.loadLibrary("gstogg");
    System.loadLibrary("gstaudioflinger");
    System.loadLibrary("mad");
    System.loadLibrary("gstmad");

    System.loadLibrary("gstdecodebin2");
    System.loadLibrary("gstautodetect"); 
}

App runs, but I don't hear any sound! Also I have tried to max out the volume of the device for all streams like this, but also no sound:

        AudioManager audman = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
        audman.setStreamVolume(AudioManager.STREAM_MUSIC, audman.getStreamMaxVolume(AudioManager.STREAM_MUSIC), 0);
        audman.setStreamVolume(AudioManager.STREAM_SYSTEM, audman.getStreamMaxVolume(AudioManager.STREAM_SYSTEM), 0);
        audman.setStreamVolume(AudioManager.STREAM_DTMF, audman.getStreamMaxVolume(AudioManager.STREAM_DTMF), 0);

In Log cat output I can see that audioflinger sink is created but there is no sound:

06-29 20:07:09.407: GstAudioFlingerSink(462): gst_audioflinger_sink_getcaps,0x0
06-29 20:07:09.434: GstAudioFlingerSink(462): creating ringbuffer
06-29 20:07:09.434: GstAudioFlingerSink(462): created ringbuffer @0x1fc810
06-29 20:07:09.447: GstAudioFlingerSink(462): >gst_android_audioringbuffer_open_device
06-29 20:07:09.447: GstAudioFlingerSink(462): gst_audioflinger_sink_open
06-29 20:07:09.447: audioflinger_wrapper(462): Create AudioTrack successfully 0x1f6e70
06-29 20:07:09.447: GstAudioFlingerSink(462): create a new flinger, 0x1f6e70

What am I missing? Also I tried this with PlayBin, PlayBinMediaPlayer and tried with OGG file, also runs, but no sound...

Cipi
  • 11,055
  • 9
  • 47
  • 60
  • Get the code to run with a simple, natively-compiled test case against the same libraries to ensure your environment and supporting libraries are working properly. – technomage Jun 30 '12 at 13:46
  • would you need audioconvert and/or audioresample elements between decodebin and audioflingersink? I would also try a simple audiotestsrc ! audioflingersink. – ensonic Jun 30 '12 at 18:39
  • Is it working yet? I had zero luck running gst-android by following there all guide-lines. Will surprise me if its working. I think they never completed it yet, its a full of bug. And some of there developer's are really lazy sort of, do not make any updates, but place bugs on the git repo. –  Jul 05 '12 at 14:17

0 Answers0