You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
429b41e7b2
commit
2fc9a3eb7a
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user