[FFmpeg-devel] [PATCH 2/2] avformat/tee: Use ref instead copy in write_packet

sebechlebskyjan at gmail.com sebechlebskyjan at gmail.com
Mon May 2 00:34:46 CEST 2016


From: Jan Sebechlebsky <sebechlebskyjan at gmail.com>

Replace av_copy_packet and deprecated av_dup_packet by
creating reference using av_packet_ref.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan at gmail.com>
---
 This should be effectively the same as calling av_packet_clone,
 but without dynamic memory allocation (reuses local AVPacket pkt).
 
 libavformat/tee.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/tee.c b/libavformat/tee.c
index 879d5b8..1891f9b 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -527,8 +527,8 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt)
         if (s2 < 0)
             continue;
 
-        if ((ret = av_copy_packet(&pkt2, pkt)) < 0 ||
-            (ret = av_dup_packet(&pkt2))< 0)
+        memset(&pkt2, 0, sizeof(AVPacket));
+        if ((ret = av_packet_ref(&pkt2, pkt)) < 0)
             if (!ret_all) {
                 ret_all = ret;
                 continue;
-- 
1.9.1



More information about the ffmpeg-devel mailing list