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
1 change: 0 additions & 1 deletion AampConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ static const ConfigLookupEntryInt mConfigLookupTableInt[AAMPCONFIG_INT_COUNT+CON
{0,"timeBasedBufferSeconds",eAAMPConfig_TimeBasedBufferSeconds,true,eCONFIG_RANGE_PLAYBACK_OFFSET},
{DEFAULT_MAX_DOWNLOAD_BUFFER,"maxDownloadBuffer",eAAMPConfig_MaxDownloadBuffer,true,eCONFIG_RANGE_PLAYBACK_OFFSET},
{DEFAULT_TELEMETRY_REPORT_INTERVAL,"telemetryInterval",eAAMPConfig_TelemetryInterval,true},
{0,"rateCorrectionDelay", eAAMPConfig_RateCorrectionDelay,true},
{-1,"harvestDuration",eAAMPConfig_HarvestDuration,false,eCONFIG_RANGE_HARVEST_DURATION},
{DEFAULT_SUBTITLE_CLOCK_SYNC_INTERVAL_S,"subtitleClockSyncInterval",eAAMPConfig_SubtitleClockSyncInterval,true},
{eABSOLUTE_PROGRESS_WITHOUT_AVAILABILITY_START,"preferredAbsoluteReporting",eAAMPConfig_PreferredAbsoluteProgressReporting,true, eCONFIG_RANGE_ABSOLUTE_REPORTING},
Expand Down
1 change: 0 additions & 1 deletion AampConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ typedef enum
eAAMPConfig_TimeBasedBufferSeconds,
eAAMPConfig_MaxDownloadBuffer, /**< Max download buffer in seconds, this can be used to limit player download job scheduling for DASH*/
eAAMPConfig_TelemetryInterval, /**< time interval for the telemetry reporting*/
eAAMPConfig_RateCorrectionDelay, /**< Delay Rate Correction upon discontinuity in seconds */
eAAMPConfig_HarvestDuration, /**< Harvest duration time */
eAAMPConfig_SubtitleClockSyncInterval, /**< time interval for synchronizing subtitle clock */
eAAMPConfig_PreferredAbsoluteProgressReporting, /**< Preferred settings for absolute progress reporting**/
Expand Down
6 changes: 5 additions & 1 deletion AampLatencyMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ void AampLatencyMonitor::EnableRateCorrection(bool enabled)
}

mCorrectionEnabled.store(enabled);
// Wake the worker so it can immediately reset the rate if needed.
if (!enabled)
{
// Reset rate to normal immediately, before the worker thread wakes up.
ResetToNormalRate();
}
{
std::lock_guard<std::mutex> lock(mSleepMutex);
mWakeupSignalled = true;
Expand Down
6 changes: 6 additions & 0 deletions AampLatencyMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ class AampLatencyMonitor
*/
void EnableRateCorrection(bool enabled);

/**
* @brief Returns true if rate correction is currently enabled.
* Thread-safe (atomic load).
*/
bool IsRateCorrectionEnabled() const { return mCorrectionEnabled.load(); }
Comment on lines +188 to +192

/**
* @brief Returns the playback rate most recently applied by this monitor.
*
Expand Down
7 changes: 7 additions & 0 deletions StreamAbstractionAAMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,12 @@ class MediaTrack
* @brief To Load New subtitle on seamless subtitle switch
*/
void LoadNewSubtitle(bool val);
/**
* @brief Save latency monitor enabled state before an audio/subtitle track switch.
* Used by RefreshTrack to record whether rate correction was active,
* so UpdateTSAfterFetchStats can restore it only when appropriate.
*/
void SaveLatencyMonitorStateBeforeSwitch(bool val) { mLatencyMonitorEnabledBeforeSwitch = val; }

/**
* @brief To set Track's Fetch and Inject duration after playlist update
Expand Down Expand Up @@ -824,6 +830,7 @@ class MediaTrack
bool abortInject; /**< Abort inject operations if flag is set*/
std::mutex audioMutex; /**< protection of audio track reconfiguration */
bool loadNewAudio; /**< Flag to indicate new audio loading started on seamless audio switch */
bool mLatencyMonitorEnabledBeforeSwitch; /**< Saved latency monitor state before audio/subtitle track switch; used to restore only if it was active prior to the switch */
std::mutex subtitleMutex;
bool loadNewSubtitle;
int fragmentChunkIdxToInject; /**< Write position */
Expand Down
8 changes: 0 additions & 8 deletions aampgstplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,12 +950,6 @@ void AAMPGstPlayer::FlushTrack(AampMediaType type,double pos)
double audioDelta = aamp->mAudioDelta;
double subDelta = aamp->mSubtitleDelta;
double rate = playerInstance->FlushTrack(mediaType, pos, audioDelta, subDelta);

if(aamp->mCorrectionRate != rate)
{
AAMPLOG_MIL("Reset Rate Correction to 1");
aamp->mCorrectionRate = rate;
}
}

