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. > + > + // 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; > + }