On Thu, 14 May 2015 19:30:57 +0200
Luca Barbato <lu_z...@gentoo.org> wrote:

> 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

This makes the documentation worse. "Empty" is a rather fuzzy term,
while the old comment explicitly says that data and size must be set to
0.

av_init_packet() does not even set the data and size fields, which is a
huge load of bullshit, but hardcoded into the API/ABI.
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to