[vlc-commits] background_worker: store the timeout in vlc_tick_t

Steve Lhomme git at videolan.org
Wed Sep 19 10:01:45 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Sep 19 09:58:06 2018 +0200| [f1b0a84d8dc19290df7faa97ac08372813b59b0f] | committer: Steve Lhomme

background_worker: store the timeout in vlc_tick_t

703ffde2cdbac363021499c6778b38888a0d0101 was missing the default_timeout
value which was incorrectly setting milliseconds in a tick.

It was also modifying unrelated QueueTake() values.

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

 src/misc/background_worker.c | 6 +++---
 src/preparser/preparser.c    | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/misc/background_worker.c b/src/misc/background_worker.c
index 822da04cb5..5b71071edd 100644
--- a/src/misc/background_worker.c
+++ b/src/misc/background_worker.c
@@ -33,7 +33,7 @@ struct task {
     struct vlc_list node;
     void* id; /**< id associated with entity */
     void* entity; /**< the entity to process */
-    int timeout; /**< timeout duration in milliseconds */
+    vlc_tick_t timeout; /**< timeout duration in vlc_tick_t */
 };
 
 struct background_worker;
@@ -73,7 +73,7 @@ static struct task *task_Create(struct background_worker *worker, void *id,
 
     task->id = id;
     task->entity = entity;
-    task->timeout = timeout < 0 ? worker->conf.default_timeout : timeout;
+    task->timeout = timeout < 0 ? worker->conf.default_timeout : VLC_TICK_FROM_MS(timeout);
     worker->conf.pf_hold(task->entity);
     return task;
 }
@@ -225,7 +225,7 @@ static void* Thread( void* data )
         thread->probe = false;
         vlc_tick_t deadline;
         if (task->timeout > 0)
-            deadline = vlc_tick_now() + VLC_TICK_FROM_MS(task->timeout);
+            deadline = vlc_tick_now() + task->timeout;
         else
             deadline = INT64_MAX; /* no deadline */
         vlc_mutex_unlock(&worker->lock);
diff --git a/src/preparser/preparser.c b/src/preparser/preparser.c
index f4c9a62053..b7497964d0 100644
--- a/src/preparser/preparser.c
+++ b/src/preparser/preparser.c
@@ -233,7 +233,7 @@ input_preparser_t* input_preparser_New( vlc_object_t *parent )
     input_preparser_t* preparser = malloc( sizeof *preparser );
 
     struct background_worker_config conf = {
-        .default_timeout = var_InheritInteger( parent, "preparse-timeout" ),
+        .default_timeout = VLC_TICK_FROM_MS(var_InheritInteger( parent, "preparse-timeout" )),
         .max_threads = var_InheritInteger( parent, "preparse-threads" ),
         .pf_start = PreparserOpenInput,
         .pf_probe = PreparserProbeInput,



More information about the vlc-commits mailing list