开发者

MediaRecorder class starts recording audio after slight delay

I am having an issue with the MediaRecorder class. When I call the start() method, the recorder starts recording(audio) but after some delay (The delay is quite noticeable - approximately 1 second). I have seen this happening on Android 2.3 devices, specifically Samsung Nexus S. This issue does not appear on Android 1.6 (G1) or any version of Android emulators. Could you please开发者_StackOverflow confirm if you are seeing this issue and if there exists a solution for the same? Is this a documented bug?


This seems to be either a bug in either MediaRecorder or the device's firmware. You can see the same delay in the default Camera app, which also uses MediaRecorder. I also noticed that there's extra audio at the end of each recording, past when the video stops recording. However, the video and audio seem to be synched throughout the video. It's something like this:

   =========================================     Audio being captured
=========================================        Video being captured
|----|----|----|----|----|----|----|----|----|   Time
^                                       ^
start()                               stop()

So the audio isn't really "shifted", it just begins and ends past the video capture.

I'm witnessing the delay on a Motorola Xoom tablet running Honeycomb (Android 3.0).

See a bug report here: http://code.google.com/p/android/issues/detail?id=15953


I tracked down the problem (not CyanogenMod related): https://github.com/CyanogenMod/android_frameworks_base/commit/d7f1c3d69274fef8772a663ce1c792fd0466fcc5

This commit got in between Android 2.2 and 2.3. Its purpose seems to be to mute the sound of the default camera app when starting to record (although 1 second seems a bit long for that). And it should fade in the sound gradually, but the implementation does not seem to work. It's a hard cut after 1 second, you can also try this in the camera app.

I really don't understand why they implemented it at this level, where also other applications are affected. And the behaviour is not configurable, so I see no possible workaround. We can only hope that it will be fixed in future versions.


I've added to the android bug report linked to by alalonde. I see this as an Android 2.3 bug since the same code runs just fine on 2.2 and earlier. I have a myTouch 4G which worked fine on stock 2.2 firmware. As soon as I upgraded to Cyanogen Rom based on 2.3.3 I noticed the 1 second delay. Same hardware, same application, different OS version. Has to be the OS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