summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-01-22 19:37:29 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-04-03 08:22:04 +0200
commitaf97a3a4d6b9d199654ab6328c79e6be808ce6f9 (patch)
tree9c15eea00ded20d8610ba0d70d8800f73b83f003 /libavformat
parent0fc150f048398c9dbb8578f25e916fd356c18a54 (diff)
avformat/matroskaenc: Improve checks for updating Tags
When updating the Tags at the end, the Matroska muxer would twice check for whether (!mkv->is_live) is true, despite this code being only executed if it is. Furthermore, a loop iterates over all the streams even when there is no Tags element to update at all, because the check for whether there are Tags is only performed later. This commit fixes this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/matroskaenc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 223406ce75..92efa98951 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2545,7 +2545,7 @@ static int mkv_write_trailer(AVFormatContext *s)
end_ebml_master_crc32(pb, &mkv->tracks_bc, mkv, MATROSKA_ID_TRACKS, 0, 0);
// update stream durations
- if (!mkv->is_live) {
+ if (mkv->tags_bc) {
int i;
for (i = 0; i < s->nb_streams; ++i) {
AVStream *st = s->streams[i];
@@ -2567,8 +2567,7 @@ static int mkv_write_trailer(AVFormatContext *s)
put_ebml_binary(mkv->tags_bc, MATROSKA_ID_TAGSTRING, duration_string, 20);
}
}
- }
- if (mkv->tags_bc && !mkv->is_live) {
+
avio_seek(pb, mkv->tags_pos, SEEK_SET);
end_ebml_master_crc32(pb, &mkv->tags_bc, mkv, MATROSKA_ID_TAGS, 0, 0);
}