Skip to content

RDKEMW-20975 [Rack][RDKE][8.6][Llama G1/Cello]: Screen got stuck during VOD content playback#1723

Open
rekhap2kandhavelan wants to merge 7 commits into
support/3.6.0_8.6from
feature/RDKEMW-20975
Open

RDKEMW-20975 [Rack][RDKE][8.6][Llama G1/Cello]: Screen got stuck during VOD content playback#1723
rekhap2kandhavelan wants to merge 7 commits into
support/3.6.0_8.6from
feature/RDKEMW-20975

Conversation

@rekhap2kandhavelan

@rekhap2kandhavelan rekhap2kandhavelan commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Race Condition Recovery Handling Summary

To address the playback freeze caused by race conditions, the recovery handling has been implemented across both the Middleware and AAMP layers.

Middleware Changes

rdkcentral/middleware-player-interface#200

  1. Propagate Pause() failure

    • Pause() detects the failure through validateStateWithMsTimeout(), but the failure was not being propagated to the middleware layer.
    • The fix ensures that the failure is propagated instead of being silently ignored.
  2. Increase timeout budget

    • The existing retry budget of 5 × 100 ms (500 ms) was insufficient for TSB seek scenarios with concurrent Widevine DRM renegotiation.
    • Increased the retry count to 10 with adaptive sleep to provide sufficient time for recovery.
  3. Maintain correct sink state

    • Previously, mSinkPaused was being set to false unconditionally, even when Pause() failed, resulting in a state mismatch that masked the playback freeze during subsequent SetRate() calls.
    • The state handling has been corrected to avoid this desynchronization.

AAMP Changes

  1. Recover by re-tuning

    • Once the middleware propagates the Pause() failure, AAMP now schedules a recovery by performing a re-tune instead of continuing in a broken state.
    • This ensures playback recovery when the race condition is encountered.

Additional Linear Playback Handling

After implementing the above changes, VOD playback recovered successfully with approximately 1 second recovery time. However, linear playback still exhibited issues.

To address this, the AAMP handling was updated in the pipeline-unpause branch:

  • When Pause(false) fails, trigger recovery using TuneHelper(eTUNETYPE_SEEK), matching the existing Local-TSB recovery path.
  • Keep mSinkPaused = false and ResumeDownloads() unconditional as part of the recovery flow.

Result

  • VOD Playback: Successfully recovers without playback freeze (approximately 1-second recovery).
  • Linear Playback: Successfully recovers after applying the additional AAMP handling.

Note: The recovery logic is implemented collaboratively across both the Middleware and AAMP layers. When the race condition is detected and Pause() fails, the failure is propagated and appropriate recovery actions are triggered, allowing both VOD and Linear playback to recover automatically.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent playback freezes caused by a race during resume/unpause by (a) adding an explicit “seek-with-keepPaused” signal through the Flush path and (b) adding an AAMP-side recovery path that re-seeks (re-tunes) when an unpause fails.

Changes:

  • Extend StreamSink::Flush / AAMPGstPlayer::Flush / InterfacePlayerRDK::Flush with a keepPausedSeek boolean to distinguish explicit keep-paused seeks from incidental paused states.
  • Propagate seekWhilePaused from PrivateInstanceAAMP::TuneHelper into Flush(..., keepPausedSeek) calls.
  • Add SetRate resume recovery: if sink->Pause(false,false) fails, switch to SEEKING and recover via TuneHelper(eTUNETYPE_SEEK).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
StreamSink.h Adds keepPausedSeek parameter to Flush API and documents intended semantics.
priv_aamp.cpp Passes seekWhilePaused through to StreamSink::Flush(..., keepPausedSeek).
middleware/InterfacePlayerRDK.h Extends middleware Flush signature to accept keepPausedSeek.
middleware/InterfacePlayerRDK.cpp Updates middleware Flush signature to accept keepPausedSeek.
main_aamp.cpp Adds resume failure recovery via re-seek/re-tune in SetRateInternal.
AampStreamSinkManager.cpp Updates mGstPlayer->Flush call to include the new argument.
aampgstplayer.h Updates AAMPGstPlayer::Flush override signature with keepPausedSeek.
aampgstplayer.cpp Propagates keepPausedSeek down to InterfacePlayerRDK::Flush; updates internal call sites.

* @brief Flush cached GstBuffers and set seek position & rate
*/
bool InterfacePlayerRDK::Flush(double position, int rate, bool shouldTearDown, bool isAppSeek)
bool InterfacePlayerRDK::Flush(double position, int rate, bool shouldTearDown, bool isAppSeek, bool keepPausedSeek)
Comment on lines 717 to +720
* @param[in] GstState The desired GStreamer pipeline state.
* @param[in] gstMediaFormat The media format for the pipeline.
*/
bool Flush(double position, int rate, bool shouldTearDown, bool isAppSeek);
bool Flush(double position, int rate, bool shouldTearDown, bool isAppSeek, bool keepPausedSeek);
Comment thread aampgstplayer.h
Comment on lines 167 to +172
* @param[in] position playback seek position
* @param[in] rate playback rate
* @param[in] shouldTearDown flag indicates if pipeline should be destroyed if in invalid state
* @param[in] keepPausedSeek true only for an explicit seek-with-keepPaused request
*/
void Flush(double position, int rate, bool shouldTearDown) override;
void Flush(double position, int rate, bool shouldTearDown, bool keepPausedSeek) override;
Comment thread StreamSink.h
Comment on lines +139 to +143
* fragment caching), since that conflation can permanently block later
* PLAYING transitions when no explicit resume ever arrives.
* @return void
*/
virtual void Flush(double position = 0, int rate = AAMP_NORMAL_PLAY_RATE, bool shouldTearDown = true){}
virtual void Flush(double position = 0, int rate = AAMP_NORMAL_PLAY_RATE, bool shouldTearDown = true, bool keepPausedSeek = false){}
Comment thread main_aamp.cpp
Comment thread main_aamp.cpp
Comment on lines +931 to +934
{
std::lock_guard<std::recursive_mutex> lock(aamp->GetStreamLock());
aamp->TuneHelper(eTUNETYPE_SEEK, false);
}
Comment thread AampStreamSinkManager.cpp
Comment on lines 498 to 501
mGstPlayer->ChangeAamp(aamp, mInactiveGstPlayersMap[aamp]->GetID3MetadataHandler());
aamp->mIsFlushOperationInProgress = true;
mGstPlayer->Flush(position, aamp->rate, true);
mGstPlayer->Flush(position, aamp->rate, true,false);
aamp->mIsFlushOperationInProgress = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants