[FFmpeg-devel] [PATCH 3/4] avformat/tee: Handle AV_NOPTS_VALUE correctly

sebechlebskyjan at gmail.com sebechlebskyjan at gmail.com
Thu Jun 30 18:20:49 CEST 2016


From: Jan Sebechlebsky <sebechlebskyjan at gmail.com>

Do not rescale pts and dts if they are set to
AV_NOPTS_VALUE.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan at gmail.com>
---
 libavformat/tee.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/tee.c b/libavformat/tee.c
index c276a37..840bee3 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -533,8 +533,10 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt)
             }
         tb  = avf ->streams[s ]->time_base;
         tb2 = avf2->streams[s2]->time_base;
-        pkt2.pts      = av_rescale_q(pkt->pts,      tb, tb2);
-        pkt2.dts      = av_rescale_q(pkt->dts,      tb, tb2);
+        if (pkt->pts != AV_NOPTS_VALUE)
+            pkt2.pts = av_rescale_q(pkt->pts, tb, tb2);
+        if (pkt->dts != AV_NOPTS_VALUE)
+            pkt2.dts = av_rescale_q(pkt->dts, tb, tb2);
         pkt2.duration = av_rescale_q(pkt->duration, tb, tb2);
         pkt2.stream_index = s2;
 
-- 
1.9.1



More information about the ffmpeg-devel mailing list