Feature/vplay 12671 replace append bytes calls#1012
Merged
pstroffolino merged 14 commits intodev_sprint_25_2from Feb 24, 2026
Merged
Feature/vplay 12671 replace append bytes calls#1012pstroffolino merged 14 commits intodev_sprint_25_2from
pstroffolino merged 14 commits intodev_sprint_25_2from
Conversation
jfagunde
reviewed
Feb 12, 2026
jfagunde
reviewed
Feb 12, 2026
jfagunde
reviewed
Feb 12, 2026
jfagunde
reviewed
Feb 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes buffer-manipulation call sites by replacing AampGrowableBuffer::AppendBytes() usage with assign()/insert()-style operations across core playback code (demuxing, download callbacks, fragment caching) and extensive unit test coverage.
Changes:
- Replaced
AppendBytes()withinsert()(append semantics) orassign()(replace semantics) across production and test code. - Updated
CachedFragment::Copy()signature to remove the explicit length parameter and copy via vector-style assignment. - Added
AampGrowableBuffervector-like wrappers (assign, updatedinsert) to reduce repeated casts at call sites.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tsDemuxer.cpp | Replace PES/ES buffer appends with insert() calls. |
| streamabstraction.cpp | Replace chunk buffer appends/rewrites with insert()/assign(). |
| priv_aamp.cpp | Replace write-callback buffer appends with insert(). |
| mp4demux/MP4Demux.cpp | Replace sample payload append with insert(). |
| middleware/drm/helper/VerimatrixHelper.cpp | Replace vector assignments with iterator-based assign(). |
| isobmff/isobmffprocessor.cpp | Replace cached init-segment appends with assign(). |
| fragmentcollector_hls.cpp | Replace subtitle workaround buffer writes with assign()/insert(). |
| MediaStreamContext.cpp | Replace fragment chunk caching append with assign(). |
| CachedFragment.h | Update CachedFragment::Copy() signature (remove len). |
| CachedFragment.cpp | Rework Copy() implementation to use assign(). |
| AampGrowableBuffer.h | Add/adjust vector-like assign()/insert() wrappers. |
| test/utests/tests/fragmentcollector_mpd/pts_offset.cpp | Replace manifest download buffer population with assign(). |
| test/utests/tests/fragmentcollector_hls/byteRangeTests.cpp | Replace test buffer fill with assign(). |
| test/utests/tests/TsProcessorTests/sendSegmentTests.cpp | Replace test segment buffer fill with assign(). |
| test/utests/tests/TrackInjectTests/TrackInjectTests.cpp | Replace cached fragment fill with assign(); minor type cleanup. |
| test/utests/tests/StreamAbstractionAAMP_MPD/subtitleTests.cpp | Replace manifest download buffer population with assign(). |
| test/utests/tests/StreamAbstractionAAMP_MPD/LinearFOGTests.cpp | Replace downloaded fragment buffer fill with assign() and const data. |
| test/utests/tests/StreamAbstractionAAMP_MPD/FunctionalTests.cpp | Replace manifest buffer fills with assign(). |
| test/utests/tests/StreamAbstractionAAMP_MPD/AudioTrackSwitchTests.cpp | Replace manifest download buffer population with assign(). |
| test/utests/tests/StreamAbstractionAAMP_MPD/AudioTrackSelectionTests.cpp | Replace manifest download buffer population with assign(). |
| test/utests/tests/StreamAbstractionAAMP_MPD/AudioOnlyTests.cpp | Replace manifest download buffer population with assign(). |
| test/utests/tests/StreamAbstractionAAMP_HLS/FunctionalTests.cpp | Replace main manifest buffer fills with assign(). |
| test/utests/tests/PrivAampTests/PrivAampTests.cpp | Replace multiple test buffer fills with assign() and shared length constants. |
| test/utests/tests/MediaTrackTests/MediaTrackTests.cpp | Replace fragment test-data buffer fills; update Copy() call sites. |
| test/utests/tests/MediaStreamContextTests/FragmentDownloadTests.cpp | Replace cached fragment buffer fill with assign(). |
| test/utests/tests/IsoBmffProcessorTests/FunctionalTests.cpp | Replace dummy buffer fill with assign(). |
| test/utests/tests/IsoBmffHelperTests/IsoBmffHelperTests.cpp | Replace helper test buffer fills with assign(). |
| test/utests/tests/IsoBmffConvertToKeyFrameTests/IsoBmffConvertToKeyFrameTests.cpp | Replace input buffer fill with assign(). |
| test/utests/tests/CachedFragmentTests/CachedFragmentTestCases.cpp | Update tests for new Copy() signature (remove len). |
| test/utests/tests/CacheFragmentTests/CacheFragmentTests.cpp | Replace temp fragment fill with assign(). |
| test/utests/tests/AdManagerMPDTests/FunctionalTests.cpp | Replace manifest buffer fill with assign(). |
| test/utests/tests/AdFallbackTests/FunctionalTests.cpp | Replace manifest buffer fills with assign(). |
| test/utests/tests/AampTsbSessionManagerTests_Mocked/FunctionalTests.cpp | Replace fragment buffer fills with assign(). |
| test/utests/tests/AampTSBSessionManager/FunctionalTests.cpp | Replace fragment buffer fills with assign(). |
| test/utests/tests/AampMp4DemuxTests/FunctionalTests.cpp | Replace multiple test buffer/sample fills with assign(). |
| test/utests/tests/AampMPDParseHelper/FunctionalTests.cpp | Replace manifest download buffer population with assign(). |
Comments suppressed due to low confidence (1)
CachedFragment.cpp:61
- CachedFragment::Copy() dereferences
otherunconditionally (e.g.,other->position), but call sites/tests passnullptr(see CachedFragmentTestCases usesCopy(nullptr)). This will crash. Add a null check at the top (and define expected behavior, e.g., no-op or Clear()), and consider guarding self-copy (other == this) since the current implementation callsfragment.Free()before readingother->fragment.
void CachedFragment::Copy(CachedFragment* other)
{
// Clear existing data first
this->fragment.Free();
// Copy all member variables
this->position = other->position;
this->duration = other->duration;
jfagunde
approved these changes
Feb 23, 2026
pstroffolino
approved these changes
Feb 23, 2026
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
Replacing
AppendBytes()method with vector like alternativesassign()andinsert().Key Changes:
AppendBytes()calls withassign()(for replacement) orinsert()(for appending) across production and test codeclear()calls beforeassign()operations (assign already clears)data()instead ofGetPtr()with reinterpret_cast in buffer operationsCachedFragment::Copy()to useassign()without explicit length parameterAll changes maintain backward compatibility and test coverage.