diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-06-25 02:54:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-06-25 03:04:55 +0200 |
commit | 46a60fe184cfd39cc9517c860c7404d60977456d (patch) | |
tree | defea2eafea18157f2ea1c217765c749524720f0 /libavformat/mux.c | |
parent | f573acc4244769c294d45df9e7dc47d9d8cfb8b7 (diff) |
avformat: Fix ff_interleaved_peek()
Fixes assertion failures in movenc
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mux.c')
-rw-r--r-- | libavformat/mux.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c index 10b2750e3f..105d76240e 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -1041,12 +1041,20 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, } } -const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream) +const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream, int64_t *ts_offset) { AVPacketList *pktl = s->internal->packet_buffer; while (pktl) { - if (pktl->pkt.stream_index == stream) - return &pktl->pkt; + if (pktl->pkt.stream_index == stream) { + AVPacket *pkt = &pktl->pkt; + AVStream *st = s->streams[pkt->stream_index]; + *ts_offset = st->mux_ts_offset; + + if (s->output_ts_offset) + *ts_offset += av_rescale_q(s->output_ts_offset, AV_TIME_BASE_Q, st->time_base); + + return pkt; + } pktl = pktl->next; } return NULL; |