[FFmpeg-devel] [PATCH 13/13] avformat/mux: Remove pointless timestamp backups

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Tue Aug 13 05:47:26 EEST 2019


write_packet currently saves the original timestamps of the packet it got
and restores them in case writing fails. This is unnecessary as none of
write_packet's callers make any use of these timestamps at all. So
remove this and add a general comment to the function that timestamps
may be modified; also remove a long outdated comment about side data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavformat/mux.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 2dc7fc2dcb..8f617d4011 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -663,8 +663,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
 /**
- * Make timestamps non negative, move side data from payload to internal struct, call muxer, and restore
- * sidedata.
+ * Make timestamps non negative and call muxer; the original pts/dts are not kept.
  *
  * FIXME: this function should NEVER get undefined pts/dts beside when the
  * AVFMT_NOTIMESTAMPS is set.
@@ -674,10 +673,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 static int write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     int ret;
-    int64_t pts_backup, dts_backup;
-
-    pts_backup = pkt->pts;
-    dts_backup = pkt->dts;
 
     // If the timestamp offsetting below is adjusted, adjust
     // ff_interleaved_peek similarly.
@@ -753,11 +748,6 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
             ret = s->pb->error;
     }
 
-    if (ret < 0) {
-        pkt->pts = pts_backup;
-        pkt->dts = dts_backup;
-    }
-
     return ret;
 }
 
-- 
2.21.0



More information about the ffmpeg-devel mailing list