[FFmpeg-devel] [PATCH 1/2 v2] avdevice/decklink_dec: remove av_dup_packet() usage

Marton Balint cus at passwd.hu
Mon Oct 2 20:13:43 EEST 2017



On Mon, 2 Oct 2017, James Almer wrote:

> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> Untested.

Tested and works.

>
> libavdevice/decklink_dec.cpp | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
> index 8a14094474..d8c624aa5d 100644
> --- a/libavdevice/decklink_dec.cpp
> +++ b/libavdevice/decklink_dec.cpp
> @@ -458,16 +458,15 @@ static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt)
>         av_log(q->avctx, AV_LOG_WARNING,  "Decklink input buffer overrun!\n");
>         return -1;
>     }
> -    /* duplicate the packet */
> -    if (av_dup_packet(pkt) < 0) {
> -        return -1;
> -    }
> 
> -    pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList));
> +    pkt1 = (AVPacketList *)av_mallocz(sizeof(AVPacketList));
>     if (!pkt1) {
>         return -1;
>     }
> -    pkt1->pkt  = *pkt;
> +    if (av_packet_ref(&pkt1->pkt, pkt) < 0) {
> +        return -1;
> +    }
> +    av_packet_unref(pkt);
>     pkt1->next = NULL;
>
>     pthread_mutex_lock(&q->mutex);

LGTM, thanks.

Marton


More information about the ffmpeg-devel mailing list