Android audio too fast on some devices with MediaCodec and AudioTrack

896 views Asked by At

I am decoding audio using MediaExtractor, MediaCodec, and AudioTrack. I am configuring the AudioTrack using the MediaFormat returned by MediaCodec.getOutputFormat() after receiving MediaCodec.INFO_OUTPUT_FORMAT_CHANGED from the MediaCodec. On some devices, this results in speeded up audio, while the MediaFormat returned by the MediaExtractor works correctly. (On other devices, the reverse is true.)

Here are some details:

  • The audio files in question are largely 22050 Hz mono MP3s.
  • The devices where playback is too fast include the Prestigio PMP3007C3G, ASUS MeMO Pad HD 7 (ME173X), Lenovo A5500-H (A5500-H), and some Wiko devices.
  • I unfortunately don't know the parameters of the returned MediaFormat, as I don't have access to the devices, but I assume that it returns stereo for mono, or 44100 Hz for 22050 Hz, without actually resampling the files.

Any help would be appreciated. Thanks!

0

There are 0 answers