Feature/vpaamp 237 unify cache fragment resolve symbols#1426
Merged
pstroffolino merged 7 commits intoMay 18, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the “chunk-cache” → “fragment-cache” mechanical rename across the player and unit tests, while also tightening some lock scoping and converting the per-track cached fragment ring buffer to a std::array-backed storage.
Changes:
- Renamed MediaTrack/StreamAbstraction/Config symbols from
*Chunk*to*Fragment*(including config enum + defaults) and propagated the renames through fakes/mocks/tests. - Replaced the per-track fixed C array cache with
std::array<CachedFragment, DEFAULT_LLD_CACHED_FRAGMENTS_PER_TRACK>and introduced an “active window” size (mCachedFragmentSize). - Consolidated/clarified locking around track lifetime counters and updated related comments/doxygen.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/utests/tests/TrackInjectTests/TrackInjectTests.cpp | Updates unit test references to new fragment-cache symbols and config enum. |
| test/utests/tests/StreamAbstractionAAMP/FunctionalTests.cpp | Updates mocked config lookups to eAAMPConfig_MaxLLDFragmentCached. |
| test/utests/tests/StreamAbstractionAAMP_MPD/StreamSelectionTest.cpp | Renames config enum usage in MPD stream selection tests. |
| test/utests/tests/StreamAbstractionAAMP_MPD/LinearFOGTests.cpp | Renames config enum usage in MPD FOG tests. |
| test/utests/tests/StreamAbstractionAAMP_MPD/FunctionalTests.cpp | Renames config enum usage in MPD functional tests. |
| test/utests/tests/StreamAbstractionAAMP_MPD/FetcherLoopTests.cpp | Renames config enum usage in MPD fetcher loop tests. |
| test/utests/tests/StreamAbstractionAAMP_MPD/AudioOnlyTests.cpp | Renames config enum usage in MPD audio-only tests. |
| test/utests/tests/StreamAbstractionAAMP_HLS/FunctionalTests.cpp | Updates HLS track state tests to new fragment-cache APIs/fields. |
| test/utests/tests/MediaTrackTests/MediaTrackTests.cpp | Updates MediaTrack unit tests to new fragment-cache APIs/fields. |
| test/utests/tests/MediaStreamContextTests/MediaStreamContextTests.cpp | Updates mocked GetFetch* API call names. |
| test/utests/tests/MediaStreamContextTests/FragmentDownloadTests.cpp | Updates mocked GetFetch*/UpdateTSAfter* calls and cached-count fields. |
| test/utests/tests/FragmentCollectorAdTests/AdSelectionTests.cpp | Renames config enum usage in ad selection tests. |
| test/utests/tests/CacheFragmentTests/CacheFragmentTests.cpp | Updates cached-count field name and config enum usage. |
| test/utests/mocks/MockMediaTrack.h | Renames mocked methods to GetFetchBuffer / UpdateTSAfterFetch. |
| test/utests/fakes/FakeStreamAbstractionAamp.cpp | Updates fake shims to delegate to renamed mock methods/APIs. |
| StreamAbstractionAAMP.h | Introduces std::array ring buffer, renames APIs/fields/CVs, adjusts getters. |
| streamabstraction.cpp | Updates core cache/inject logic to renamed fields + adds lock-order docs and new locked accessor. |
| priv_aamp.cpp | Updates stop-path unblock call to renamed API. |
| MediaStreamContext.cpp | Renames calls to fragment-cache APIs (WaitForCachedFragmentInjected, GetFetchBuffer, UpdateTSAfterFetch). |
| fragmentcollector_mpd.cpp | Propagates fragment-cache renames in MPD TSB/reader paths and cache sizing. |
| fragmentcollector_hls.cpp | Propagates fragment-cache renames in HLS fetch paths and comments. |
| AampDefine.h | Renames default constant to DEFAULT_LLD_CACHED_FRAGMENTS_PER_TRACK. |
| AampConfig.h | Renames config enum to eAAMPConfig_MaxLLDFragmentCached. |
| AampConfig.cpp | Updates config lookup table mapping for renamed enum/default. |
Comments suppressed due to low confidence (1)
streamabstraction.cpp:4699
SetCachedFragmentSize()validates againstmaxLLDCachedFragmentsPerTrackbut does not enforce the actual backing storage capacity (mCachedFragmentis a fixed-sizestd::array). If the config value exceedsDEFAULT_LLD_CACHED_FRAGMENTS_PER_TRACK,mCachedFragmentSizecan be set larger than the array and later loops/indexing (e.g.,FlushFragments, modulo wraps) will go out-of-bounds. ClampsizetomCachedFragment.size()(and handle invalid/0 sizes by falling back to a safe default) rather than just logging and leaving the previous value unchanged.
void MediaTrack::SetCachedFragmentSize(size_t size)
{
if (size > 0 && size <= maxLLDCachedFragmentsPerTrack)
{
AAMPLOG_TRACE("Set mCachedFragment size:%zu successfully", size);
mCachedFragmentSize = size;
}
else
{
AAMPLOG_ERR("Failed to set size:%zu", size);
}
}
Comment on lines
1870
to
+1882
| void MediaTrack::FlushFragments() | ||
| { | ||
| AAMPLOG_WARN("[%s]", name); | ||
| for (size_t i = 0; i < mCachedFragmentChunksSize; i++) | ||
| for (size_t i = 0; i < mCachedFragmentSize; i++) | ||
| { | ||
| mCachedFragmentChunks[i].Clear(); | ||
| mCachedFragment[i].Clear(); | ||
| } | ||
| aamp_utils::ClearAndRelease(unparsedBufferChunk); | ||
| aamp_utils::ClearAndRelease(parsedBufferChunk); | ||
| fragmentChunkIdxToInject = 0; | ||
| fragmentChunkIdxToFetch = 0; | ||
| fragmentIdxToInject = 0; | ||
| fragmentIdxToFetch = 0; | ||
| std::lock_guard<std::mutex> guard(mutex); | ||
| numberOfFragmentChunksCached = 0; | ||
| // We need to revisit if these variables should be also sync using mTrackParamsMutex | ||
| totalInjectedChunksDuration = 0; | ||
| numberOfFragmentsCached = 0; |
Contributor
Author
There was a problem hiding this comment.
Already covered by VPAAMP-180
jfagunde
reviewed
May 11, 2026
jfagunde
approved these changes
May 13, 2026
…agment_Resolve_Symbols
…agment_Resolve_Symbols
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.
Summary
Stage 3 completes the rename work begun in stages 1 and 2. No behavioural change — pure mechanical rename, lock-scope tidy, and comment cleanup.
Changes