On Sun, 18 Oct 2015 17:59:44 +0200
Luca Barbato <[email protected]> wrote:

> And drop the av_dup_packet from the input_thread.
> ---
>  avconv.c            | 1 -
>  libavformat/utils.c | 8 ++++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/avconv.c b/avconv.c
> index c52f292..f6bcb02 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -2130,7 +2130,6 @@ static void *input_thread(void *arg)
>          while (!av_fifo_space(f->fifo))
>              pthread_cond_wait(&f->fifo_cond, &f->fifo_lock);
>  
> -        av_dup_packet(&pkt);
>          av_fifo_generic_write(f->fifo, &pkt, sizeof(pkt), NULL);
>  
>          pthread_mutex_unlock(&f->fifo_lock);
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index f8926bd..fd96b9d 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -413,6 +413,14 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>              continue;
>          }
>  
> +        if (!pkt->buf) {
> +            AVPacket tmp = { 0 };
> +            ret = av_packet_ref(&tmp, pkt);
> +            if (ret < 0)
> +                return ret;
> +            *pkt = tmp;
> +        }
> +
>          if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
>              (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
>              av_log(s, AV_LOG_WARNING,

I guess it's fine for consistency. If someone complains that this is
too slow, the corresponding demuxer should be fixed to output
refcounted packets in the first place.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to