[vlc-commits] [Git][videolan/vlc][master] fetcher: always create a downloader thread

Tristan Matthews (@tmatth) gitlab at videolan.org
Tue Oct 22 04:51:07 UTC 2024



Tristan Matthews pushed to branch master at VideoLAN / VLC


Commits:
c59ee89f by Thomas Guillem at 2024-10-21T08:47:08+02:00
fetcher: always create a downloader thread

It can be finally used by local fetchers.

Regression from ed25f895756e8d1bca1c2327db82e71d6b046f08

 #0  0x00007f49abda59c9 in vlc_mutex_trylock (mtx=mtx at entry=0x0) at misc/threads.c:122
 #1  0x00007f49abda5a1c in vlc_mutex_lock (mtx=mtx at entry=0x0) at misc/threads.c:103
 #2  0x00007f49abd9c3b1 in vlc_executor_Submit (executor=0x0, runnable=runnable at entry=0x7f498800fd28) at misc/executor.c:212
 #3  0x00007f49abd27de7 in Submit (fetcher=0x55a9fc371820, executor=<optimized out>, item=0x55a9fc41c0a0, options=META_REQUEST_OPTION_FETCH_LOCAL, cbs=0x7f49abe0c2b8 <input_fetcher_callbacks>, userdata=0x55a9fc40ac60) at preparser/fetcher.c:142
 #4  0x00007f49abd28ab0 in SearchByScope (task=task at entry=0x7f498c004b30, scope=scope at entry=1) at preparser/fetcher.c:287
 #5  0x00007f49abd28c7f in RunSearchLocal (userdata=0x7f498c004b30) at preparser/fetcher.c:383
 #6  0x00007f49abd9c296 in ThreadRun (userdata=0x55a9fc3fd8e0) at misc/executor.c:134
 #7  0x00007f49abaa760c in start_thread (arg=<optimized out>) at pthread_create.c:444
 #8  0x00007f49abb2eaa8 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Fixes #28832

- - - - -


1 changed file:

- src/preparser/fetcher.c


Changes:

=====================================
src/preparser/fetcher.c
=====================================
@@ -94,10 +94,7 @@ TaskNew(input_fetcher_t *fetcher, vlc_executor_t *executor, input_item_t *item,
     else if (executor == fetcher->executor_network)
         task->runnable.run = RunSearchNetwork;
     else
-    {
-        assert(executor == fetcher->executor_downloader);
         task->runnable.run = RunDownloader;
-    }
 
     task->runnable.userdata = task;
 
@@ -460,21 +457,19 @@ input_fetcher_t* input_fetcher_New( vlc_object_t* owner,
             return NULL;
         }
 
-        fetcher->executor_downloader = vlc_executor_New(max_threads);
-        if (!fetcher->executor_downloader)
-        {
-            if (fetcher->executor_network)
-                vlc_executor_Delete(fetcher->executor_network);
-            if (fetcher->executor_local)
-                vlc_executor_Delete(fetcher->executor_local);
-            free(fetcher);
-            return NULL;
-        }
     }
     else
-    {
         fetcher->executor_network = NULL;
-        fetcher->executor_downloader = NULL;
+
+    fetcher->executor_downloader = vlc_executor_New(max_threads);
+    if (!fetcher->executor_downloader)
+    {
+        if (fetcher->executor_network)
+            vlc_executor_Delete(fetcher->executor_network);
+        if (fetcher->executor_local)
+            vlc_executor_Delete(fetcher->executor_local);
+        free(fetcher);
+        return NULL;
     }
 
     fetcher->owner = owner;
@@ -533,8 +528,8 @@ void input_fetcher_Delete( input_fetcher_t* fetcher )
         vlc_executor_Delete(fetcher->executor_local);
     if (fetcher->executor_network)
         vlc_executor_Delete(fetcher->executor_network);
-    if (fetcher->executor_downloader)
-        vlc_executor_Delete(fetcher->executor_downloader);
+    assert(fetcher->executor_downloader);
+    vlc_executor_Delete(fetcher->executor_downloader);
 
     vlc_dictionary_clear( &fetcher->album_cache, FreeCacheEntry, NULL );
     free( fetcher );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c59ee89f38602407a3ee74f0fb3b90289f709501

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c59ee89f38602407a3ee74f0fb3b90289f709501
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