diff mbox

[FFmpeg-devel,3/3] qsvdec: Fix running with assert_level > 0

Message ID 20181111153215.9287-3-sw@jkqxz.net
State Accepted
Commit 34cab708189bdde8f59543a885313928a980564d
Headers show

Commit Message

Mark Thompson Nov. 11, 2018, 3:32 p.m. UTC
Assertion avctx->codec_id != AV_CODEC_ID_NONE failed at src/libavcodec/parser.c:128

The setting on the internal AVCodecContext used for parsing only is
otherwise irrelevant, so just set it to avoid the assert.
---
 libavcodec/qsvdec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Zhong Li Nov. 27, 2018, 9:40 a.m. UTC | #1
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Mark Thompson

> Sent: Sunday, November 11, 2018 11:32 PM

> To: ffmpeg-devel@ffmpeg.org

> Subject: [FFmpeg-devel] [PATCH 3/3] qsvdec: Fix running with assert_level >

> 0

> 

> Assertion avctx->codec_id != AV_CODEC_ID_NONE failed at

> src/libavcodec/parser.c:128

> 

> The setting on the internal AVCodecContext used for parsing only is

> otherwise irrelevant, so just set it to avoid the assert.

> ---

>  libavcodec/qsvdec.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index

> 6753e596a1..4a0be811fb 100644

> --- a/libavcodec/qsvdec.c

> +++ b/libavcodec/qsvdec.c

> @@ -501,6 +501,8 @@ int ff_qsv_process_data(AVCodecContext *avctx,

> QSVContext *q,

>          if (!q->avctx_internal)

>              return AVERROR(ENOMEM);

> 

> +        q->avctx_internal->codec_id = avctx->codec_id;

> +

>          q->parser = av_parser_init(avctx->codec_id);

>          if (!q->parser)

>              return AVERROR(ENOMEM);

> --

> 2.19.1

> 

LGTM (And I am surprised it get cached so late).
Mark Thompson Dec. 9, 2018, 6:59 p.m. UTC | #2
On 27/11/2018 09:40, Li, Zhong wrote:
>> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf
>> Of Mark Thompson
>> Sent: Sunday, November 11, 2018 11:32 PM
>> To: ffmpeg-devel@ffmpeg.org
>> Subject: [FFmpeg-devel] [PATCH 3/3] qsvdec: Fix running with assert_level >
>> 0
>>
>> Assertion avctx->codec_id != AV_CODEC_ID_NONE failed at
>> src/libavcodec/parser.c:128
>>
>> The setting on the internal AVCodecContext used for parsing only is
>> otherwise irrelevant, so just set it to avoid the assert.
>> ---
>>  libavcodec/qsvdec.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index
>> 6753e596a1..4a0be811fb 100644
>> --- a/libavcodec/qsvdec.c
>> +++ b/libavcodec/qsvdec.c
>> @@ -501,6 +501,8 @@ int ff_qsv_process_data(AVCodecContext *avctx,
>> QSVContext *q,
>>          if (!q->avctx_internal)
>>              return AVERROR(ENOMEM);
>>
>> +        q->avctx_internal->codec_id = avctx->codec_id;
>> +
>>          q->parser = av_parser_init(avctx->codec_id);
>>          if (!q->parser)
>>              return AVERROR(ENOMEM);
>> --
>> 2.19.1
>>
> LGTM (And I am surprised it get cached so late).

Yeah, I guess people rarely run with assert checks on.  I try to remember it on development setups, but clearly miss it some of the time.

Anyway, applied.

Thanks,

- Mark
diff mbox

Patch

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 6753e596a1..4a0be811fb 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -501,6 +501,8 @@  int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
         if (!q->avctx_internal)
             return AVERROR(ENOMEM);
 
+        q->avctx_internal->codec_id = avctx->codec_id;
+
         q->parser = av_parser_init(avctx->codec_id);
         if (!q->parser)
             return AVERROR(ENOMEM);