Fixed
Status Update
Comments
le...@google.com <le...@google.com>
le...@google.com <le...@google.com> #2
The video frame timestamp is incorrectly given by codec which causes it needs some time to wait the frame with timestamp within resume interval.
However, the audio and video is actually out of sync after resume due to the incorrect timestamp.
Detailed analysis is in
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 75cbc0b8a928dfc6bf3d75da027ed396ba684c87
Author: leo huang <leohuang@google.com>
Date: Wed Mar 23 18:45:00 2022
Fix audio/video out of sync after pause and resume on some Samsung devices pre-API 29
After calling MediaCodec.setParameters() with MediaCodec.PARAMETER_KEY_SUSPEND, the video codec of the issue device will send a timestamp missing the pause interval after resumed, which results in the video and audio to be out of sync after resumed.
The workaround is to not call MediaCodec.setParameters() when recording is paused. This shouldn't cause too much overhead since we'll still stop the camera from sending frames to the encoder surface when paused.
Relnote: "Fixed audio/video out of sync after pause and resume on some Samsung devices pre-API 29."
Bug: b/202798609 , b/202798572
Test: Manual testing
Change-Id: I646221b9f94ae688592d4be96245f17f74806f0b
A camera/camera-video/src/main/java/androidx/camera/video/internal/compat/quirk/VideoEncoderSuspendDoesNotIncludeSuspendTimeQuirk.java
M camera/camera-video/src/main/java/androidx/camera/video/internal/compat/quirk/DeviceQuirksLoader.java
M camera/camera-video/src/main/java/androidx/camera/video/internal/encoder/EncoderImpl.java
https://android-review.googlesource.com/2038784
Branch: androidx-main
commit 75cbc0b8a928dfc6bf3d75da027ed396ba684c87
Author: leo huang <leohuang@google.com>
Date: Wed Mar 23 18:45:00 2022
Fix audio/video out of sync after pause and resume on some Samsung devices pre-API 29
After calling MediaCodec.setParameters() with MediaCodec.PARAMETER_KEY_SUSPEND, the video codec of the issue device will send a timestamp missing the pause interval after resumed, which results in the video and audio to be out of sync after resumed.
The workaround is to not call MediaCodec.setParameters() when recording is paused. This shouldn't cause too much overhead since we'll still stop the camera from sending frames to the encoder surface when paused.
Relnote: "Fixed audio/video out of sync after pause and resume on some Samsung devices pre-API 29."
Bug:
Test: Manual testing
Change-Id: I646221b9f94ae688592d4be96245f17f74806f0b
A camera/camera-video/src/main/java/androidx/camera/video/internal/compat/quirk/VideoEncoderSuspendDoesNotIncludeSuspendTimeQuirk.java
M camera/camera-video/src/main/java/androidx/camera/video/internal/compat/quirk/DeviceQuirksLoader.java
M camera/camera-video/src/main/java/androidx/camera/video/internal/encoder/EncoderImpl.java
Description
Device: Samsung J4, API level 26 Step: (1) In CoreTestApp, keep the video & preview use case. (2) Start video recording for a few seconds, and then pause the recording. (3) Tap +EV button a few times. (4) Resume the video recording, the recording time doesn't update within 4 seconds
Note: Many Samsung devices have this issue, maybe this is the issue for Exynos devices.