[vlc-commits] [Git][videolan/vlc][master] 3 commits: es_out: rename clock_source

Thomas Guillem (@tguillem) gitlab at videolan.org
Thu Jul 29 14:19:00 UTC 2021



Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
1a18940b by Thomas Guillem at 2021-07-29T13:53:21+00:00
es_out: rename clock_source

To avoid confusion with pgrm->active_clock_source.

- - - - -
88ad68a9 by Thomas Guillem at 2021-07-29T13:53:21+00:00
es_out: restore the previous ES_OUT_SET_PCR behavior

ES_OUT_SET_PCR can now be called anytime (even from the open cb) and
from any threads. The behavior was changed in
800482fbd2a1d3169a920f7b883590a6ff23949a.

This fixes assert with asynchronous accesses like pulse that could
configure the clock without being started by the input (via
ES_OUT_PRIV_SET_MODE)

Fixes #25947

- - - - -
03ec78a0 by Thomas Guillem at 2021-07-29T13:53:21+00:00
es_out: log the active clock source

- - - - -


1 changed file:

- src/input/es_out.c


Changes:

=====================================
src/input/es_out.c
=====================================
@@ -182,7 +182,7 @@ typedef struct
     struct vlc_list programs;
     es_out_pgrm_t *p_pgrm;  /* Master program */
 
-    enum vlc_clock_master_source clock_source;
+    enum vlc_clock_master_source user_clock_source;
 
     /* all es */
     int         i_id;
@@ -562,7 +562,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, input_source_t *main_source,
 
     p_sys->i_group_id = var_GetInteger( p_input, "program" );
 
-    p_sys->clock_source = clock_source_Inherit( VLC_OBJECT(p_input) );
+    p_sys->user_clock_source = clock_source_Inherit( VLC_OBJECT(p_input) );
 
     p_sys->i_pause_date = -1;
 
@@ -1312,11 +1312,11 @@ static void EsOutProgramHandleClockSource( es_out_t *out, es_out_pgrm_t *p_pgrm
      * open callback or midstream (from the demux callback). Therefore, we
      * can't handle the clock source selection after the program is created
      * since input_CanPaceControl() might not be initialized. To fix this
-     * issue, handle clock source selection when the first PCR is sent (from
-     * ES_OUT_SET_PCR). */
+     * issue, handle clock source selection after/when the es_out is activated
+     * (from ES_OUT_PRIV_SET_MODE) or when a program is created. */
     assert( p_sys->b_active );
 
-    switch( p_sys->clock_source )
+    switch( p_sys->user_clock_source )
     {
         case VLC_CLOCK_MASTER_AUTO:
             if (input_CanPaceControl(p_input))
@@ -1338,9 +1338,24 @@ static void EsOutProgramHandleClockSource( es_out_t *out, es_out_pgrm_t *p_pgrm
             break;
         }
         default:
-            p_pgrm->active_clock_source = p_sys->clock_source;
+            p_pgrm->active_clock_source = p_sys->user_clock_source;
             break;
     }
+
+    const char *clock_source_str;
+    switch( p_pgrm->active_clock_source )
+    {
+        case VLC_CLOCK_MASTER_AUDIO:    clock_source_str = "audio"; break;
+        case VLC_CLOCK_MASTER_INPUT:    clock_source_str = "input"; break;
+        case VLC_CLOCK_MASTER_MONOTONIC:clock_source_str = "monotonic"; break;
+
+        case VLC_CLOCK_MASTER_AUTO:
+        default:
+            vlc_assert_unreachable();
+    }
+
+    msg_Dbg( p_input, "program(%d): using clock source: '%s'\n",
+             p_pgrm->i_id, clock_source_str );
 }
 
 /* EsOutIsGroupSticky
@@ -1498,6 +1513,9 @@ static es_out_pgrm_t *EsOutProgramAdd( es_out_t *out, input_source_t *source, in
         return NULL;
     }
 
+    if( p_sys->b_active )
+        EsOutProgramHandleClockSource( out, p_pgrm );
+
     if( p_sys->b_paused )
         input_clock_ChangePause( p_pgrm->p_input_clock, p_sys->b_paused, p_sys->i_pause_date );
     const vlc_tick_t pts_delay = p_sys->i_pts_delay + p_sys->i_pts_jitter
@@ -2274,7 +2292,7 @@ static void EsOutCreateDecoder( es_out_t *out, es_out_id_t *p_es )
     assert( p_es->p_pgrm );
 
     enum es_format_category_e clock_source_cat;
-    switch( p_sys->clock_source )
+    switch( p_sys->user_clock_source )
     {
         case VLC_CLOCK_MASTER_AUTO:
         case VLC_CLOCK_MASTER_AUDIO:
@@ -3308,12 +3326,6 @@ static int EsOutVaControlLocked( es_out_t *out, input_source_t *source,
         if( !p_pgrm )
             return VLC_EGENERIC;
 
-        if( p_pgrm->active_clock_source == VLC_CLOCK_MASTER_AUTO )
-        {
-            EsOutProgramHandleClockSource( out, p_pgrm );
-            assert( p_pgrm->active_clock_source != VLC_CLOCK_MASTER_AUTO );
-        }
-
         i_pcr = va_arg( args, vlc_tick_t );
         if( i_pcr == VLC_TICK_INVALID )
         {
@@ -3654,6 +3666,19 @@ static int EsOutVaPrivControlLocked( es_out_t *out, int query, va_list args )
         p_sys->b_active = i_mode != ES_OUT_MODE_NONE;
         p_sys->i_mode = i_mode;
 
+        if( p_sys->b_active && i_mode != ES_OUT_MODE_END )
+        {
+            es_out_pgrm_t *p_pgrm;
+            vlc_list_foreach(p_pgrm, &p_sys->programs, node)
+            {
+                if( p_pgrm->active_clock_source == VLC_CLOCK_MASTER_AUTO )
+                {
+                    EsOutProgramHandleClockSource( out, p_pgrm );
+                    assert( p_pgrm->active_clock_source != VLC_CLOCK_MASTER_AUTO );
+                }
+            }
+        }
+
         /* Reapply policy mode */
         es_out_id_t *es;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b7a0228eb9b252f8b5b713c0a3ceb65767b062c5...03ec78a0a3edf29eeb4398d1ee337a764ef02f04

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b7a0228eb9b252f8b5b713c0a3ceb65767b062c5...03ec78a0a3edf29eeb4398d1ee337a764ef02f04
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list