[FFmpeg-cvslog] avdevice/decklink_dec: remove av_dup_packet() usage

James Almer git at videolan.org
Mon Oct 2 21:16:23 EEST 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Oct  2 13:08:39 2017 -0300| [e91f0c4f8b3e81bc63838cc67370a7b13c8d9e78] | committer: James Almer

avdevice/decklink_dec: remove av_dup_packet() usage

Reviewed-by: Marton Balint <cus at passwd.hu>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e91f0c4f8b3e81bc63838cc67370a7b13c8d9e78
---

 libavdevice/decklink_dec.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 9d12d0fed0..53ff576ec5 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -450,22 +450,24 @@ static unsigned long long avpacket_queue_size(AVPacketQueue *q)
 static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt)
 {
     AVPacketList *pkt1;
+    int ret;
 
     // Drop Packet if queue size is > maximum queue size
     if (avpacket_queue_size(q) > (uint64_t)q->max_q_size) {
         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;
+    ret = av_packet_ref(&pkt1->pkt, pkt);
+    av_packet_unref(pkt);
+    if (ret < 0) {
+        av_free(pkt1);
+        return -1;
+    }
     pkt1->next = NULL;
 
     pthread_mutex_lock(&q->mutex);



More information about the ffmpeg-cvslog mailing list