Android audio too fast on some devices with MediaCodec and AudioTrack

ぃ、小莉子 提交于 2019-12-23 12:43:18

问题


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!

来源:https://stackoverflow.com/questions/30788496/android-audio-too-fast-on-some-devices-with-mediacodec-and-audiotrack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!