[FFmpeg-cvslog] ffmpeg: Fix flush packet stream copy input timestamp handling

Mark Thompson git at videolan.org
Wed Nov 1 22:33:39 EET 2017


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Wed Nov  1 00:48:56 2017 +0000| [cf170869821aff42f59538c62574f9f7bdce85d6] | committer: Mark Thompson

ffmpeg: Fix flush packet stream copy input timestamp handling

Since a7da13474286774cf378c3ea606c19a7c1a0eba3, flush packets are passed
to process_input_packet() during stream copy.  This modifies the input
timestamp handling to ignore them - since they contain no data, timestamps
should not be affected.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf170869821aff42f59538c62574f9f7bdce85d6
---

 fftools/ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 942579b378..286d898b12 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2699,7 +2699,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
     }
 
     /* handle stream copy */
-    if (!ist->decoding_needed) {
+    if (!ist->decoding_needed && pkt) {
         ist->dts = ist->next_dts;
         switch (ist->dec_ctx->codec_type) {
         case AVMEDIA_TYPE_AUDIO:
@@ -2712,7 +2712,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
                 AVRational time_base_q = AV_TIME_BASE_Q;
                 int64_t next_dts = av_rescale_q(ist->next_dts, time_base_q, av_inv_q(ist->framerate));
                 ist->next_dts = av_rescale_q(next_dts + 1, av_inv_q(ist->framerate), time_base_q);
-            } else if (pkt && pkt->duration) {
+            } else if (pkt->duration) {
                 ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q);
             } else if(ist->dec_ctx->framerate.num != 0) {
                 int ticks= av_stream_get_parser(ist->st) ? av_stream_get_parser(ist->st)->repeat_pict + 1 : ist->dec_ctx->ticks_per_frame;



More information about the ffmpeg-cvslog mailing list