Skip to content

Conversation

p-bond
Copy link
Contributor

@p-bond p-bond commented Sep 11, 2025

Move CachedFragment + immediate dependencies to separate file.
Extend CachedFragment with idiomatic constructors.
Added CachedFragment to top level makefile.
Create L1 tests to verify function; extend fake AampGrowableBuffer to support these tests. In particular, allow for deep copy testing without needing to modify existing tests.
Modify existing L1 test makelists to ensure CachedFragment is built in.
NB - existing L1 tests ought to use a FakeCachedFragment, but that isn't part of this ticket.
Disabled a priv_aamp test that was causing nullptr dereference

@p-bond p-bond requested review from a team as code owners September 11, 2025 12:57
cachedFragment->fragment.AppendBytes(testData, testDataSize);

// Copy from empty source (sourceCachedFragment is default-initialized)
cachedFragment->Copy(sourceCachedFragment.get(), 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm this looks wrong in the existing code, so not sure what we should be testing here.... consider copying into a non empty fragment. I don't think it will do what is expected. Testing current behaviour is unchanged is fine for now, but we should fix COPY going forward

void CachedFragment::Copy(CachedFragment* other, size_t len)
{
// Clear existing data first
this->fragment.Free();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't object, but this looks like its fixing a bug, and hence a change in behaviour ? From where its called that's fine, but suggest you make a note to check those places at later date as I think one of them calls clear first to avoid this issue, which is obviously no longer needed

{
g_bufferStorage.clear();
}

AampGrowableBuffer::~AampGrowableBuffer( void )
{
if (g_mockAampGrowableBuffer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an over complex solution ? instead of a map of vectors, surely is can just return a vector. Looks like it probably works so happy if you fix it in later delivery

cachedFragment->cacheFragStreamInfo.reason = eAAMP_BITRATE_CHANGE_BY_TUNE;

// Add data to fragment buffer
cachedFragment->fragment.AppendBytes(testData, testDataSize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably want to remove this

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.

3 participants