diff mbox series

[FFmpeg-devel,17/20] avformat/matroskaenc: Check that Cluster has been opened

Message ID 20200101005837.11356-18-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series Matroska muxer patches | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 1, 2020, 12:58 a.m. UTC
before setting the field indicating that a Cluster has been opened.

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

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index c0979feb88..d7aa832eb3 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2306,10 +2306,10 @@  static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_
     }
 
     if (mkv->cluster_pos == -1) {
-        mkv->cluster_pos = avio_tell(s->pb);
         ret = start_ebml_master_crc32(&mkv->cluster_bc, mkv);
         if (ret < 0)
             return ret;
+        mkv->cluster_pos = avio_tell(s->pb);
         put_ebml_uint(mkv->cluster_bc, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts));
         mkv->cluster_pts = FFMAX(0, ts);
         av_log(s, AV_LOG_DEBUG,