diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2015-07-09 20:49:37 +0300 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2015-07-09 20:49:37 +0300 |
commit | da46370e94aa9a9225532ac63c5fc7c1259ca837 (patch) | |
tree | 50a78be73cc15c0e14b7f52ed9e64346c29b3e72 /libavformat/matroskaenc.c | |
parent | dbf8352a2e8710014d5234e8e2c8294758c1ec62 (diff) |
lavf/matroskaenc: Do not needlessly allocate memory for cuepoints.
Fixes ticket #4690.
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 3b525ad4d4..713cb33cc4 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1772,7 +1772,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_ if (codec->codec_type != AVMEDIA_TYPE_SUBTITLE) { mkv_write_block(s, pb, MATROSKA_ID_SIMPLEBLOCK, pkt, keyframe); - if (codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe || add_cue) { + if (s->pb->seekable && (codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe || add_cue)) { ret = mkv_add_cuepoint(mkv->cues, pkt->stream_index, dash_tracknum, ts, mkv->cluster_pos, relative_packet_pos, -1); if (ret < 0) return ret; } @@ -1792,11 +1792,13 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_ end_ebml_master(pb, blockgroup); } + if (s->pb->seekable) { ret = mkv_add_cuepoint(mkv->cues, pkt->stream_index, dash_tracknum, ts, mkv->cluster_pos, relative_packet_pos, duration); if (ret < 0) return ret; } + } mkv->duration = FFMAX(mkv->duration, ts + duration); return 0; |