diff mbox series

[FFmpeg-devel,24/25] avformat/matroskaenc: Avoid repeated avio_tell()

Message ID AM7PR03MB666083297FA99D9B84EE8C748F569@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 48ff1ba68762a869d4d8ea66b4e045779fb82555
Headers show
Series [FFmpeg-devel,01/25] avformat/matroskaenc: Fix potential overflow | expand

Checks

Context Check Description
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 16, 2022, 11:04 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 28c7dee9b5..230bbf4a2c 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2503,7 +2503,7 @@  static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
                            AVIOContext *pb, const AVCodecParameters *par,
                            mkv_track *track, const AVPacket *pkt,
                            int keyframe, int64_t ts, uint64_t duration,
-                           int force_blockgroup)
+                           int force_blockgroup, int64_t relative_packet_pos)
 {
     uint8_t *side_data;
     size_t side_data_size;
@@ -2529,7 +2529,7 @@  static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
            "Writing block of size %d with pts %" PRId64 ", dts %" PRId64 ", "
            "duration %" PRId64 " at relative offset %" PRId64 " in cluster "
            "at offset %" PRId64 ". TrackNumber %u, keyframe %d\n",
-           pkt->size, pkt->pts, pkt->dts, pkt->duration, avio_tell(pb),
+           pkt->size, pkt->pts, pkt->dts, pkt->duration, relative_packet_pos,
            mkv->cluster_pos, track_number, keyframe != 0);
 
     side_data = av_packet_get_side_data(pkt,
@@ -2737,7 +2737,8 @@  static int mkv_write_packet_internal(AVFormatContext *s, const AVPacket *pkt)
      * so we force it even for packets without duration. */
     ret = mkv_write_block(s, mkv, pb, par, track, pkt,
                           keyframe, ts, write_duration,
-                          par->codec_id == AV_CODEC_ID_WEBVTT);
+                          par->codec_id == AV_CODEC_ID_WEBVTT,
+                          relative_packet_pos);
     if (ret < 0)
         return ret;
     if (keyframe && IS_SEEKABLE(s->pb, mkv) &&