MediaRecorder class starts recording audio after slight delay

前端 未结 3 1634
执笔经年
执笔经年 2021-01-01 03:50

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 -

相关标签:
3条回答
  • 2021-01-01 04:29

    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.

    0 讨论(0)
  • 2021-01-01 04:42

    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

    0 讨论(0)
  • 2021-01-01 04:50

    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 讨论(0)
提交回复
热议问题