Skip to content

VPAAMP-292: LLD Target Latency not Increasing on Underflow - #1776

Open
srikanthreddybijjam-comcast wants to merge 3 commits into
dev_sprint_25_2from
feature/VPAAMP-292
Open

VPAAMP-292: LLD Target Latency not Increasing on Underflow#1776
srikanthreddybijjam-comcast wants to merge 3 commits into
dev_sprint_25_2from
feature/VPAAMP-292

Conversation

@srikanthreddybijjam-comcast

@srikanthreddybijjam-comcast srikanthreddybijjam-comcast commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Reason for change: Added buffer check for audio along with video
Test Procedure: Refer the ticket VPAAMP-292
Priority: P1

@srikanthreddybijjam-comcast
srikanthreddybijjam-comcast requested a review from a team as a code owner July 23, 2026 09:34
@srikanthreddybijjam-comcast
srikanthreddybijjam-comcast force-pushed the feature/VPAAMP-292 branch 2 times, most recently from d249971 to 62fa16d Compare July 23, 2026 11:32
Comment thread streamabstraction.cpp Outdated
Comment thread streamabstraction.cpp Outdated
@srikanthreddybijjam-comcast
srikanthreddybijjam-comcast force-pushed the feature/VPAAMP-292 branch 2 times, most recently from 64b33e4 to 7df1c8b Compare July 27, 2026 09:20
Comment thread streamabstraction.cpp Outdated

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

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 report min(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.

Comment thread streamabstraction.cpp Outdated
Comment thread StreamAbstractionAAMP.h Outdated
Comment thread priv_aamp.h Outdated
Comment thread priv_aamp.h Outdated

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

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();

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
srikanthreddybijjam-comcast force-pushed the feature/VPAAMP-292 branch 2 times, most recently from 97b8261 to e1b29e4 Compare August 4, 2026 06:53
Comment thread test/utests/tests/AampLatencyMonitorTests/AampLatencyMonitorTestCases.cpp Outdated
Comment thread test/utests/tests/AampLatencyMonitorTests/AampLatencyMonitorTestCases.cpp Outdated
Comment thread MediaStreamContext.cpp Outdated
@srikanthreddybijjam-comcast
srikanthreddybijjam-comcast force-pushed the feature/VPAAMP-292 branch 3 times, most recently from 8b3ed09 to 46849ee Compare August 4, 2026 12:30
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>
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