[vlc-commits] [Git][videolan/vlc][master] 6 commits: adummy: reset variables from stop

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Apr 3 20:54:17 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
338d4a1f by Thomas Guillem at 2022-04-03T20:31:32+00:00
adummy: reset variables from stop

- - - - -
0ed383a4 by Thomas Guillem at 2022-04-03T20:31:32+00:00
decklink: flush from stop

The stop cb was only resetting some variables. Also flush from stop
since the flush cb won't necessarily be called before a stop.

- - - - -
beaf107e by Thomas Guillem at 2022-04-03T20:31:32+00:00
amem: flush from stop

Because the documentation says that flush is called when stopped.

- - - - -
a033bdba by Thomas Guillem at 2022-04-03T20:31:32+00:00
aout: split vlc_aout_stream_Flush

In order to split stream_Reset() and aout->flush().

The aout is now flushed before resetting filters and clocks but it should
not have any impacts.

- - - - -
00cde969 by Thomas Guillem at 2022-04-03T20:31:32+00:00
aout: move stream_Reset()

To avoid forward declarations.

- - - - -
c9a6381d by Thomas Guillem at 2022-04-03T20:31:32+00:00
aout: don't flush before stop

Only reset the clock and filters.

Every aout modules must be able to stop without having a flush first.

- - - - -


4 changed files:

- modules/audio_output/adummy.c
- modules/audio_output/amem.c
- modules/video_output/decklink.cpp
- src/audio_output/dec.c


Changes:

=====================================
modules/audio_output/adummy.c
=====================================
@@ -127,11 +127,6 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     return VLC_SUCCESS;
 }
 
-static void Stop(audio_output_t *aout)
-{
-    (void) aout;
-}
-
 static void Close(vlc_object_t *obj)
 {
     audio_output_t *aout = (audio_output_t *)obj;
@@ -153,7 +148,7 @@ static int Open(vlc_object_t *obj)
     aout->play = Play;
     aout->pause = Pause;
     aout->flush = Flush;
-    aout->stop = Stop;
+    aout->stop = Flush;
     aout->volume_set = NULL;
     aout->mute_set = NULL;
     return VLC_SUCCESS;


=====================================
modules/audio_output/amem.c
=====================================
@@ -206,6 +206,8 @@ static void Stop (audio_output_t *aout)
     aout_sys_t *sys = aout->sys;
 
     vlc_mutex_lock(&sys->lock);
+    if (sys->flush != NULL)
+        sys->flush (sys->opaque);
     if (sys->cleanup != NULL)
         sys->cleanup (sys->opaque);
 


=====================================
modules/video_output/decklink.cpp
=====================================
@@ -976,7 +976,7 @@ static int OpenAudio(vlc_object_t *p_this)
     aout->time_get  = TimeGet;
 
     aout->pause     = aout_PauseDefault;
-    aout->stop      = DrainReset;
+    aout->stop      = Flush;
     aout->mute_set  = NULL;
     aout->volume_set= NULL;
 


=====================================
src/audio_output/dec.c
=====================================
@@ -89,6 +89,46 @@ static inline audio_output_t *aout_stream_aout(vlc_aout_stream *stream)
 {
     return &stream->instance->output;
 }
+
+static void stream_Reset(vlc_aout_stream *stream)
+{
+    aout_owner_t *owner = aout_stream_owner(stream);
+
+    if (stream->mixer_format.i_format)
+    {
+        vlc_audio_meter_Flush(&owner->meter);
+
+        if (stream->filters)
+            aout_FiltersFlush (stream->filters);
+
+        vlc_clock_Reset(stream->sync.clock);
+        if (stream->filters)
+            aout_FiltersResetClock(stream->filters);
+
+        if (stream->sync.delay > 0)
+        {
+            /* Also reset the delay in case of a positive delay. This will
+             * trigger a silence playback before the next play. Consequently,
+             * the first play date won't be (delay + dejitter) but only
+             * dejitter. This will allow the aout to update the master clock
+             * sooner.
+             */
+            vlc_clock_SetDelay(stream->sync.clock, 0);
+            if (stream->filters)
+                aout_FiltersSetClockDelay(stream->filters, 0);
+            stream->sync.request_delay = stream->sync.delay;
+            stream->sync.delay = 0;
+        }
+    }
+
+    atomic_store_explicit(&stream->drained, false, memory_order_relaxed);
+    atomic_store_explicit(&stream->drain_deadline, VLC_TICK_INVALID,
+                          memory_order_relaxed);
+
+    stream->sync.discontinuity = true;
+    stream->original_pts = VLC_TICK_INVALID;
+}
+
 /**
  * Creates an audio output
  */
@@ -199,7 +239,7 @@ void vlc_aout_stream_Delete (vlc_aout_stream *stream)
 
     if (stream->mixer_format.i_format)
     {
-        vlc_aout_stream_Flush(stream);
+        stream_Reset(stream);
         if (stream->filters)
             aout_FiltersDelete (aout, stream->filters);
         aout_OutputDelete (aout);
@@ -612,42 +652,10 @@ void vlc_aout_stream_ChangeDelay(vlc_aout_stream *stream, vlc_tick_t delay)
 void vlc_aout_stream_Flush(vlc_aout_stream *stream)
 {
     audio_output_t *aout = aout_stream_aout(stream);
-    aout_owner_t *owner = aout_stream_owner(stream);
 
+    stream_Reset(stream);
     if (stream->mixer_format.i_format)
-    {
-        vlc_audio_meter_Flush(&owner->meter);
-
-        if (stream->filters)
-            aout_FiltersFlush (stream->filters);
-
         aout->flush(aout);
-        vlc_clock_Reset(stream->sync.clock);
-        if (stream->filters)
-            aout_FiltersResetClock(stream->filters);
-
-        if (stream->sync.delay > 0)
-        {
-            /* Also reset the delay in case of a positive delay. This will
-             * trigger a silence playback before the next play. Consequently,
-             * the first play date won't be (delay + dejitter) but only
-             * dejitter. This will allow the aout to update the master clock
-             * sooner.
-             */
-            vlc_clock_SetDelay(stream->sync.clock, 0);
-            if (stream->filters)
-                aout_FiltersSetClockDelay(stream->filters, 0);
-            stream->sync.request_delay = stream->sync.delay;
-            stream->sync.delay = 0;
-        }
-    }
-
-    atomic_store_explicit(&stream->drained, false, memory_order_relaxed);
-    atomic_store_explicit(&stream->drain_deadline, VLC_TICK_INVALID,
-                          memory_order_relaxed);
-
-    stream->sync.discontinuity = true;
-    stream->original_pts = VLC_TICK_INVALID;
 }
 
 void vlc_aout_stream_NotifyGain(vlc_aout_stream *stream, float gain)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0768eef6cee3e224614135a0daa8584c6feb94ae...c9a6381d60dc6b074dbf52401792080b12b1d921

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


VideoLAN code repository instance


More information about the vlc-commits mailing list