movenc: Handle pts == NOPTS when autoflushing
authorMartin Storsjö <martin@martin.st>
Wed, 20 Apr 2016 10:22:41 +0000 (13:22 +0300)
committerMartin Storsjö <martin@martin.st>
Thu, 21 Apr 2016 08:20:39 +0000 (11:20 +0300)
This muxer generally handles pts == NOPTS by using dts instead;
do this for consistency here as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/movenc.c

index 78ff4ee..b792a3b 100644 (file)
@@ -3635,7 +3635,10 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
                 // duration, but only helps for this particular track, not
                 // for the other ones that are flushed at the same time.
                 trk->track_duration = pkt->dts - trk->start_dts;
-                trk->end_pts = pkt->pts;
+                if (pkt->pts != AV_NOPTS_VALUE)
+                    trk->end_pts = pkt->pts;
+                else
+                    trk->end_pts = pkt->dts;
                 mov_auto_flush_fragment(s, 0);
             }
         }