[FFmpeg-devel] [PATCH] avformat/oggparseogm: sync avctx w/ codecpar

Chris Cunningham chcunningham at chromium.org
Fri Feb 8 05:17:24 EET 2019


On Wed, Feb 6, 2019 at 6:03 PM James Almer <jamrial at gmail.com> wrote:

> Can a valid ogm stream contain more than one header packet?


Looking at ogg_packet oggdec.c, we read headers until hitting the first
non-header (counted in ogg stream field nb_headers), so multiple headers
per stream is probably ok. But multiple codecs in a given stream seems
supsect to me. Someone with more ogg expertise should chime in.

Because the
> issue here as far as i can see is that ogm_header() is not validating
> the output of ff_codec_get_id() and is happily accepting and propagating
> AV_CODEC_ID_NONE as derived from it in a late packet, long after the
> parser and everything else was already initialized.
>
> No other ogg module sets st->internal->need_context_update and all of
> them may also end up calling the respective header reading function more
> than once on invalid files, but unlike the ogm one, all of them hardcode
> the codec_id instead of blindly accepting a potentially bogus value
> derived from the bitstream.
>

I'm open to hard-coding codec for gsm. One thing I notice is that the codec
is just one of several codecpar fields that are potentially changing.
If any of those change without need_context_update, it seems like values in
the internal avctx could become stale?


More information about the ffmpeg-devel mailing list