Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AampStreamSinkManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ void AampStreamSinkManager::SetActive(PrivateInstanceAAMP *aamp, double position

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;
Comment on lines 498 to 501
mGstPlayer->SetSubtitleMute(aamp->subtitles_muted);
if(!aamp->IsTuneCompleted() && aamp->IsPlayEnabled() && (mPipelineMode == ePIPELINEMODE_SINGLE))
Expand Down
7 changes: 6 additions & 1 deletion StreamSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,14 @@ class StreamSink
* @param[in] position - playback position
* @param[in] rate - Speed
* @param[in] shouldTearDown - if pipeline is not in a valid state, tear down pipeline
* @param[in] keepPausedSeek - true only when this Flush is part of an explicit seek-with-keepPaused
* request. Must NOT be inferred from the pipeline's incidental paused
* state (which can be true for unrelated reasons such as buffering or
* 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 on lines +139 to +143

/**
* @brief Flush the audio playbin
Expand Down
6 changes: 3 additions & 3 deletions aampgstplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ void AAMPGstPlayer::SetAudioVolume(int volume)
/**
* @brief Flush cached GstBuffers and set seek position & rate
*/
void AAMPGstPlayer::Flush(double position, int rate, bool shouldTearDown)
void AAMPGstPlayer::Flush(double position, int rate, bool shouldTearDown, bool keepPausedSeek)
{
if(ISCONFIGSET(eAAMPConfig_SuppressDecode))
{
Expand All @@ -1136,7 +1136,7 @@ void AAMPGstPlayer::Flush(double position, int rate, bool shouldTearDown)
{
isAppSeek = true;
}
bool ret = playerInstance->Flush(position, rate, shouldTearDown, isAppSeek);
bool ret = playerInstance->Flush(position, rate, shouldTearDown, isAppSeek, keepPausedSeek);
if(ret)
{
for (int i = 0; i < AAMP_TRACK_COUNT; i++)
Expand Down Expand Up @@ -1269,7 +1269,7 @@ void AAMPGstPlayer::SeekStreamSink(double position, double rate)
// shouldTearDown is set to false, because in case of a new tune pipeline
// might not be in a playing/paused state which causes Flush() to destroy
// pipeline. This has to be avoided.
Flush(position, rate, false);
Flush(position, rate, false, false);

}

Expand Down
3 changes: 2 additions & 1 deletion aampgstplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ class AAMPGstPlayer : public StreamSink
* @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 on lines 167 to +172
/**
* @fn Pause
* @param[in] pause flag to pause/play the pipeline
Expand Down
27 changes: 25 additions & 2 deletions main_aamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,31 @@ void PlayerInstanceAAMP::SetRateInternal(float rate,int overshootcorrection)
{
retValue = sink->Pause(false, false);
}
// required since buffers are already cached in paused state
aamp->NotifyFirstBufferProcessed(sink ? sink->GetVideoRectangle() : std::string());
if (sink && !retValue)
{
// Pipeline resume did not complete (async PAUSED->PLAYING wedged by a
// rapid trickplay->seek->resume race - seen on both VOD and FOG-TSB linear).
// Recover by re-seeking to the current position: the same mechanism the
Comment thread
rekhap2kandhavelan marked this conversation as resolved.
// local-TSB resume path uses. Works uniformly for VOD, FOG-TSB & local TSB.
AAMPLOG_WARN("SetRateInternal: pipeline resume failed (GstState timeout); recovering via re-seek");
aamp->SetState(eSTATE_SEEKING);
aamp->seek_pos_seconds = aamp->GetPositionSeconds();
aamp->rate = AAMP_NORMAL_PLAY_RATE;
aamp->mSinkPaused = false;
{
std::lock_guard<std::recursive_mutex> lock(aamp->GetStreamLock());
aamp->TuneHelper(eTUNETYPE_SEEK, false);
}
Comment on lines +931 to +934
// Skip common notification (like local-TSB path): state -> PLAYING
// via NotifyFirstBufferProcessed once fragments arrive.
retValue = false;
aamp->NotifySpeedChanged(aamp->rate, false);
}
else
{
// required since buffers are already cached in paused state
aamp->NotifyFirstBufferProcessed(sink ? sink->GetVideoRectangle() : std::string());
}
}
}
aamp->mSinkPaused = false;
Expand Down
2 changes: 1 addition & 1 deletion middleware/InterfacePlayerRDK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ bool InterfacePlayerRDK::IsUsingRialtoSink()
/**
* @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)
{
GstState aud_current;
GstState aud_pending;
Expand Down
2 changes: 1 addition & 1 deletion middleware/InterfacePlayerRDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ class InterfacePlayerRDK
* @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 on lines 717 to +720
/**
* @fn TimerAdd
* @param[in] funcPtr function to execute on timer expiry
Expand Down
2 changes: 1 addition & 1 deletion priv_aamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6503,7 +6503,7 @@ void PrivateInstanceAAMP::TuneHelper(TuneType tuneType, bool seekWhilePaused)
// shouldTearDown is set to false, because in case of a new tune pipeline
// might not be in a playing/paused state which causes Flush() to destroy
// pipeline. This has to be avoided.
sink->Flush(flushPosition, rate, false);
sink->Flush(flushPosition, rate, false, seekWhilePaused);
}
}

Expand Down