Skip to content

VPLAY-12164 Http 404 for mpd while channel change#845

Open
sayanurag wants to merge 1 commit intodev_sprint_25_2from
feature/VPLAY-12164_http-404
Open

VPLAY-12164 Http 404 for mpd while channel change#845
sayanurag wants to merge 1 commit intodev_sprint_25_2from
feature/VPLAY-12164_http-404

Conversation

@sayanurag
Copy link
Contributor

Reason for change: Moving the Teardown operation before the mpd update release cause some delay and results in more Http 404 errors.
Test Procedure: updated in ticket
Risks: Low

Copilot AI review requested due to automatic review settings January 13, 2026 10:12
@sayanurag sayanurag requested a review from a team as a code owner January 13, 2026 10:12
Copy link
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 addresses HTTP 404 errors occurring during channel changes by moving the MPD downloader release operation to happen immediately after stream abstraction deletion, rather than waiting for the complete Stop() sequence to finish.

Changes:

  • Added conditional MPD downloader release inside TeardownStream() when disableDownloads is true
  • The early release prevents unnecessary MPD update requests that would fail with HTTP 404 during channel transitions

Copilot AI review requested due to automatic review settings January 20, 2026 11:08
Copy link
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

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

@sayanurag sayanurag force-pushed the feature/VPLAY-12164_http-404 branch from 6098e5f to 62d4beb Compare January 20, 2026 11:16
Copilot AI review requested due to automatic review settings January 21, 2026 20:48
Copy link
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

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

@sayanurag sayanurag force-pushed the feature/VPLAY-12164_http-404 branch from 42b9a38 to d1bcc85 Compare February 27, 2026 14:11
Copilot AI review requested due to automatic review settings February 27, 2026 18:10
@sayanurag sayanurag force-pushed the feature/VPLAY-12164_http-404 branch from d1bcc85 to 0c0ac9c Compare February 27, 2026 18:10
Copy link
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

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

Comment on lines +315 to +320
/**
* @fn SetFogTsbDeleted
* @brief Function to Set if Fog TSB is deleted
*/
void SetFogTsbDeleted(bool bDeleted) {mFogTsbDeleted = bDeleted;}

Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

New public API SetFogTsbDeleted() and the new early-exit behavior in the download loop should have unit coverage (e.g., ensure setting the flag causes the downloader thread to stop requesting MPDs / exits promptly). There are existing AampMPDDownloader functional tests, so extending them here will help prevent regressions.

Copilot generated this review using guidance from repository custom instructions.
Copilot AI review requested due to automatic review settings February 27, 2026 18:30
Copy link
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

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

Comment on lines +399 to +404
if(mFogTsbDeleted)
{
//TODO: Deprecate when Fog tsb is removed. Ignore the manifest request from AAMP after the TSB deleted in fog when the stop called.
AAMPLOG_INFO("Fog tsb deleted. Ignoring MPD request and exiting");
break;
}
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

The flag check at line 399 lacks mutex protection. While this flag is being added to prevent unnecessary downloads after TSB deletion, accessing it without synchronization creates a race condition with the setter in PrivateInstanceAAMP::Stop().

There are two approaches to fix this:

  1. If the flag is changed to std::atomic_bool (as recommended in the header file comment), use .load() here: if(mFogTsbDeleted.load())
  2. Alternatively, check this flag within the existing mutex-protected section (lines 357-372) where mReleaseCalled is checked, since both serve similar purposes of terminating the download loop gracefully.

Copilot uses AI. Check for mistakes.
Comment on lines +316 to +319
* @fn SetFogTsbDeleted
* @brief Function to Set if Fog TSB is deleted
*/
void SetFogTsbDeleted(bool bDeleted) {mFogTsbDeleted = bDeleted;}
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

There is a mismatch between the method name declared here (SetFogTsbDeleted) and how it's called in priv_aamp.cpp:8365 (SetTsbDeleted). This will cause a compilation error because the method names don't match.

The declaration should be renamed to match the call site, or vice versa. Based on the pattern in the codebase and the fact that "Fog" is implementation-specific, SetTsbDeleted seems like the more appropriate name.

Suggested change
* @fn SetFogTsbDeleted
* @brief Function to Set if Fog TSB is deleted
*/
void SetFogTsbDeleted(bool bDeleted) {mFogTsbDeleted = bDeleted;}
* @fn SetTsbDeleted
* @brief Function to set if TSB is deleted
*/
void SetTsbDeleted(bool bDeleted) { mFogTsbDeleted = bDeleted; }

Copilot uses AI. Check for mistakes.
Comment on lines +399 to +404
if(mFogTsbDeleted)
{
//TODO: Deprecate when Fog tsb is removed. Ignore the manifest request from AAMP after the TSB deleted in fog when the stop called.
AAMPLOG_INFO("Fog tsb deleted. Ignoring MPD request and exiting");
break;
}
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

The new SetTsbDeleted method and the flag check logic in downloadMPDThread1() lack test coverage. Given that this functionality addresses a critical issue (HTTP 404 errors during channel changes), it should have unit tests to verify:

  1. That setting the flag prevents subsequent MPD download attempts in the download thread
  2. That the flag is properly initialized to false
  3. Thread safety of the flag access (if implemented with atomic operations)

