VPAAMP-292: LLD Target Latency not Increasing on Underflow - #1776
Open
srikanthreddybijjam-comcast wants to merge 3 commits into
Open
VPAAMP-292: LLD Target Latency not Increasing on Underflow#1776srikanthreddybijjam-comcast wants to merge 3 commits into
srikanthreddybijjam-comcast wants to merge 3 commits into
Conversation
srikanthreddybijjam-comcast
force-pushed
the
feature/VPAAMP-292
branch
2 times, most recently
from
July 23, 2026 11:32
d249971 to
62fa16d
Compare
nu641001
reviewed
Jul 24, 2026
srikanthreddybijjam-comcast
force-pushed
the
feature/VPAAMP-292
branch
2 times, most recently
from
July 27, 2026 09:20
64b33e4 to
7df1c8b
Compare
Vinish100
reviewed
Jul 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates latency-monitor buffer accounting so underflow/low-buffer on audio can drive adaptive target-latency increases (VPAAMP-292), rather than relying on video-only buffered duration.
Changes:
- Introduce
GetMinAVBufferedDuration{,Secs}()to reportmin(audio, video)buffered duration for latency-monitor decisions. - Switch latency-monitor polling/wakeup paths to use the new min A/V buffered duration.
- Update/add L1 tests and fakes/mocks to exercise and support the new audio-buffer behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
streamabstraction.cpp |
Adds StreamAbstractionAAMP::GetMinAVBufferedDuration() implementation (min A/V buffer). |
StreamAbstractionAAMP.h |
Declares GetMinAVBufferedDuration() API for stream abstraction. |
priv_aamp.cpp |
Implements PrivateInstanceAAMP::GetMinAVBufferedDurationSecs() with try_to_lock sentinel behavior. |
priv_aamp.h |
Declares GetMinAVBufferedDurationSecs() for latency-monitor consumption. |
AampLatencyMonitor.cpp |
Uses GetMinAVBufferedDurationSecs() for polling and sentinel handling. |
MediaStreamContext.cpp |
Notifies latency monitor using min A/V buffer instead of video-only buffer. |
test/utests/mocks/MockPrivateInstanceAAMP.h |
Extends mock interface with GetMinAVBufferedDurationSecs(). |
test/utests/fakes/FakePrivateInstanceAAMP.cpp |
Adds fake delegation for GetMinAVBufferedDurationSecs() to the mock. |
test/utests/fakes/FakeStreamAbstractionAamp.cpp |
Adds stub for GetMinAVBufferedDuration() in the fake abstraction. |
test/utests/tests/MediaStreamContextTests/FragmentDownloadTests.cpp |
Updates expectations to the new buffer-duration method. |
test/utests/tests/AampLatencyMonitorTests/AampLatencyMonitorTestCases.cpp |
Updates existing tests and adds new cases validating audio-buffer-driven shifting and rate-correction suppression. |
srikanthreddybijjam-comcast
force-pushed
the
feature/VPAAMP-292
branch
5 times, most recently
from
August 3, 2026 11:02
888c1f6 to
7238657
Compare
Vinish100
reviewed
Aug 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (6)
MediaStreamContext.cpp:762
- Same issue as the earlier call site: taking std::min(video,audio) makes bufferMs negative when one track is unavailable (-1.0), preventing early notification even if the other track has a valid buffered duration. Compute min over valid (>= 0) durations instead.
const AampAVBufferDuration avBuf = aamp->GetMinAVBufferedDurationSecs();
const double bufferMs = std::min(avBuf.videoDurationSecs, avBuf.audioDurationSecs) * 1000.0;
test/utests/tests/MediaStreamContextTests/FragmentDownloadTests.cpp:79
- The comment says GetMinAVBufferedDurationSecs() is called for every video-track and audio-track fragment, but MediaStreamContext calls it only inside eTRACK_VIDEO branches. This comment is misleading for future test maintenance.
// GetMinAVBufferedDurationSecs() is called for every video-track and audio-track fragment via
priv_aamp.cpp:15106
- Doxygen tag should be
@return(not @returns) for consistency and correct extraction.
/**
* @brief Get audio and video buffered durations for the latency monitor.
* @returns buffer values in seconds
*/
AampLatencyMonitor.cpp:289
- bufferMs is computed as min(video,audio). However GetBuffered*DurationSec() can legitimately return -1.0 for a missing/disabled track (not only lock contention), which makes bufferMs negative and causes the latency poll to be skipped even when the other track has a valid buffered duration (e.g., audio-only or video-only playback). Consider ignoring negative per-track values and only treating the poll as unavailable when both are negative.
const AampAVBufferDuration avBuf = mAamp->GetMinAVBufferedDurationSecs();
const double bufferMs = std::min(avBuf.videoDurationSecs, avBuf.audioDurationSecs) * 1000.0;
// A negative bufferMs is the sentinel returned by GetMinAVBufferedDurationSecs()
// when mStreamLock could not be acquired (std::try_to_lock contention).
MediaStreamContext.cpp:250
- This uses std::min(video,audio) directly, so if either track reports a negative sentinel (e.g., missing/disabled track), bufferMs becomes negative and the latency monitor won't be notified even though the other track may have valid buffered duration. Compute the minimum over valid (>= 0) durations instead.
This issue also appears on line 761 of the same file.
const AampAVBufferDuration avBuf = aamp->GetMinAVBufferedDurationSecs();
const double bufferMs = std::min(avBuf.videoDurationSecs, avBuf.audioDurationSecs) * 1000.0;
if (bufferMs >= 0.0)
priv_aamp.h:4082
- The name GetMinAVBufferedDurationSecs suggests it returns a single minimum duration, but it actually returns both A/V durations in a struct (callers then compute the min). Consider renaming to reflect the return type (e.g., GetAVBufferedDurationSecs / GetAVBufferedDurationsSecs) to reduce API ambiguity.
/**
* @fn GetMinAVBufferedDurationSecs
* @brief Get audio and video buffered durations for use by the latency monitor.
* @return AampAVBufferDuration containing both audio and video buffered durations in seconds.
*/
AampAVBufferDuration GetMinAVBufferedDurationSecs();
srikanthreddybijjam-comcast
force-pushed
the
feature/VPAAMP-292
branch
from
August 4, 2026 05:17
7238657 to
d54264e
Compare
Reason for change: Added buffer check for audio along with video Test Procedure: Refert he tickert VPAAMP-292 Priority: P1 Signed-off-by: srikanthreddybijjam-comcast <srikanthreddybijjam.2000@gmail.com>
Reason for change: Added buffer check for audio along with video Test Procedure: Refert he tickert VPAAMP-292 Priority: P1 Signed-off-by: srikanthreddybijjam-comcast <srikanthreddybijjam.2000@gmail.com>
srikanthreddybijjam-comcast
force-pushed
the
feature/VPAAMP-292
branch
2 times, most recently
from
August 4, 2026 06:53
97b8261 to
e1b29e4
Compare
Vinish100
reviewed
Aug 4, 2026
srikanthreddybijjam-comcast
force-pushed
the
feature/VPAAMP-292
branch
3 times, most recently
from
August 4, 2026 12:30
8b3ed09 to
46849ee
Compare
Reason for change: Added buffer check for audio along with video Test Procedure: Refer the ticket VPAAMP-292 Priority: P1 Signed-off-by: srikanthreddybijjam-comcast <srikanthreddybijjam.2000@gmail.com>
srikanthreddybijjam-comcast
force-pushed
the
feature/VPAAMP-292
branch
from
August 4, 2026 14:41
46849ee to
e6a4897
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for change: Added buffer check for audio along with video
Test Procedure: Refer the ticket VPAAMP-292
Priority: P1