-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly check if an identical chunk has been written before. #1956
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This piece of code was written 4 years ago but maybe someone more familiar with tracks than me could review.
src/write.c
Outdated
chunkOffset = avifEncoderFindExistingChunk(s, mdatStartOffset, sample->data.data, sample->data.size); | ||
size_t total_size = sample->data.size; | ||
for (uint32_t sampleIndex = 1; sampleIndex < item->encodeOutput->samples.count; ++sampleIndex) { | ||
total_size += item->encodeOutput->samples.sample[sampleIndex].data.size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the data contiguous?
Suggestion:
AVIF_CHECKERR(
item->encodeOutput->samples.sample[sampleIndex].data.data ==
item->encodeOutput->samples.sample[0].data.data + total_size,
AVIF_RESULT_UNKNOWN_ERROR);
(not just an assertion, for extra security)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the data is written contiguously a few lines below but I'll add a check.
The problem happened starting with #463
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we do not care right? The stream is already formed so as long as we have a match of size total_size, we are good and the deduplication works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed it's on the input, that makes sense. Done
Fixes internal bugs: b/321189607 and b/321189607
d69c44c
to
debabf6
Compare
debabf6
to
082c781
Compare
a86e26f
to
5f791c9
Compare
…aCodec#1956) Basically reverting 295cab3 in AOMediaCodec#463
@vrabaud Vincent: The first comment in this pull request says "Fixes internal bugs: b/321189607 and b/321189607", but the two bug numbers are the same. Is there a second bug that this pull request fixes? |
Nope, just a mistake on my end ... |
Fixes internal bugs: b/321189607 and b/321189607