Re: [FFmpeg-devel] [FFmpeg-cvslog] lavc/qsvenc: assert uninitialized pict_type

2018-12-03 Thread Fu, Linjie
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of James Almer
> Sent: Friday, November 30, 2018 23:53
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] lavc/qsvenc: assert
> uninitialized pict_type
> 
> On 11/30/2018 12:42 PM, Carl Eugen Hoyos wrote:
> > 2018-11-30 10:54 GMT+01:00, Linjie Fu :
> >> ffmpeg | branch: master | Linjie Fu  | Wed Nov 28
> >> 10:41:55 2018 +0800| [67cdfcf694f840d215be940f82545c45c9be193a] |
> committer:
> >> Zhong Li
> >>
> >> lavc/qsvenc: assert uninitialized pict_type
> >>
> >> Assert in function ff_qsv_encode to avoid using uninitialized value:
> >>
> >> FF_DISABLE_DEPRECATION_WARNINGS
> >> avctx->coded_frame->pict_type = pict_type;
> >> FF_ENABLE_DEPRECATION_WARNINGS
> >>
> >> Signed-off-by: Linjie Fu 
> >> Signed-off-by: Zhong Li 
> >>
> >>>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67cdfcf694f840d
> 215be940f82545c45c9be193a
> >> ---
> >>
> >>  libavcodec/qsvenc.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> >> index 3946c1d837..7f4592f878 100644
> >> --- a/libavcodec/qsvenc.c
> >> +++ b/libavcodec/qsvenc.c
> >> @@ -1337,6 +1337,8 @@ int ff_qsv_encode(AVCodecContext *avctx,
> QSVEncContext
> >> *q,
> >>  pict_type = AV_PICTURE_TYPE_P;
> >>  else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType &
> >> MFX_FRAMETYPE_xB)
> >>  pict_type = AV_PICTURE_TYPE_B;
> >> +else
> >> +av_assert0(!"Uninitialized pict_type!");
> >
> > You generally cannot assert on a value coming from an external library.
> 
> And using string literals in an assert may generate warnings.
> 
> Just error out returning AVERROR_INVALIDDATA.
> 
Will replace the assert with an error return and send a new patch.

Thanks,
- Linjie, Fu

> >
> > Carl Eugen
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavc/qsvenc: assert uninitialized pict_type

2018-11-30 Thread Nicolas George
James Almer (2018-11-30):
> probably Clang.

I could have guessed.

Clang: "bogus warnings, gotta catch them all".

The solution is not to make the code less convenient but to fix the
compiler. Or ignore it.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavc/qsvenc: assert uninitialized pict_type

2018-11-30 Thread James Almer
On 11/30/2018 12:54 PM, Nicolas George wrote:
> James Almer (2018-11-30):
>> And using string literals in an assert may generate warnings.
> 
> [citation needed]
> 
> Anyway, these warnings would be broken, the code is valid.

https://code.videolan.org/videolan/dav1d/issues/196

-Wstring-conversion, probably Clang.

> 
> Regards,
> 
> 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavc/qsvenc: assert uninitialized pict_type

2018-11-30 Thread Nicolas George
James Almer (2018-11-30):
> And using string literals in an assert may generate warnings.

[citation needed]

Anyway, these warnings would be broken, the code is valid.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavc/qsvenc: assert uninitialized pict_type

2018-11-30 Thread James Almer
On 11/30/2018 12:42 PM, Carl Eugen Hoyos wrote:
> 2018-11-30 10:54 GMT+01:00, Linjie Fu :
>> ffmpeg | branch: master | Linjie Fu  | Wed Nov 28
>> 10:41:55 2018 +0800| [67cdfcf694f840d215be940f82545c45c9be193a] | committer:
>> Zhong Li
>>
>> lavc/qsvenc: assert uninitialized pict_type
>>
>> Assert in function ff_qsv_encode to avoid using uninitialized value:
>>
>> FF_DISABLE_DEPRECATION_WARNINGS
>> avctx->coded_frame->pict_type = pict_type;
>> FF_ENABLE_DEPRECATION_WARNINGS
>>
>> Signed-off-by: Linjie Fu 
>> Signed-off-by: Zhong Li 
>>
>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67cdfcf694f840d215be940f82545c45c9be193a
>> ---
>>
>>  libavcodec/qsvenc.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
>> index 3946c1d837..7f4592f878 100644
>> --- a/libavcodec/qsvenc.c
>> +++ b/libavcodec/qsvenc.c
>> @@ -1337,6 +1337,8 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext
>> *q,
>>  pict_type = AV_PICTURE_TYPE_P;
>>  else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType &
>> MFX_FRAMETYPE_xB)
>>  pict_type = AV_PICTURE_TYPE_B;
>> +else
>> +av_assert0(!"Uninitialized pict_type!");
> 
> You generally cannot assert on a value coming from an external library.

And using string literals in an assert may generate warnings.

Just error out returning AVERROR_INVALIDDATA.

> 
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavc/qsvenc: assert uninitialized pict_type

2018-11-30 Thread Carl Eugen Hoyos
2018-11-30 10:54 GMT+01:00, Linjie Fu :
> ffmpeg | branch: master | Linjie Fu  | Wed Nov 28
> 10:41:55 2018 +0800| [67cdfcf694f840d215be940f82545c45c9be193a] | committer:
> Zhong Li
>
> lavc/qsvenc: assert uninitialized pict_type
>
> Assert in function ff_qsv_encode to avoid using uninitialized value:
>
> FF_DISABLE_DEPRECATION_WARNINGS
> avctx->coded_frame->pict_type = pict_type;
> FF_ENABLE_DEPRECATION_WARNINGS
>
> Signed-off-by: Linjie Fu 
> Signed-off-by: Zhong Li 
>
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67cdfcf694f840d215be940f82545c45c9be193a
> ---
>
>  libavcodec/qsvenc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 3946c1d837..7f4592f878 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -1337,6 +1337,8 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext
> *q,
>  pict_type = AV_PICTURE_TYPE_P;
>  else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType &
> MFX_FRAMETYPE_xB)
>  pict_type = AV_PICTURE_TYPE_B;
> +else
> +av_assert0(!"Uninitialized pict_type!");

You generally cannot assert on a value coming from an external library.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel