Skip to content

VPAAMP-501: avoid generating "download failed" event prematurely while retrying#1573

Open
Vinish100 wants to merge 1 commit into
dev_sprint_25_2from
feature/VPAAMP-501
Open

VPAAMP-501: avoid generating "download failed" event prematurely while retrying#1573
Vinish100 wants to merge 1 commit into
dev_sprint_25_2from
feature/VPAAMP-501

Conversation

@Vinish100

Copy link
Copy Markdown
Contributor

Reason for change: Added retry support if the manifest is corrupted/un-supported. Avoid sending error event when the manifest update callback fails to get a good manifest
Test Procedure: Fail manifest downloads occasionally and confirm playback is uninterrupted. Confirm once buffer runs dry a media error event is sent. Risks: Medium

… we are retrying

Reason for change: Added retry support if the manifest is corrupted/un-supported.
Avoid sending error event when the manifest update callback fails to get a good
manifest
Test Procedure: Fail manifest downloads occasionally and confirm playback is
uninterrupted. Confirm once buffer runs dry a media error event is sent.
Risks: Medium

Signed-off-by: Vinish100 <vinish.balan@gmail.com>
@Vinish100 Vinish100 requested a review from a team as a code owner June 9, 2026 08:15
@Vinish100 Vinish100 requested a review from Copilot June 9, 2026 08:15

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

This PR aims to prevent AAMP from emitting a premature “download failed”/manifest error event during MPD refresh failures while the downloader is still retrying, so established playback can continue uninterrupted until buffering actually fails.

Changes:

  • Update MPDUpdateCallbackExec() to stop firing immediate error/download-failed events on refresh failure and instead log + continue using the prior manifest.
  • Add/extend a fast-retry loop in the MPD downloader so refresh failures (including parse/content errors) trigger a 500ms retry cadence rather than exiting or waiting a full interval.
  • Minor cleanup/formatting adjustments in MPD manifest fetch / FOG handling.

Reviewed changes

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

File Description
fragmentcollector_mpd.cpp Avoids sending error events during MPD refresh failures; keeps playback using the previous manifest while logging/recording FOG reason.
AampMPDDownloader.cpp Implements/extends fast retry behavior for refresh failures and refines logging; however currently includes a stray \ line that should be removed.

Comment thread AampMPDDownloader.cpp
Comment on lines 409 to 413
mMPDData->mLastPlaylistDownloadTimeMs = aamp_GetCurrentTimeMS();
mMPDData->parseMPD();
\
if(firstDownload)
{
Comment thread fragmentcollector_mpd.cpp
aamp->mFogTSBEnabled)
{
if (http_error == 512 )
for ( std::string header : tmpManifestDnldRespPtr->mMPDDownloadResponse->mResponseHeader )
Comment thread AampMPDDownloader.cpp
Comment on lines +531 to +544
if (!firstDownload &&
mMPDData->mMPDStatus != AAMPStatusType::eAAMPSTATUS_OK &&
!mReleaseCalled)
{
AAMPLOG_WARN("Refresh after 500ms to handle a manifest timeout error.");
//Forcefully go with 500 ms refresh after a download failure
mRefreshInterval = MIN_DELAY_BETWEEN_PLAYLIST_UPDATE_MS;
downloadFailed = true;
refreshNeeded = waitForRefreshInterval(mRefreshInterval);
}
else if(!firstDownload && !IS_HTTP_SUCCESS(mMPDData->mMPDDownloadResponse->iHttpRetValue) && !mReleaseCalled)
{
// Other download failures (e.g. curl 56 CURLE_RECV_ERROR, transient HTTP errors)
// during an established live session: keep the refresh loop alive so the next
// manifest fetch is attempted rather than killing the downloader thread.
// Use 500ms fast-retry (same as timeout/COULDNT_CONNECT) to minimise buffer impact
// on LLD streams; mRefreshInterval is not permanently overwritten.
uint32_t fastRetry = MIN_DELAY_BETWEEN_PLAYLIST_UPDATE_MS;
AAMPLOG_WARN("Manifest download error [%d], will retry after %ums.", mMPDData->mMPDDownloadResponse->iHttpRetValue, fastRetry);
const uint32_t fastRetryMs = MIN_DELAY_BETWEEN_PLAYLIST_UPDATE_MS;
bool isTimeoutOrConnectionFailure = IsCurlTimeoutFailure(mMPDData->mMPDDownloadResponse->iHttpRetValue)
|| (CURLE_COULDNT_CONNECT == mMPDData->mMPDDownloadResponse->iHttpRetValue);
AAMPLOG_WARN("Manifest %s [%d], fast retry after %ums.",
isTimeoutOrConnectionFailure ? "timeout/connection failure" : "download error",
mMPDData->mMPDDownloadResponse->iHttpRetValue, fastRetryMs);

downloadFailed = true;
refreshNeeded = waitForRefreshInterval(fastRetry);
refreshNeeded = waitForRefreshInterval(fastRetryMs);
// Note: mRefreshInterval unchanged; normal refresh cadence resumes after recovery
Comment thread AampMPDDownloader.cpp
Comment on lines +531 to +533
if (!firstDownload &&
mMPDData->mMPDStatus != AAMPStatusType::eAAMPSTATUS_OK &&
!mReleaseCalled)
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