[FFmpeg-devel] [PATCH 1/4] avformat/nutenc: don't use header_count to store different variables
Andriy Gelman
andriy.gelman at gmail.com
Sun Nov 8 21:50:40 EET 2020
From: Andriy Gelman <andriy.gelman at gmail.com>
Currently, header_count is used to store both the elision header count
and the header repetition count (number of times headers have been written
to output). Fix this by using a separate variable to store repetition
count.
Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
---
libavformat/nut.h | 3 ++-
libavformat/nutenc.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavformat/nut.h b/libavformat/nut.h
index a4409ee23d..a990d3832e 100644
--- a/libavformat/nut.h
+++ b/libavformat/nut.h
@@ -103,7 +103,8 @@ typedef struct NUTContext {
unsigned int time_base_count;
int64_t last_syncpoint_pos;
int64_t last_resync_pos;
- int header_count;
+ int header_count; // elision header count
+ int header_rep_count; // number of times headers written
AVRational *time_base;
struct AVTreeNode *syncpoints;
int sp_count;
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 1dcb2be1b1..87adef6f7e 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -684,7 +684,7 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
}
nut->last_syncpoint_pos = INT_MIN;
- nut->header_count++;
+ nut->header_rep_count++;
ret = 0;
fail:
@@ -988,7 +988,7 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
data_size += sm_size;
}
- if (1LL << (20 + 3 * nut->header_count) <= avio_tell(bc))
+ if (1LL << (20 + 3 * nut->header_rep_count) <= avio_tell(bc))
write_headers(s, bc);
if (key_frame && !(nus->last_flags & FLAG_KEY))
--
2.28.0
More information about the ffmpeg-devel
mailing list