/**
Expand Down Expand Up @@ -1076,8 +1070,6 @@ void AAMPGstPlayer::Flush(double position, int rate, bool shouldTearDown)
//reset buffer control states prior to gstreamer flush so that the first needs_data event is caught
privateContext->mBufferControl[i].flush();
}

aamp->mCorrectionRate = (double)AAMP_NORMAL_PLAY_RATE;
}
}

Expand Down
6 changes: 3 additions & 3 deletions fragmentcollector_hls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4023,7 +4023,6 @@ AAMPStatusType StreamAbstractionAAMP_HLS::Init(TuneType tuneType)
video->playTarget = 0;
subtitle->playTarget = 0;
aamp->NotifyOnEnteringLive();
aamp->mDisableRateCorrection = false;
}
else if (((eTUNETYPE_SEEK == tuneType) || (eTUNETYPE_RETUNE == tuneType) || (eTUNETYPE_NEW_SEEK == tuneType)) && (this->rate > 0))
{
Expand All @@ -4049,7 +4048,6 @@ AAMPStatusType StreamAbstractionAAMP_HLS::Init(TuneType tuneType)
aamp->NotifyOnEnteringLive();
}
AAMPLOG_INFO("StreamAbstractionAAMP_HLS: Live latency correction is enabled due to the seek (rate=%f) to live window!!", this->rate);
aamp->mDisableRateCorrection = false;
}
else
{
Expand Down Expand Up @@ -7020,7 +7018,9 @@ void StreamAbstractionAAMP_HLS::RefreshTrack(AampMediaType type)
}
track->AbortWaitForCachedAndFreeFragment(true);
aamp->StopTrackInjection(type);
aamp->mDisableRateCorrection = true;
// Save the latency monitor state before disabling - it will be restored after the switch only if it was active prior
track->SaveLatencyMonitorStateBeforeSwitch(aamp->IsLatencyMonitorRunning() && aamp->IsLatencyMonitorEnabled());
aamp->EnableLatencyMonitor(false);
if(aamp->IsLive() && !track->seamlessAudioSwitchInProgress)
{
// Abort ongoing wait for playlist refresh, so the track change can be processed immediately.
Expand Down
5 changes: 3 additions & 2 deletions fragmentcollector_mpd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3768,7 +3768,6 @@ AAMPStatusType StreamAbstractionAAMP_MPD::Init(TuneType tuneType)
notifyEnteringLive = true;
}
AAMPLOG_INFO("StreamAbstractionAAMP_MPD: Live latency correction is enabled due to the seek (rate=%f) to live window!!", currentRate);
aamp->mDisableRateCorrection = false;
}

if (mLowLatencyMode && !liveAdjust)
Expand Down Expand Up @@ -6604,7 +6603,9 @@ void StreamAbstractionAAMP_MPD::RefreshTrack(AampMediaType type)
}
track->AbortWaitForCachedAndFreeFragment(true);
aamp->StopTrackInjection(type);
aamp->mDisableRateCorrection = true;
// Save the latency monitor state before disabling - it will be restored after the switch only if it was active prior
track->SaveLatencyMonitorStateBeforeSwitch(aamp->IsLatencyMonitorRunning() && aamp->IsLatencyMonitorEnabled());
aamp->EnableLatencyMonitor(false);
}
}

Expand Down
10 changes: 2 additions & 8 deletions main_aamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,14 +949,8 @@ void PlayerInstanceAAMP::SetRateInternal(float rate,int overshootcorrection)
}
aamp->mSinkPaused = true;

if(aamp->GetLLDashServiceData()->lowLatencyMode)
{
// PAUSED to PLAY without tune, LLD rate correction is disabled to keep position
AAMPLOG_INFO("LL-Dash speed correction disabled after Pause");
aamp->EnableLatencyMonitor(false);
}
AAMPLOG_INFO("StreamAbstractionAAMP_MPD: Live latency correction is disabled due to the Pause operation!!");
aamp->mDisableRateCorrection = true;
AAMPLOG_INFO("Latency correction is disabled due to the Pause operation!!");
aamp->EnableLatencyMonitor(false);
}
}
else
Expand Down
Loading
Loading