diff mbox series

[FFmpeg-devel,22/22] fftools/ffmpeg_mux: move muxing queue fields from OutputStream to MuxStream

Message ID 20221014101548.3486-9-anton@khirnov.net
State Accepted
Commit c5d7b6f49be661e67580e760aa53e83176e4d29c
Headers show
Series [FFmpeg-devel,01/13] fftools/ffmpeg_mux: do not unref a NULL packet | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Oct. 14, 2022, 10:15 a.m. UTC
They are private to the muxer and do not need to be visible outside of
it.
---
 fftools/ffmpeg.h          | 5 -----
 fftools/ffmpeg_mux.c      | 4 ++--
 fftools/ffmpeg_mux.h      | 5 +++++
 fftools/ffmpeg_mux_init.c | 8 ++++----
 4 files changed, 11 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index b98bb45331..8f03d638c3 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -596,11 +596,6 @@  typedef struct OutputStream {
     /* packet quality factor */
     int quality;
 
-    int max_muxing_queue_size;
-
-    /* Threshold after which max_muxing_queue_size will be in effect */
-    size_t muxing_queue_data_threshold;
-
     /* packet picture type */
     int pict_type;
 
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 525c15b4ae..2b70143978 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -264,8 +264,8 @@  static int queue_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
         size_t cur_size = av_fifo_can_read(ms->muxing_queue);
         size_t pkt_size = pkt ? pkt->size : 0;
         unsigned int are_we_over_size =
-            (ms->muxing_queue_data_size + pkt_size) > ost->muxing_queue_data_threshold;
-        size_t limit    = are_we_over_size ? ost->max_muxing_queue_size : SIZE_MAX;
+            (ms->muxing_queue_data_size + pkt_size) > ms->muxing_queue_data_threshold;
+        size_t limit    = are_we_over_size ? ms->max_muxing_queue_size : SIZE_MAX;
         size_t new_size = FFMIN(2 * cur_size, limit);
 
         if (new_size <= cur_size) {
diff --git a/fftools/ffmpeg_mux.h b/fftools/ffmpeg_mux.h
index 8470f971cc..6ea7c692ef 100644
--- a/fftools/ffmpeg_mux.h
+++ b/fftools/ffmpeg_mux.h
@@ -48,6 +48,11 @@  typedef struct MuxStream {
      */
     size_t muxing_queue_data_size;
 
+    int max_muxing_queue_size;
+
+    /* Threshold after which max_muxing_queue_size will be in effect */
+    size_t muxing_queue_data_threshold;
+
     /* dts of the last packet sent to the muxer, in the stream timebase
      * used for making up missing dts values */
     int64_t last_mux_dts;
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 3f2db04f52..24b4631326 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -330,11 +330,11 @@  static OutputStream *new_output_stream(Muxer *mux, OptionsContext *o,
     MATCH_PER_STREAM_OPT(disposition, str, ost->disposition, oc, st);
     ost->disposition = av_strdup(ost->disposition);
 
-    ost->max_muxing_queue_size = 128;
-    MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, oc, st);
+    ms->max_muxing_queue_size = 128;
+    MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ms->max_muxing_queue_size, oc, st);
 
-    ost->muxing_queue_data_threshold = 50*1024*1024;
-    MATCH_PER_STREAM_OPT(muxing_queue_data_threshold, i, ost->muxing_queue_data_threshold, oc, st);
+    ms->muxing_queue_data_threshold = 50*1024*1024;
+    MATCH_PER_STREAM_OPT(muxing_queue_data_threshold, i, ms->muxing_queue_data_threshold, oc, st);
 
     MATCH_PER_STREAM_OPT(bits_per_raw_sample, i, ost->bits_per_raw_sample,
                          oc, st);