[vlc-commits] podcast: process URLs when the thread starts

Rémi Denis-Courmont git at videolan.org
Sun Apr 12 09:15:53 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 12 09:43:00 2020 +0300| [a3d1ca648f66e2552117af8579c1e10901c72ec5] | committer: Rémi Denis-Courmont

podcast: process URLs when the thread starts

Instead of having the Open() function queue an update request, just do
the update at start implicitly. This removes the tiny time window where
the request from Open() would be clobbered by a variable callback.

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

 modules/services_discovery/podcast.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c
index f43def9d1f..17b840463d 100644
--- a/modules/services_discovery/podcast.c
+++ b/modules/services_discovery/podcast.c
@@ -130,7 +130,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->i_items = 0;
     vlc_mutex_init( &p_sys->lock );
     vlc_cond_init( &p_sys->wait );
-    p_sys->b_update = true;
+    p_sys->b_update = false;
     p_sys->b_savedurls_loaded = false;
     p_sys->psz_request = NULL;
     p_sys->update_type = UPDATE_URLS;
@@ -190,15 +190,26 @@ noreturn static void *Run( void *data )
 {
     services_discovery_t *p_sd = data;
     services_discovery_sys_t *p_sys  = p_sd->p_sys;
+    int canc;
 
     vlc_mutex_lock( &p_sys->lock );
     mutex_cleanup_push( &p_sys->lock );
+
+    canc = vlc_savecancel();
+    {
+        char *psz_urls = var_GetNonEmptyString( vlc_object_parent(p_sd),
+                                                "podcast-urls" );
+        ParseUrls( p_sd, psz_urls );
+        free( psz_urls );
+    }
+    vlc_restorecancel(canc);
+
     for( ;; )
     {
         while( !p_sys->b_update )
             vlc_cond_wait( &p_sys->wait, &p_sys->lock );
 
-        int canc = vlc_savecancel ();
+        canc = vlc_savecancel();
         msg_Dbg( p_sd, "Update required" );
 
         if( p_sys->update_type == UPDATE_URLS )



More information about the vlc-commits mailing list