The existing test suite in test/utests/tests/AampMPDDownloader/FunctionalTests.cpp provides a good foundation for adding these tests.

Copilot uses AI. Check for mistakes.
Copy link
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

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

Comment on lines +399 to +404
if(mFogTsbDeleted.load())
{
//TODO: Depecrate when Fog tsb is removed. Ignore the manifest request from AAMP after the TSB deleted in fog when the stop called.
AAMPLOG_INFO("Fog tsb deleted. Ignoring MPD request and exiting");
break;
}
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

Missing test coverage: The new functionality for setting and checking the Fog TSB deletion flag lacks test coverage. Given that the test suite has comprehensive tests for AampMPDDownloader (see test/utests/tests/AampMPDDownloader/FunctionalTests.cpp), new behavior should be covered. Consider adding a test that verifies the download loop exits correctly when mFogTsbDeleted is set to true.

Copilot uses AI. Check for mistakes.
mCheckedLLDData(false),mMPDNotifierMtx(),mMPDNotifierCondVar(),mManifestRefreshCount(0),mIsLowLatency(false),
mMPDDnldDataMtx(),mMPDDnldDataCondVar()
,mLLDashData(),mCurrentposDeltaToManifestEnd(-1),mPublishTime(0),mMinimalRefreshRetryCount(0),mMPDNotifyPending(false)
,mLLDashData(),mCurrentposDeltaToManifestEnd(-1),mPublishTime(0),mMinimalRefreshRetryCount(0),mMPDNotifyPending(false),mFogTsbDeleted(false)
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

The fake implementation of AampMPDDownloader in test/utests/fakes/FakeAampMPDDownloader.cpp needs to be updated to include the new mFogTsbDeleted member in its constructor initializer list to match the production code. This inconsistency could cause issues in tests that depend on the fake implementation.

Copilot uses AI. Check for mistakes.
Comment on lines +8363 to +8366
if(mMPDDownloaderInstance != nullptr)
{
mMPDDownloaderInstance->SetTsbDeleted(true);
}
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

Potential race condition: The SetTsbDeleted(true) call sets the atomic flag, but there's no synchronization to ensure the download thread has seen this flag before the TSB deletion proceeds. While std::atomic provides memory ordering guarantees, consider whether additional synchronization (e.g., waiting for the download thread to acknowledge the flag) is needed to ensure no HTTP 404 errors occur if the download thread is in the middle of processing a request when the TSB is deleted.

Copilot uses AI. Check for mistakes.
@sayanurag sayanurag force-pushed the feature/VPLAY-12164_http-404 branch from 7db7319 to 313f366 Compare March 2, 2026 13:13
@sayanurag sayanurag requested a review from Copilot March 2, 2026 13:13
@sayanurag sayanurag force-pushed the feature/VPLAY-12164_http-404 branch from 313f366 to 7f30bba Compare March 2, 2026 13:15
Copy link
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

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

@sayanurag sayanurag requested a review from Copilot March 2, 2026 13:50
Copy link
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@sayanurag sayanurag force-pushed the feature/VPLAY-12164_http-404 branch from 7f30bba to aef3b23 Compare March 2, 2026 14:36
Reason for change: MPD requested to fog through downloadMPDThread1 even after deleting the fog tsb from PrivateInstanceAAMP::Stop(). It results in HTTP 404 error during fast channel change. This change will avoid the MPD request if the Fog TSB is deleted.
Test Procedure: updated in ticket
Risks: Low

Signed-off-by: Anurag Krishnan <akrish513@cable.comcast.com>
Copilot AI review requested due to automatic review settings March 2, 2026 16:20
@sayanurag sayanurag force-pushed the feature/VPLAY-12164_http-404 branch from aef3b23 to 5647483 Compare March 2, 2026 16:20
Copy link
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Copy link
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

{
if(mFogTsbDeleted.load())
{
//TODO: Deprecate when Fog tsb is removed. Ignore the manifest request from AAMP after the TSB deleted in fog when the stop called.
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

Breaking out of the download loop when mFogTsbDeleted is set exits the downloader thread without setting mReleaseCalled. Since IsDownloaderDisabled() is based on mReleaseCalled, this can leave the downloader appearing “active” while no thread is running, and (combined with the flag not being reset) can also block future tunes. Consider treating this path as a release/stop signal (set mReleaseCalled and wake any waits), and ensure the flag is cleared as part of normal Initialize()/Start() for the next tune.

Suggested change
//TODO: Deprecate when Fog tsb is removed. Ignore the manifest request from AAMP after the TSB deleted in fog when the stop called.
//TODO: Deprecate when Fog tsb is removed. Ignore the manifest request from AAMP after the TSB deleted in fog when the stop called.
{
std::lock_guard<std::recursive_mutex> lock(mMPDDnldMutex);
mReleaseCalled = true;
}

Copilot uses AI. Check for mistakes.
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.

3 participants