Commit f1b0a84d authored by Steve Lhomme's avatar Steve Lhomme
Browse files

background_worker: store the timeout in vlc_tick_t

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

It was also modifying unrelated QueueTake() values.
parent 7dfdce94
......@@ -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);
......
......@@ -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,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment