[FFmpeg-devel] [PATCH v2] avcodec/bsf: Set EOF flag only if pkt == NULL

Nicolas George george at nsup.org
Fri Jul 22 23:14:16 EEST 2016


Le quintidi 5 thermidor, an CCXXIV, sebechlebskyjan at gmail.com a écrit :
> From: Jan Sebechlebsky <sebechlebskyjan at gmail.com>
> 
> Set BSF EOF flag only if pkt == NULL in av_bsf_send_packet().
> 
> Signed-off-by: Jan Sebechlebsky <sebechlebskyjan at gmail.com>
> ---
>  I agree, it seems cleaner that way.
> 
>  Thanks,
>  please apply this version of patch then and ignore
>  the patch changing the comment.
> 
>  Regards,
>  Jan
> 
>  libavcodec/bsf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
> index 88b7f29..9b9ada7 100644
> --- a/libavcodec/bsf.c
> +++ b/libavcodec/bsf.c
> @@ -172,7 +172,7 @@ int av_bsf_init(AVBSFContext *ctx)
>  
>  int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
>  {

> -    if (!pkt || !pkt->data) {
> +    if (!pkt) {

It we make the case where pkt != NULL but no data nor side data forbidden, I
would suggest to detect it.

I know that others disagree, but I think an assert is the best solution for
that: if the caller pass a forbidden value, it can expect an undefined
behaviour, and an assert failure is the most sympathetic undefined
behaviours for developers.

>          ctx->internal->eof = 1;
>          return 0;
>      }

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160722/21458351/attachment.sig>


More information about the ffmpeg-devel mailing list