Skip to content Skip to sidebar Skip to footer

Android Mediacodec Api - Music Plays On Emulator, Not On The Device

The code given below works fine on the emulator, but not the device. I found the following lines that looked suspicious to me: V/MediaExtractor(5030): Autodetected media content as

Solution 1:

I haven't worked with audio, but I think I may see the problem. You're hanging in dequeueOutputBuffer() because the codec is waiting for more input.

Some of the video codecs want ~4 buffers of input before they'll even finish initialization (for example). I expect some audio codecs may behave the same way. Codec implementations vary from device to device, so it's not surprising that what runs on the emulator behaves much differently.

Change the timeouts from -1 (wait forever) to something modest (say, 1000 microseconds).

Post a Comment for "Android Mediacodec Api - Music Plays On Emulator, Not On The Device"