Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
438
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
993528cc
Commit
993528cc
authored
11 months ago
by
Fatih Uzunoğlu
Committed by
Steve Lhomme
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fingerprinter: abort processing on close
parent
4134f7f3
No related branches found
No related tags found
1 merge request
!5100
fingerprinter: abort processing on close
Pipeline
#457458
passed with warnings with stage
in 22 minutes and 41 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/misc/fingerprinter.c
+20
-15
20 additions, 15 deletions
modules/misc/fingerprinter.c
with
20 additions
and
15 deletions
modules/misc/fingerprinter.c
+
20
−
15
View file @
993528cc
...
...
@@ -49,11 +49,16 @@ struct fingerprinter_sys_t
atomic_bool
abort
;
struct
{
vlc_array_t
queue
;
}
incoming
;
struct
{
vlc_array_t
queue
;
vlc_mutex_t
lock
;
}
incoming
,
results
;
}
results
;
vlc_cond_t
incoming_cond
;
...
...
@@ -88,10 +93,10 @@ vlc_module_end ()
static
int
EnqueueRequest
(
fingerprinter_thread_t
*
f
,
fingerprint_request_t
*
r
)
{
fingerprinter_sys_t
*
p_sys
=
f
->
p_sys
;
vlc_
mutex_l
ock
(
&
p_sys
->
incoming
.
lock
);
vlc_
player_L
ock
(
p_sys
->
player
);
int
i_ret
=
vlc_array_append
(
&
p_sys
->
incoming
.
queue
,
r
);
vlc_cond_signal
(
&
p_sys
->
incoming_cond
);
vlc_
mutex_u
nlock
(
&
p_sys
->
incoming
.
lock
);
vlc_
player_U
nlock
(
p_sys
->
player
);
return
i_ret
;
}
...
...
@@ -199,7 +204,7 @@ static void DoFingerprint( fingerprinter_thread_t *p_fingerprinter,
if
(
ret
==
VLC_SUCCESS
)
{
while
(
p_fingerprinter
->
p_sys
->
processing
.
b_working
)
while
(
!
p_fingerprinter
->
p_sys
->
abort
&&
p_fingerprinter
->
p_sys
->
processing
.
b_working
)
vlc_player_CondWait
(
player
,
&
p_fingerprinter
->
p_sys
->
processing
.
cond
);
...
...
@@ -251,9 +256,8 @@ static int Open(vlc_object_t *p_this)
return
VLC_ENOMEM
;
}
atomic_init
(
&
p_sys
->
abort
,
false
)
;
p_sys
->
abort
=
false
;
vlc_array_init
(
&
p_sys
->
incoming
.
queue
);
vlc_mutex_init
(
&
p_sys
->
incoming
.
lock
);
vlc_cond_init
(
&
p_sys
->
incoming_cond
);
vlc_array_init
(
&
p_sys
->
processing
.
queue
);
...
...
@@ -289,10 +293,11 @@ static void Close(vlc_object_t *p_this)
fingerprinter_thread_t
*
p_fingerprinter
=
(
fingerprinter_thread_t
*
)
p_this
;
fingerprinter_sys_t
*
p_sys
=
p_fingerprinter
->
p_sys
;
vlc_mutex_lock
(
&
p_sys
->
incoming
.
lock
);
atomic_store_explicit
(
&
p_sys
->
abort
,
true
,
memory_order_relaxed
);
vlc_player_Lock
(
p_sys
->
player
);
p_sys
->
abort
=
true
;
vlc_cond_signal
(
&
p_sys
->
processing
.
cond
);
vlc_cond_signal
(
&
p_sys
->
incoming_cond
);
vlc_
mutex_u
nlock
(
&
p_sys
->
incoming
.
lock
);
vlc_
player_U
nlock
(
p_sys
->
player
);
vlc_join
(
p_sys
->
thread
,
NULL
);
CleanSys
(
p_sys
);
...
...
@@ -353,21 +358,21 @@ static void *Run( void *opaque )
/* main loop */
for
(;;)
{
vlc_
mutex_l
ock
(
&
p_sys
->
incoming
.
lock
);
vlc_
player_L
ock
(
p_sys
->
player
);
while
(
vlc_array_count
(
&
p_sys
->
incoming
.
queue
)
==
0
)
{
if
(
atomic_load_explicit
(
&
p_sys
->
abort
,
memory_order_relaxed
)
)
if
(
p_sys
->
abort
)
{
vlc_
mutex_u
nlock
(
&
p_sys
->
incoming
.
lock
);
vlc_
player_U
nlock
(
p_sys
->
player
);
return
NULL
;
}
vlc_
c
ond
_w
ait
(
&
p_sys
->
incoming_cond
,
&
p_sys
->
incoming
.
lock
);
vlc_
player_C
ond
W
ait
(
p_sys
->
player
,
&
p_sys
->
incoming
_cond
);
}
QueueIncomingRequests
(
p_sys
);
vlc_
mutex_u
nlock
(
&
p_sys
->
incoming
.
lock
);
vlc_
player_U
nlock
(
p_sys
->
player
);
bool
results_available
=
false
;
while
(
vlc_array_count
(
&
p_sys
->
processing
.
queue
)
)
...
...
@@ -411,7 +416,7 @@ static void *Run( void *opaque )
// cancellation, so remove it immediately
vlc_array_remove
(
&
p_sys
->
processing
.
queue
,
0
);
if
(
atomic_load_explicit
(
&
p_sys
->
abort
,
memory_order_relaxed
)
)
if
(
p_sys
->
abort
)
return
NULL
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment