From d963db254bbeaadc4ccf907f362ad5db205632fc Mon Sep 17 00:00:00 2001 From: Anoob Anto K Date: Tue, 4 Feb 2025 23:07:39 +0530 Subject: [PATCH] Fix for VBR VP9 getting stuck Variable bitrate video gets stuck after playing for a few seconds. For variable bitrate video, the DecodeFrameAsync frequently gives null value for surface_out. In such cases, the WaitWork is not called, and hence, the NotifyWorkDone doesn't get called. Changes done: - When surface_out is null, call NotifyWorkDone on all pending works. Tests done: - Play VBR and non-VBR video files, and ensure smooth playback. Tracked-On: OAM-129739 Signed-off-by: Anoob Anto K --- c2_components/src/mfx_c2_decoder_component.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/c2_components/src/mfx_c2_decoder_component.cpp b/c2_components/src/mfx_c2_decoder_component.cpp index 4760786f..b81c69ef 100755 --- a/c2_components/src/mfx_c2_decoder_component.cpp +++ b/c2_components/src/mfx_c2_decoder_component.cpp @@ -1795,6 +1795,16 @@ mfxStatus MfxC2DecoderComponent::DecodeFrame(mfxBitstream *bs, MfxC2FrameOut&& f ++m_uSyncedPointsCount; } } + } else { + ALOGE("Null surface_out after decode, notify all pending works"); + { + std::lock_guard lock(m_pendingWorksMutex); + auto it = m_pendingWorks.begin(); + while (it != m_pendingWorks.end()) { + NotifyWorkDone(std::move(it->second), C2_NOT_FOUND); + it = m_pendingWorks.erase(it); + } + } } } else if (MFX_ERR_INCOMPATIBLE_VIDEO_PARAM == mfx_sts) { MFX_DEBUG_TRACE_MSG("MFX_ERR_INCOMPATIBLE_VIDEO_PARAM: resolution was changed");