On 05/05/16 04:40, wm4 wrote:
> Always pass 0-sized packets to the decoder, instead of initiating drain
> mode.
> 
> This fixes behavior with "legitimate" 0-sized packets that appear mid-
> stream, and which are _not_ flush packets.
> 
> It leaves handling of 0-sized packets loosely defined - this constitutes
> an API change, because the user now strictly has to pass NULL to
> avcodec_send_packet() to initiate draining correctly.
> ---
>  avconv.c             | 4 ++--
>  doc/APIchanges       | 4 ++++
>  libavcodec/avcodec.h | 9 +++++++--
>  libavcodec/utils.c   | 2 +-
>  4 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/avconv.c b/avconv.c
> index 1351cfc..e8f6464 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -1118,7 +1118,7 @@ static void do_streamcopy(InputStream *ist, 
> OutputStream *ost, const AVPacket *p
>  // This does not quite work like avcodec_decode_audio4/avcodec_decode_video2.
>  // There is the following difference: if you got a frame, you must call
>  // it again with pkt=NULL. pkt==NULL is treated differently from pkt.size==0
> -// (pkt==NULL means get more output, pkt.size==0 is a flush/drain packet)
> +// (pkt==NULL means get more output, pkt.data==NULL is a flush/drain packet)
>  static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, 
> AVPacket *pkt)
>  {
>      int ret;
> @@ -1126,7 +1126,7 @@ static int decode(AVCodecContext *avctx, AVFrame 
> *frame, int *got_frame, AVPacke
>      *got_frame = 0;
>  
>      if (pkt) {
> -        ret = avcodec_send_packet(avctx, pkt);
> +        ret = avcodec_send_packet(avctx, pkt->data ? pkt : NULL);

pkt->size ? pkt : NULL maybe?

The rest looks fine, the apichange entry is nice as well, thanks for the
patch =)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to