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

James Almer jamrial at gmail.com
Mon Oct 2 19:26:37 EEST 2017


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

 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);
-- 
2.14.1



More information about the ffmpeg-devel mailing list