aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-03-21 11:43:04 -0300
committerJames Almer <jamrial@gmail.com>2018-03-23 22:05:25 -0300
commit231a73308f183484317c3fdfe098f543cd401898 (patch)
tree7b1b573092ab49351a52d9971cbfa6d07acfef81
parentf5ceb15bb692d5121a976c3638811b96fc14f85f (diff)
downloadffmpeg-231a73308f183484317c3fdfe098f543cd401898.tar.gz
ffmpeg: pass reference counted packet on codec copy when possible
Should prevent unnecessary copy of data in cases where new references to the packet are created within the muxer or a bitstream filter. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--fftools/ffmpeg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index ec9ce29097..1b2e37b8d8 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2049,6 +2049,11 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
opkt.flags = pkt->flags;
+ if (pkt->buf) {
+ opkt.buf = av_buffer_ref(pkt->buf);
+ if (!opkt.buf)
+ exit_program(1);
+ }
opkt.data = pkt->data;
opkt.size = pkt->size;