Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
d68da462
Commit
d68da462
authored
Dec 03, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevice: fix thread initialization and cleanup
parent
dffdc4c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
modules/audio_output/mmdevice.c
modules/audio_output/mmdevice.c
+15
-6
No files found.
modules/audio_output/mmdevice.c
View file @
d68da462
...
...
@@ -85,8 +85,8 @@ struct aout_sys_t
CONDITION_VARIABLE
request_wait
;
CONDITION_VARIABLE
reply_wait
;
bool
active
;
/**< Flag to request thread to keep running
*/
bool
running
;
/**< Whether the thread is
still
running */
bool
killed
;
/**< Flag to terminate the thread
*/
bool
running
;
/**< Whether the thread is running */
int8_t
mute
;
/**< Requested mute state or negative value */
float
volume
;
/**< Requested volume or negative value */
};
...
...
@@ -439,7 +439,10 @@ static void MMThread(void *data)
msg_Err
(
aout
,
"cannot get simple volume (error 0x%lx)"
,
hr
);
EnterCriticalSection
(
&
sys
->
lock
);
while
(
sys
->
active
)
sys
->
running
=
true
;
WakeConditionVariable
(
&
sys
->
reply_wait
);
while
(
!
sys
->
killed
)
{
/* Update volume */
if
(
sys
->
volume
>=
0
.
f
)
...
...
@@ -471,6 +474,7 @@ static void MMThread(void *data)
&
sys
->
session_events
);
IAudioSessionControl_Release
(
control
);
}
Leave
();
EnterCriticalSection
(
&
sys
->
lock
);
sys
->
running
=
false
;
...
...
@@ -526,8 +530,8 @@ static int Open(vlc_object_t *obj)
InitializeCriticalSection
(
&
sys
->
lock
);
InitializeConditionVariable
(
&
sys
->
request_wait
);
InitializeConditionVariable
(
&
sys
->
reply_wait
);
sys
->
active
=
tru
e
;
sys
->
running
=
tru
e
;
sys
->
killed
=
fals
e
;
sys
->
running
=
fals
e
;
sys
->
volume
=
-
1
.
f
;
sys
->
mute
=
-
1
;
...
...
@@ -575,6 +579,11 @@ static int Open(vlc_object_t *obj)
/* Note: thread handle released by CRT, ignore it. */
if
(
_beginthread
(
MMThread
,
0
,
aout
)
==
(
uintptr_t
)
-
1
)
goto
error
;
EnterCriticalSection
(
&
sys
->
lock
);
while
(
!
sys
->
running
)
SleepConditionVariableCS
(
&
sys
->
reply_wait
,
&
sys
->
lock
,
INFINITE
);
LeaveCriticalSection
(
&
sys
->
lock
);
Leave
();
aout
->
sys
=
sys
;
...
...
@@ -606,7 +615,7 @@ static void Close(vlc_object_t *obj)
aout_sys_t
*
sys
=
aout
->
sys
;
EnterCriticalSection
(
&
sys
->
lock
);
sys
->
active
=
fals
e
;
sys
->
killed
=
tru
e
;
WakeConditionVariable
(
&
sys
->
request_wait
);
while
(
sys
->
running
)
SleepConditionVariableCS
(
&
sys
->
reply_wait
,
&
sys
->
lock
,
INFINITE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment