Skip to content

VPAAMP-857:False underflow fired after seek+fragment-retry - #1783

Open
varshnie wants to merge 2 commits into
dev_sprint_25_2from
feature/VPAAMP-857
Open

VPAAMP-857:False underflow fired after seek+fragment-retry#1783
varshnie wants to merge 2 commits into
dev_sprint_25_2from
feature/VPAAMP-857

Conversation

@varshnie

Copy link
Copy Markdown
Contributor

Reason for change:GStreamer reports a stale pre-seek position during seek+fragment-retry,causing NotifyVideoFragment to compute negative bufferSec which triggered an immediate false underflow. Fixed by disarming on negative bufferSec and passing 0.0f rate when pipeline is intentionally paused. Risks: p1

Reason for change:GStreamer reports a stale pre-seek position during seek+fragment-retry,causing NotifyVideoFragment to compute negative bufferSec which triggered an immediate false underflow. Fixed by disarming on negative bufferSec and passing 0.0f rate when pipeline is intentionally paused.
Risks: p1

Signed-off-by: varshnie <varshniblue14@gmail.com>
@varshnie
varshnie requested a review from a team as a code owner July 27, 2026 08:35
@varshnie
varshnie requested a review from Copilot July 27, 2026 08:35

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

Fixes a false video underflow being raised after seek + fragment-retry by making the underflow monitor treat “impossible” negative buffer depth as a stale GStreamer position and by explicitly disarming deadlines when the pipeline is intentionally paused.

Changes:

  • Pass playRate=0.0f to the underflow monitor when the sink is intentionally paused, so the monitor disarms instead of arming.
  • In AampUnderflowMonitor::NotifyVideoFragment, disarm (instead of clamping) when computed bufferSec is negative to avoid immediate false underflow.
  • On user pause (SetRateInternal(rate==0)), notify the underflow monitor that the pipeline is paused so deadlines are disarmed.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
MediaStreamContext.cpp Adjusts NotifyVideoFragmentToUnderflowMonitor() call sites to pass 0-rate while paused.
main_aamp.cpp Disarms underflow monitoring when the user pauses the pipeline.
AampUnderflowMonitor.cpp Treats negative bufferSec as stale position and disarms the deadline.
Comments suppressed due to low confidence (1)

MediaStreamContext.cpp:760

  • Same issue as the earlier LL-DASH chunk path: mSinkPaused is true during buffering underflow as well as user pause, and NotifyVideoFragment() needs a non-zero playRate during underflow recovery so it can rearm the deadline after it resumes the pipeline.
		// aamp->rate is the last non-zero rate and stays 1.0 even when paused.
		// Pass 0.0f when mSinkPaused so RearmDeadline disarms instead of arming.
		context->NotifyVideoFragmentToUnderflowMonitor(
			dlInfo->absolutePosition + dlInfo->fragmentDurationSec,
			aamp->mSinkPaused.load() ? 0.0f : aamp->rate);

Comment thread MediaStreamContext.cpp Outdated
Comment thread AampUnderflowMonitor.cpp
Comment thread AampUnderflowMonitor.cpp
// download retry is in progress and GStreamer hasn't flushed yet). Disarm
// the deadline rather than clamping to 0, which would trigger an immediate
// false underflow.
if (bufferSec < 0.0)

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.

Lets wait for @pstroffolino review comment.
Current behavior -> if bogus position received from GStreamer, bufferSec drops negative and underflow is fired
Impact -> While receiving bogus position, underflow monitor is disarmed, thus not impacting playback as well as losing underflow detection

Comment thread main_aamp.cpp Outdated
Comment thread MediaStreamContext.cpp Outdated
@varshnie
varshnie force-pushed the feature/VPAAMP-857 branch 2 times, most recently from 245aa61 to ad24ebe Compare August 3, 2026 09:46
Reason for change:GStreamer reports a stale pre-seek position during seek+fragment-retry,causing NotifyVideoFragment to compute negative bufferSec which triggered an immediate false underflow. Fixed by disarming on negative bufferSec and passing 0.0f rate when pipeline is intentionally paused.
Risks: p1

Signed-off-by: varshnie <varshniblue14@gmail.com>
@varshnie
varshnie force-pushed the feature/VPAAMP-857 branch from ad24ebe to c2d818f Compare August 3, 2026 09:48
Comment thread AampUnderflowMonitor.cpp
// false underflow.
if (bufferSec < 0.0)
{
AAMPLOG_WARN("[video] negative bufferSec=%.3f (endPos=%.3f positionSec=%.3f) — stale GSTpos; disarming deadline",

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.

Lets not mention GSTpos

Comment thread main_aamp.cpp
// paused by the user. This disarms the deadline so that fragments
// downloaded while paused (e.g. during seek-while-paused) do not
// trigger a false underflow via NotifyVideoFragment.
if (aamp->mpStreamAbstractionAAMP)

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.

Check for retVal before calling NotifyPipelinePausedToUnderflowMonitor, will help plug any issues if pipeline didn't pause

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.

4 participants