[FFmpeg-devel,01/15] avformat/matroskaenc: Fix relative timestamp check

Submitted by Oliver Collyer via ffmpeg-devel on April 2, 2019, 1:32 p.m.

Details

Message ID 20190402133305.3328-2-andreas.rheinhardt@googlemail.com
State Accepted
Commit 4ebeab15b037a21f195696cef1f7522daf42f3ee
Headers show

Commit Message

Oliver Collyer via ffmpeg-devel April 2, 2019, 1:32 p.m.
At this point, ts already includes the ts_offset so that the relative
time written with the cluster is already given by ts - mkv->cluster_pts.
It is this number that needs to fit into an int16_t.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
---
 libavformat/matroskaenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index b9f99c4463..394109ffe3 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2402,7 +2402,7 @@  static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_
     ts += mkv->tracks[pkt->stream_index].ts_offset;
 
     if (mkv->cluster_pos != -1) {
-        int64_t cluster_time = ts - mkv->cluster_pts + mkv->tracks[pkt->stream_index].ts_offset;
+        int64_t cluster_time = ts - mkv->cluster_pts;
         if ((int16_t)cluster_time != cluster_time) {
             av_log(s, AV_LOG_WARNING, "Starting new cluster due to timestamp\n");
             mkv_start_new_cluster(s, pkt);