[FFmpeg-devel] RFQ on patch for decklink warnings

Felt, Patrick Patrick.Felt at sling.com
Wed May 24 01:06:37 EEST 2017


Afternoon all,
  I’m looking at fixing some warnings on deprecated api calls in the decklink drivers.  I’ve got a patch ready, but it looks like I might be leaking memory somewhere. In the old code using the av_dup_packet() is a free() of some kind required in code that I might be able to look for and unref() ?

Here is the current patch, not looking for a commit on it, just discussion in what I’m missing.

diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 39974e3..47cef29 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -122,16 +122,16 @@ 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) {
+
+    pkt1 = (AVPacketList *)av_mallocz(sizeof(AVPacketList));
+    if (!pkt1) {
         return -1;
     }

-    pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList));
-    if (!pkt1) {
+    /* duplicate the packet */
+    if (av_packet_ref(&pkt1->pkt, pkt) < 0) {
         return -1;
     }
-    pkt1->pkt  = *pkt;
     pkt1->next = NULL;

     pthread_mutex_lock(&q->mutex);




More information about the ffmpeg-devel mailing list