Skip to content

Commit ef8d720

Browse files
authored
android: Reset operating frame rate during flush (#8421)
When the MediaCodecBridge is flushed, the previously estimated operating frame rate becomes invalid. Resetting the frame rate estimator ensures that new frame rate calculations start from a clean state after a flush, preventing stale or incorrect frame rate data from affecting playback or adaptation logic. This is important for accurate media synchronization and performance on Android. Issue: 467911298 Issue: 320568573
1 parent d3e5016 commit ef8d720

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,10 @@ private int flush() {
662662
} catch (Exception e) {
663663
Log.e(TAG, "Failed to flush MediaCodec", e);
664664
return MediaCodecStatus.ERROR;
665+
} finally {
666+
if (mFrameRateEstimator != null) {
667+
mFrameRateEstimator.reset();
668+
}
665669
}
666670
return MediaCodecStatus.OK;
667671
}

0 commit comments

Comments
 (0)