ffmpeg: simplify refcounting packets for the muxing queue
authorJames Almer <jamrial@gmail.com>
Mon, 6 Aug 2018 00:34:14 +0000 (21:34 -0300)
committerJames Almer <jamrial@gmail.com>
Tue, 7 Aug 2018 21:42:35 +0000 (18:42 -0300)
Signed-off-by: James Almer <jamrial@gmail.com>
fftools/ffmpeg.c

index 55faec8..2459374 100644 (file)
@@ -724,11 +724,11 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u
             if (ret < 0)
                 exit_program(1);
         }
-        ret = av_packet_ref(&tmp_pkt, pkt);
+        ret = av_packet_make_refcounted(pkt);
         if (ret < 0)
             exit_program(1);
+        av_packet_move_ref(&tmp_pkt, pkt);
         av_fifo_generic_write(ost->muxing_queue, &tmp_pkt, sizeof(tmp_pkt), NULL);
-        av_packet_unref(pkt);
         return;
     }