Quoting Luca Barbato (2015-05-14 19:30:57)
> Just setting data to NULL and size to 0 is not safe because of side
> data.
> 
> Reported-By: Bernd Pfrommer
> ---
>  libavcodec/avcodec.h | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 3440126..f7320fa 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3618,10 +3618,12 @@ void avcodec_align_dimensions2(AVCodecContext *s, int 
> *width, int *height,
>   * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between 
> input
>   * and output. This means that for some packets they will not immediately
>   * produce decoded output and need to be flushed at the end of decoding to 
> get
> - * all the decoded data. Flushing is done by calling this function with 
> packets
> - * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
> - * returning samples. It is safe to flush even those decoders that are not
> - * marked with CODEC_CAP_DELAY, then no samples will be returned.
> + * all the decoded data. Flushing is done by calling this function with empty
> + * packets (e.g. initialized with av_init_packet) until it stops returning
> + * samples.
> + *
> + * It is safe to flush even those decoders that are not marked with
> + * CODEC_CAP_DELAY, then no samples will be returned.
>   *
>   * @warning The input buffer, avpkt->data must be 
> FF_INPUT_BUFFER_PADDING_SIZE
>   *          larger than the actual read bytes because some optimized 
> bitstream
> -- 
> 2.3.2
> 

As wm4 said, this is incorrect as is.

IMO it should be reworded to mean that you should both initialize the
packet with av_init_packet() AND set its data/size to 0.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to