[vlc-devel] [PATCH] ts: obsolete --sout-ts-bmin and --sout-ts-bmax

Lyndon Brown jnqnfe at gmail.com
Sun Sep 27 22:25:41 CEST 2020


attached. preview:

From: Lyndon Brown <jnqnfe at gmail.com>
Date: Fri, 29 Mar 2019 01:27:28 +0000
Subject: ts: obsolete --sout-ts-bmin and --sout-ts-bmax

just as hinted in the option long descriptions, these options are actually
obsolete, but were never converted to actual obsolete options

a little code was left that read, stored and reacted to the option values,
however it really did nothing at all useful:
 1) if min > max, gives warning and sets to zero - POINTLESS
 2) if min or max > 0, gives error about not supported - POINTLESS
 3) if bit rate goes above max, gives warning - POINTLESS

diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index d52289a325..26fc4f2f09 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -153,12 +153,6 @@ static const char *const ts_standards_list_text[] =
   "PCRs (Program Clock Reference) will be sent (in milliseconds). " \
   "This value should be below 100ms. (default is 70ms).")
 
-#define BMIN_TEXT N_( "Minimum B (deprecated)")
-#define BMIN_LONGTEXT N_( "This setting is deprecated and not used anymore" )
-
-#define BMAX_TEXT N_( "Maximum B (deprecated)")
-#define BMAX_LONGTEXT N_( "This setting is deprecated and not used anymore")
-
 #define DTS_TEXT N_("DTS delay (ms)")
 #define DTS_LONGTEXT N_("Delay the DTS (decoding time " \
   "stamps) and PTS (presentation timestamps) of the data in the " \
@@ -226,10 +220,11 @@ vlc_module_begin ()
     add_bool(SOUT_CFG_PREFIX "use-key-frames", false, KEYF_TEXT, KEYF_LONGTEXT, true)
 
     add_integer( SOUT_CFG_PREFIX "pcr", 70, PCR_TEXT, PCR_LONGTEXT, true)
-    add_integer( SOUT_CFG_PREFIX "bmin", 0, BMIN_TEXT, BMIN_LONGTEXT, true)
-    add_integer( SOUT_CFG_PREFIX "bmax", 0, BMAX_TEXT, BMAX_LONGTEXT, true)
     add_integer( SOUT_CFG_PREFIX "dts-delay", 400, DTS_TEXT, DTS_LONGTEXT, true)
 
+    add_obsolete_integer( "sout-ts-bmin" ) /* since 4.0.0 */
+    add_obsolete_integer( "sout-ts-bmax" ) /* since 4.0.0 */
+
     add_bool( SOUT_CFG_PREFIX "crypt-audio", true, ACRYPT_TEXT, ACRYPT_LONGTEXT, true)
     add_bool( SOUT_CFG_PREFIX "crypt-video", true, VCRYPT_TEXT, VCRYPT_LONGTEXT, true)
     add_string( SOUT_CFG_PREFIX "csa-ck",  NULL, CK_TEXT,   CK_LONGTEXT,   true)
@@ -247,7 +242,7 @@ static const char *const ppsz_sout_options[] = {
     "standard",
     "pid-video", "pid-audio", "pid-spu", "pid-pmt", "tsid",
     "netid", "sdtdesc",
-    "es-id-pid", "shaping", "pcr", "bmin", "bmax", "use-key-frames",
+    "es-id-pid", "shaping", "pcr", "use-key-frames",
     "dts-delay", "csa-ck", "csa2-ck", "csa-use", "csa-pkt", "crypt-audio", "crypt-video",
     "muxpmt", "program-pmt", "alignment",
     NULL
@@ -368,9 +363,6 @@ typedef struct
     ts_mux_standard standard;
 
     /* for TS building */
-    int64_t         i_bitrate_min;
-    int64_t         i_bitrate_max;
-
     vlc_tick_t      i_shaping_delay;
     vlc_tick_t      i_pcr_delay;
 
@@ -687,25 +679,6 @@ static int Open( vlc_object_t *p_this )
     p_sys->i_pid_audio = var_GetInteger( p_mux, SOUT_CFG_PREFIX "pid-audio" );
     p_sys->i_pid_spu = var_GetInteger( p_mux, SOUT_CFG_PREFIX "pid-spu" );
 
-    /* Allow to create constrained stream */
-    p_sys->i_bitrate_min = var_GetInteger( p_mux, SOUT_CFG_PREFIX "bmin" );
-
-    p_sys->i_bitrate_max = var_GetInteger( p_mux, SOUT_CFG_PREFIX "bmax" );
-
-    if( p_sys->i_bitrate_min > 0 && p_sys->i_bitrate_max > 0 &&
-        p_sys->i_bitrate_min > p_sys->i_bitrate_max )
-    {
-        msg_Err( p_mux, "incompatible minimum and maximum bitrate, "
-                 "disabling bitrate control" );
-        p_sys->i_bitrate_min = 0;
-        p_sys->i_bitrate_max = 0;
-    }
-    if( p_sys->i_bitrate_min > 0 || p_sys->i_bitrate_max > 0 )
-    {
-        msg_Err( p_mux, "bmin and bmax no more supported "
-                 "(if you need them report it)" );
-    }
-
     var_Get( p_mux, SOUT_CFG_PREFIX "shaping", &val );
     if( val.i_int <= 0 )
     {
@@ -1764,19 +1737,7 @@ static void TSDate( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts,
     sout_mux_sys_t  *p_sys = p_mux->p_sys;
     int i_packet_count = p_chain_ts->i_depth;
 
-    if ( likely(i_pcr_length / 1000 > 0) )
-    {
-        int i_bitrate = ((uint64_t)i_packet_count * 188 * 8000)
-                          / MS_FROM_VLC_TICK(i_pcr_length);
-        if ( p_sys->i_bitrate_max && p_sys->i_bitrate_max < i_bitrate )
-        {
-            msg_Warn( p_mux, "max bitrate exceeded at %"PRId64
-                      " (%d bi/s for %d pkt in %"PRId64" us)",
-                      i_pcr_dts + p_sys->i_shaping_delay * 3 / 2 - vlc_tick_now(),
-                      i_bitrate, i_packet_count, i_pcr_length);
-        }
-    }
-    else
+    if ( unlikely(i_pcr_length / 1000 <= 0) )
     {
         /* This shouldn't happen, but happens in some rare heavy load
          * and packet losses conditions. */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ts_obs_opt.patch
Type: text/x-patch
Size: 4893 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200927/771ce100/attachment.bin>


More information about the vlc-devel mailing list