[vlc-commits] demux: adaptive: fix deadlock regression on pause

Francois Cartegnie git at videolan.org
Mon Mar 29 18:48:01 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Mar 29 19:45:18 2021 +0200| [cb8ce20853ea44e6136183782bcd06960baa3203] | committer: Francois Cartegnie

demux: adaptive: fix deadlock regression on pause

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cb8ce20853ea44e6136183782bcd06960baa3203
---

 modules/demux/adaptive/PlaylistManager.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index e38e4d2fd6..1739ba57ba 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -540,12 +540,13 @@ int PlaylistManager::doControl(int i_query, va_list args)
 
         case DEMUX_SET_PAUSE_STATE:
         {
-            vlc_mutex_locker locker(&cached.lock);
+            setBufferingRunState(false); /* /!\ always stop buffering process first */
             bool b_pause = (bool)va_arg(args, int);
             if(playlist->isLive())
             {
-                setBufferingRunState(false); /* stop downloader first */
                 vlc_tick_t now = vlc_tick_now();
+                demux.i_nzpcr = VLC_TICK_INVALID;
+                cached.lastupdate = 0;
                 if(b_pause)
                 {
                     setLivePause(true);
@@ -558,11 +559,10 @@ int PlaylistManager::doControl(int i_query, va_list args)
                     msg_Dbg(p_demux,"Resuming buffering/playback after %" PRId64 "ms",
                             MS_FROM_VLC_TICK(now-pause_start));
                     es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
+                    setBufferingRunState(true);
                 }
-                setBufferingRunState(true);
-                demux.i_nzpcr = VLC_TICK_INVALID;
-                cached.lastupdate = 0;
             }
+            else setBufferingRunState(true);
             return VLC_SUCCESS;
         }
 
@@ -593,7 +593,7 @@ int PlaylistManager::doControl(int i_query, va_list args)
 
         case DEMUX_SET_POSITION:
         {
-            setBufferingRunState(false); /* stop downloader first */
+            setBufferingRunState(false); /* /!\ always stop buffering process first */
             vlc_mutex_locker locker(&cached.lock);
 
             if(cached.playlistLength == 0)



More information about the vlc-commits mailing list