[FFmpeg-devel] oggparsetheora: set need_context_update when changing codec id

Submitted by Andreas Cadhalpun on Nov. 4, 2016, 9:27 p.m.

Details

Message ID cfa22bc7-aa76-c0a9-6645-f026cc18c3f9@googlemail.com
State New
Headers show

Commit Message

Andreas Cadhalpun Nov. 4, 2016, 9:27 p.m.
Otherwise the codec context and codecpar might disagree on the codec id,
triggering asserts in av_parser_parse2.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
---
 libavformat/oggparsetheora.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andreas Cadhalpun Nov. 22, 2016, 10:18 p.m.
On 04.11.2016 22:27, Andreas Cadhalpun wrote:
> Otherwise the codec context and codecpar might disagree on the codec id,
> triggering asserts in av_parser_parse2.
> 
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
> ---
>  libavformat/oggparsetheora.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
> index b14f9f0..078d827 100644
> --- a/libavformat/oggparsetheora.c
> +++ b/libavformat/oggparsetheora.c
> @@ -111,6 +111,8 @@ static int theora_header(AVFormatContext *s, int idx)
>          thp->gpmask  = (1U << thp->gpshift) - 1;
>  
>          st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
> +        if (st->codecpar->codec_id != AV_CODEC_ID_THEORA)
> +            st->internal->need_context_update = 1;
>          st->codecpar->codec_id   = AV_CODEC_ID_THEORA;
>          st->need_parsing      = AVSTREAM_PARSE_HEADERS;
>      }
> 

Ping. I intend to apply this in a few days.

Best regards,
Andreas

Patch hide | download patch | download mbox

diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index b14f9f0..078d827 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -111,6 +111,8 @@  static int theora_header(AVFormatContext *s, int idx)
         thp->gpmask  = (1U << thp->gpshift) - 1;
 
         st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+        if (st->codecpar->codec_id != AV_CODEC_ID_THEORA)
+            st->internal->need_context_update = 1;
         st->codecpar->codec_id   = AV_CODEC_ID_THEORA;
         st->need_parsing      = AVSTREAM_PARSE_HEADERS;
     }