Skip to content

Feature/vplay 12900 cached fragment to use vector#1141

Merged
pstroffolino merged 40 commits intodev_sprint_25_2from
feature/VPLAY-12900_CachedFragment_to_use_vector
Mar 15, 2026
Merged

Feature/vplay 12900 cached fragment to use vector#1141
pstroffolino merged 40 commits intodev_sprint_25_2from
feature/VPLAY-12900_CachedFragment_to_use_vector

Conversation

@DomSyna
Copy link
Copy Markdown
Contributor

@DomSyna DomSyna commented Mar 6, 2026

Change CachedFragment to use std::vector instead of AampGrowableBuffer

DomSyna and others added 30 commits March 2, 2026 15:21
removed AAMP_NET_TRACE tests
Signed-off-by: Philip Stroffolino <philip_stroffolino@cable.comcast.com>
Signed-off-by: Philip Stroffolino <philip_stroffolino@cable.comcast.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Philip Stroffolino <philip_stroffolino@cable.comcast.com>
Signed-off-by: Philip Stroffolino <philip_stroffolino@cable.comcast.com>
Comment thread isobmff/isobmffbuffer.cpp
Comment thread isobmff/isobmffbuffer.h
Comment thread isobmff/isobmffhelper.cpp
Comment thread isobmff/isobmffhelper.cpp
Comment thread test/utests/fakes/FakePrivateInstanceAAMP.cpp Outdated
Comment thread test/utests/tests/AampTSBSessionManager/FunctionalTests.cpp
Comment thread test/utests/tests/MediaTrackTests/MediaTrackTests.cpp Outdated
Comment thread mediaprocessor.h Outdated
Comment thread tsprocessor.cpp
Comment thread isobmff/isobmffhelper.cpp
Comment thread test/utests/tests/AampTSBSessionManager/FunctionalTests.cpp
Comment thread test/utests/fakes/FakePrivateInstanceAAMP.cpp Outdated
@DomSyna DomSyna marked this pull request as ready for review March 11, 2026 15:40
@DomSyna DomSyna requested a review from a team as a code owner March 11, 2026 15:40
Copilot AI review requested due to automatic review settings March 11, 2026 15:40
Copy link
Copy Markdown
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 refactors cached fragment storage from AampGrowableBuffer to std::vector<uint8_t> and propagates the API changes through TS/ISO-BMFF processing, injection paths, and unit tests.

Changes:

  • Replace CachedFragment::fragment with std::vector<uint8_t> and update copy/clear semantics.
  • Update MediaProcessor/TSProcessor/TS fragment processing to accept vectors and add a sendSegment(std::vector<...>&) bridge.
  • Update stream injection (SendStreamTransfer, ID3 processing) and unit tests/mocks to use vectors.

Reviewed changes

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

Show a summary per file
File Description
tsprocessor.h Updates TSProcessor::getFirstPts signature to accept std::vector<uint8_t>.
tsprocessor.cpp Adjusts TS PTS extraction to use vector-backed buffer.
tsFragmentProcessor.hpp Switches fragment processing APIs from AampGrowableBuffer to std::vector<uint8_t>.
tsFragmentProcessor.cpp Implements vector-based fragment validation/demux entry points.
streamabstraction.cpp Converts cached fragment freeing/injection paths to vector + ClearAndRelease.
priv_aamp.h Updates ProcessID3Metadata/SendStreamTransfer signatures and docs for vector usage.
priv_aamp.cpp Moves vectors into sink transfer and clears buffers via ClearAndRelease.
mp4demux/AampMp4Demuxer.h Updates getFirstPts override to vector signature.
mediaprocessor.h Changes pure virtual getFirstPts to vector and adds sendSegment(std::vector<...>&) bridge overload.
isobmff/isobmffprocessor.h Updates resetPTSOn*Switch and getFirstPts signatures to vector forms.
isobmff/isobmffprocessor.cpp Adjusts PTS reset and stream sending paths to operate on vectors.
isobmff/isobmffhelper.h Refactors helper APIs to accept std::vector<uint8_t>; adds InitAndParse helper.
isobmff/isobmffhelper.cpp Implements vector-based parsing/restamping helpers with shared parse init.
isobmff/isobmffbuffer.h Adds setBuffer(const std::vector<uint8_t>&) overload for read-only parsing use cases.
isobmff/isobmffbuffer.cpp Implements const-vector setBuffer overload.
fragmentcollector_mpd.cpp Uses std::vector<uint8_t> for init segment fetch + transfer for disabled tracks.
fragmentcollector_hls.cpp Converts fragment fetch/caching to vector-backed buffers and replaces .Free() usage.
StreamAbstractionAAMP.h Updates InjectFragmentChunkInternal/TrickModePtsRestamp signatures to vector refs.
MetadataProcessor.cpp Updates metadata parsing paths to use vectors and vector-based IsoBmffBuffer::setBuffer.
MediaStreamContext.h Replaces downloaded/temp fragment buffers with vectors; updates ctor/dtor accordingly.
MediaStreamContext.cpp Converts fragment caching/injection to vector move/clear semantics.
CachedFragment.h Replaces fragment with std::vector<uint8_t>; changes Copy API to const-ref.
CachedFragment.cpp Implements vector-based copy/clear/swap and uses ClearAndRelease.
AampUtils.h Adds aamp_utils::ClearAndRelease(std::vector<...>&) helper.
AampTSBSessionManager.cpp Updates init-fragment cache retrieval to write into vectors.
test/utests/tests/TrackInjectTests/TrackInjectTests.cpp Updates mock calls to SendStreamTransfer and IsoBmffBuffer::setBuffer for vectors.
test/utests/tests/StreamAbstractionAAMP_MPD/LinearFOGTests.cpp Uses ClearAndRelease for vector-backed downloaded fragment cleanup.
test/utests/tests/PrivAampTests/PrivAampTests.cpp Replaces NULL buffer usage with empty vector in disabled test.
test/utests/tests/MediaTrackTests/MediaTrackTests.cpp Reworks matchers and buffer population to use std::vector<uint8_t>.
test/utests/tests/MediaStreamContextTests/FragmentDownloadTests.cpp Updates fragment data setup and cleanup to vector + ClearAndRelease.
test/utests/tests/IsoBmffHelperTests/IsoBmffHelperTests.cpp Converts helper tests from AampGrowableBuffer to std::vector<uint8_t>.
test/utests/tests/IsoBmffConvertToKeyFrameTests/IsoBmffConvertToKeyFrameTests.cpp Updates conversion tests to use vectors and removes g_free expectation.
test/utests/tests/CachedFragmentTests/CachedFragmentTestCases.cpp Updates CachedFragment::Copy tests to use const-ref API.
test/utests/tests/CacheFragmentTests/CacheFragmentTests.cpp Updates temp fragment setup to use vector member.
test/utests/mocks/MockPrivateInstanceAAMP.h Updates mocked SendStreamTransfer/ProcessID3Metadata signatures to vector-based APIs.
test/utests/mocks/MockMediaProcessor.h Updates mock getFirstPts signature to vector.
test/utests/mocks/MockIsoBmffHelper.h Updates helper mock APIs to accept vector buffers.
test/utests/mocks/MockIsoBmffBuffer.h Adds const-vector setBuffer overload to match new IsoBmffBuffer API.
test/utests/fakes/FakeTsProcessor.cpp Updates fake getFirstPts signature to vector.
test/utests/fakes/FakePrivateInstanceAAMP.cpp Updates fake SendStreamTransfer and ProcessID3Metadata signatures and clearing behavior.
test/utests/fakes/FakeMetadataProcessor.cpp Formatting-only alignment changes in fake metadata processors.
test/utests/fakes/FakeIsoBmffProcessor.cpp Updates fake PTS reset APIs to vector signatures.
test/utests/fakes/FakeIsoBmffHelper.cpp Updates fake helper APIs to accept vectors.
test/utests/fakes/FakeIsoBmffBuffer.cpp Adds forwarding implementation for const-vector setBuffer.
test/utests/drm/mocks/aampMocks.cpp Updates mocked ProcessID3Metadata signature to const std::vector<uint8_t>&.
Comments suppressed due to low confidence (1)

tsFragmentProcessor.cpp:194

  • ValidateFragment dereferences curr_packet_ptr[...] in the while condition before confirming curr_len is large enough. Because && evaluates left-to-right, this can read out-of-bounds (and crash) for empty/short fragments. Reorder the condition to check curr_len first (and add an early length guard) before any byte access.

Comment thread AampUtils.h Outdated
Comment thread AampUtils.h Outdated
Comment thread MediaStreamContext.cpp Outdated
Copilot AI review requested due to automatic review settings March 12, 2026 09:11
Copy link
Copy Markdown
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 48 out of 49 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

tsFragmentProcessor.cpp:140

  • ProcessFragment assumes fragment has at least one TS packet. If an empty (or too-small) fragment is ever passed in, ValidateFragment will dereference curr_packet_ptr[0] and can crash. Add a size guard (e.g., return false when fragment.size() < ts_packet_size) before computing/dereferencing packet pointers.

Comment thread MediaStreamContext.cpp
@pstroffolino pstroffolino merged commit cb8490d into dev_sprint_25_2 Mar 15, 2026
11 of 12 checks passed
@pstroffolino pstroffolino deleted the feature/VPLAY-12900_CachedFragment_to_use_vector branch March 15, 2026 15:02
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