Skip to content

Feature/vplay 12671 replace append bytes calls#1012

Merged
pstroffolino merged 14 commits intodev_sprint_25_2from
feature/VPLAY-12671_Replace_AppendBytes_calls
Feb 24, 2026
Merged

Feature/vplay 12671 replace append bytes calls#1012
pstroffolino merged 14 commits intodev_sprint_25_2from
feature/VPLAY-12671_Replace_AppendBytes_calls

Conversation

@DomSyna
Copy link
Contributor

@DomSyna DomSyna commented Feb 11, 2026

Summary

Replacing AppendBytes() method with vector like alternatives assign() and insert().

Key Changes:

  • Replaced AppendBytes() calls with assign() (for replacement) or insert() (for appending) across production and test code
  • Removed redundant clear() calls before assign() operations (assign already clears)
  • Eliminated unnecessary casts by using data() instead of GetPtr() with reinterpret_cast in buffer operations
  • Updated CachedFragment::Copy() to use assign() without explicit length parameter

All changes maintain backward compatibility and test coverage.

@DomSyna DomSyna marked this pull request as ready for review February 21, 2026 11:05
@DomSyna DomSyna requested a review from a team as a code owner February 21, 2026 11:05
Copilot AI review requested due to automatic review settings February 21, 2026 11:05
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 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() with insert() (append semantics) or assign() (replace semantics) across production and test code.
  • Updated CachedFragment::Copy() signature to remove the explicit length parameter and copy via vector-style assignment.
  • Added AampGrowableBuffer vector-like wrappers (assign, updated insert) 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 other unconditionally (e.g., other->position), but call sites/tests pass nullptr (see CachedFragmentTestCases uses Copy(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 calls fragment.Free() before reading other->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;

Copilot AI review requested due to automatic review settings February 23, 2026 20:41
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 36 out of 36 changed files in this pull request and generated 1 comment.

@pstroffolino pstroffolino merged commit 64f28ef into dev_sprint_25_2 Feb 24, 2026
9 of 11 checks passed
@pstroffolino pstroffolino deleted the feature/VPLAY-12671_Replace_AppendBytes_calls branch February 24, 2026 13:39
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.

4 participants