[FFmpeg-cvslog] avformat/mux: Restore original ts in write_packet on error
Jan Sebechlebsky
git at videolan.org
Mon Aug 22 14:05:05 EEST 2016
ffmpeg | branch: master | Jan Sebechlebsky <sebechlebskyjan at gmail.com> | Tue Aug 2 15:24:19 2016 +0200| [2fc9a3eb7a8c606bd403dc9fbdb8463144b243cf] | committer: Michael Niedermayer
avformat/mux: Restore original ts in write_packet on error
Restore original timestamps in write_packet() if the
actual write operation was not successfull. This allows
to pass the same packet to nonblocking muxer repeatedly
without corrupting the timestamps.
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2fc9a3eb7a8c606bd403dc9fbdb8463144b243cf
---
libavformat/mux.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libavformat/mux.c b/libavformat/mux.c
index e9973ed..a427f46 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -657,6 +657,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
static int write_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, did_split;
+ int64_t pts_backup, dts_backup;
+
+ pts_backup = pkt->pts;
+ dts_backup = pkt->dts;
if (s->output_ts_offset) {
AVStream *st = s->streams[pkt->stream_index];
@@ -743,6 +747,11 @@ fail:
if (did_split)
av_packet_merge_side_data(pkt);
+ if (ret < 0) {
+ pkt->pts = pts_backup;
+ pkt->dts = dts_backup;
+ }
+
return ret;
}
More information about the ffmpeg-cvslog
mailing list