On 24/04/2025 01:02, James Almer wrote:
> On 4/23/2025 5:45 PM, Mark Thompson wrote:
>> +static int cbs_apv_split_fragment(CodedBitstreamContext *ctx,
>> +                                  CodedBitstreamFragment *frag,
>> +                                  int header)
>> +{
>> +    uint8_t *data = frag->data;
>> +    size_t   size = frag->data_size;
>> +    uint32_t signature;
>> +    int err, trace;
> 
> To prepare CBS for the presence of extradata, make this function a no-op when 
> header != 0.

Yep, done.

I've also added the check that we actually have 4 bytes available for the 
signature (missed when I added it to the AVPacket).

>> +
>> +    // Don't include parsing here in trace output.
>> +    trace = ctx->trace_enable;
>> +    ctx->trace_enable = 0;
>> +
>> +    signature = AV_RB32(data);
>> +    if (signature != APV_SIGNATURE) {
>> +        av_log(ctx->log_ctx, AV_LOG_ERROR,
>> +               "Invalid APV access unit: bad signature %08x.\n",
>> +               signature);
>> +        err = AVERROR_INVALIDDATA;
>> +        goto fail;
>> +    }
>> +    data += 4;
>> +    size -= 4;
>> +
>> +    while (size > 0) {
>> +        GetBitContext   gbc;
>> +        uint32_t        pbu_size;
>> +        APVRawPBUHeader pbu_header;
>> +
>> +        if (size < 8) {
>> +            av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid PBU: "
>> +                   "fragment too short (%"SIZE_SPECIFIER" bytes).\n",
>> +                   size);
>> +            err = AVERROR_INVALIDDATA;
>> +            goto fail;
>> +        }

Thanks,

- Mark

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to