Skip to content

VPAAMP-346 restore period state when UpdateTrackInfo fails in HandleS…#1454

Open
pstroffolino wants to merge 1 commit into
dev_sprint_25_2from
feature/VPAAMP-346
Open

VPAAMP-346 restore period state when UpdateTrackInfo fails in HandleS…#1454
pstroffolino wants to merge 1 commit into
dev_sprint_25_2from
feature/VPAAMP-346

Conversation

@pstroffolino
Copy link
Copy Markdown
Contributor

…eekEOSAndPeriodTransition

HandleSeekEOSAndPeriodTransition updates six period-identity members (mCurrentPeriodIdx, mCurrentPeriod, mBasePeriodId, mPeriodStartTime, mPeriodDuration, mPeriodEndTime) before calling UpdateTrackInfo. If UpdateTrackInfo returns failure (malformed period, no codec-compatible representation, null track context after live manifest refresh), the function returned false but left all six members pointing at the new, uninitialised period. The next fetcher-loop iteration would read mCurrentPeriodIdx as the new value and attempt to download fragments from a period whose tracks were never set up, producing download errors or incorrect init-segment selection.

Fix: snapshot all six members before the switch. On UpdateTrackInfo failure, restore them and return false so the caller sees a clean no-op.

Unit test: HandleSeekEOS_UpdateTrackInfoFails_PeriodStateRestored forces UpdateTrackInfo to fail by nulling the audio track context (UpdateTrackInfo returns MANIFEST_CONTENT_ERROR on a null context) and verifies that mCurrentPeriodIdx is restored to its pre-switch value.

…eekEOSAndPeriodTransition

HandleSeekEOSAndPeriodTransition updates six period-identity members
(mCurrentPeriodIdx, mCurrentPeriod, mBasePeriodId, mPeriodStartTime,
mPeriodDuration, mPeriodEndTime) before calling UpdateTrackInfo.  If
UpdateTrackInfo returns failure (malformed period, no codec-compatible
representation, null track context after live manifest refresh), the function
returned false but left all six members pointing at the new, uninitialised
period.  The next fetcher-loop iteration would read mCurrentPeriodIdx as the
new value and attempt to download fragments from a period whose tracks were
never set up, producing download errors or incorrect init-segment selection.

Fix: snapshot all six members before the switch.  On UpdateTrackInfo failure,
restore them and return false so the caller sees a clean no-op.

Unit test: HandleSeekEOS_UpdateTrackInfoFails_PeriodStateRestored forces
UpdateTrackInfo to fail by nulling the audio track context (UpdateTrackInfo
returns MANIFEST_CONTENT_ERROR on a null context) and verifies that
mCurrentPeriodIdx is restored to its pre-switch value.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make MPD period transitions safer by rolling back period state when HandleSeekEOSAndPeriodTransition() cannot complete UpdateTrackInfo(), preventing the fetch loop from continuing with a partially switched period.

Changes:

  • Adds period-state snapshot/restore logic around the period switch path.
  • Adds an L1 regression test that forces UpdateTrackInfo() failure during a forward period transition.

L1 test verdict: Mostly valid, but needs revision.

Reviewed changes

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

File Description
fragmentcollector_mpd.cpp Restores selected period identity fields when UpdateTrackInfo() fails during EOS-driven period transition.
test/utests/tests/StreamAbstractionAAMP_MPD/FetcherLoopTests.cpp Adds test accessors and a regression test for failed period-switch rollback.

Comment thread fragmentcollector_mpd.cpp
Comment on lines +1993 to +1998
mCurrentPeriodIdx = savedPeriodIdx;
mCurrentPeriod = savedCurrentPeriod;
mBasePeriodId = savedBasePeriodId;
mPeriodStartTime = savedPeriodStartTime;
mPeriodDuration = savedPeriodDuration;
mPeriodEndTime = savedPeriodEndTime;

// UpdateTrackInfo failed: the period switch must have been rolled back.
EXPECT_FALSE(transitioned);
EXPECT_EQ(mTestableStreamAbstractionAAMP_MPD->GetCurrentPeriodIdx(), periodBefore);
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.

2 participants