[vlc-commits] [Git][videolan/vlc][master] 5 commits: aout: fix pause fallback

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Nov 17 13:27:08 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b1cc207e by Thomas Guillem at 2023-11-17T12:59:47+00:00
aout: fix pause fallback

Only flushing the module is not enough, the stream state must correspond to
the flushed state.

- - - - -
edc51a3f by Thomas Guillem at 2023-11-17T12:59:47+00:00
aout: make pause not mandatory

The core is better to handle pause than a small helper, cf. previous
commit.

- - - - -
ac48b21c by Thomas Guillem at 2023-11-17T12:59:47+00:00
decklink: don't implement pause

- - - - -
ba663392 by Thomas Guillem at 2023-11-17T12:59:47+00:00
sndio: don't implement pause

- - - - -
05d44bf1 by Thomas Guillem at 2023-11-17T12:59:47+00:00
aout: remove aout_PauseDefault

- - - - -


5 changed files:

- include/vlc_aout.h
- modules/audio_output/sndio.c
- modules/video_output/decklink.cpp
- src/audio_output/dec.c
- src/audio_output/output.c


Changes:

=====================================
include/vlc_aout.h
=====================================
@@ -226,15 +226,14 @@ struct audio_output
       */
 
     void (*pause)( audio_output_t *, bool pause, vlc_tick_t date);
-    /**< Pauses or resumes playback (mandatory, cannot be NULL).
+    /**< Pauses or resumes playback (can be NULL).
       *
       * This callback pauses or resumes audio playback as quickly as possible.
       * When pausing, it is desirable to stop producing sound immediately, but
       * retain already queued audio samples in the buffer to play when later
       * when resuming.
       *
-      * If pausing is impossible, then aout_PauseDefault() can provide a
-      * fallback implementation of this callback.
+      * If pausing is impossible, the core will flush the module.
       *
       * \param pause pause if true, resume from pause if false
       * \param date timestamp when the pause or resume was requested
@@ -390,21 +389,6 @@ static inline void aout_RestartRequest(audio_output_t *aout, unsigned mode)
     aout->events->restart_request(aout, mode);
 }
 
-/**
- * Default implementation for audio_output_t.pause
- *
- * \warning This default callback implementation is suboptimal as it will
- * discard some audio samples.
- * Do not use this unless there are really no possible better alternatives.
- */
-static inline void aout_PauseDefault(audio_output_t *aout, bool paused,
-                                     vlc_tick_t date)
-{
-    if (paused)
-        aout->flush(aout);
-    (void) date;
-}
-
 #define AOUT_RESTART_FILTERS        0x1
 #define AOUT_RESTART_OUTPUT         (AOUT_RESTART_FILTERS|0x2)
 #define AOUT_RESTART_STEREOMODE     (AOUT_RESTART_OUTPUT|0x4)


=====================================
modules/audio_output/sndio.c
=====================================
@@ -179,7 +179,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
 
     aout->time_get = TimeGet;
     aout->play = Play;
-    aout->pause = aout_PauseDefault;
+    aout->pause = NULL;
     aout->flush = Flush;
     if (sio_onvol(sys->hdl, VolumeChanged, aout))
     {


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


=====================================
src/audio_output/dec.c
=====================================
@@ -848,7 +848,7 @@ void vlc_aout_stream_ChangePause(vlc_aout_stream *stream, bool paused, vlc_tick_
         if (aout->pause != NULL)
             aout->pause(aout, paused, date);
         else if (paused)
-            aout->flush(aout);
+            vlc_aout_stream_Flush(stream);
 
         /* Update the rate point after the pause */
         if (aout->time_get == NULL && !paused


=====================================
src/audio_output/output.c
=====================================
@@ -782,7 +782,7 @@ int aout_OutputNew(audio_output_t *aout, vlc_aout_stream *stream,
                       "failing back to linear format");
         return -1;
     }
-    assert(aout->flush && aout->play && aout->pause);
+    assert(aout->flush != NULL && aout->play != NULL);
 
     /* Autoselect the headphones mode if available and if the user didn't
      * request any mode */



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/432195b83e2038df3dbe826f5e294fe62fc41091...05d44bf144b02d74d338f6b4d490cbba3fee0912

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/432195b83e2038df3dbe826f5e294fe62fc41091...05d44bf144b02d74d338f6b4d490cbba3fee0912
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