Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
35c8e86d
Commit
35c8e86d
authored
Nov 05, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a few minor race conditions
parent
03f87d80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
+16
-19
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+16
-19
No files found.
modules/audio_output/alsa.c
View file @
35c8e86d
...
...
@@ -755,23 +755,23 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/
static
int
ALSAThread
(
aout_instance_t
*
p_aout
)
{
p_aout
->
output
.
p_sys
->
p_status
=
(
snd_pcm_status_t
*
)
malloc
(
snd_pcm_status_sizeof
());
struct
aout_sys_t
*
p_sys
=
p_aout
->
output
.
p_sys
;
p_sys
->
p_status
=
(
snd_pcm_status_t
*
)
malloc
(
snd_pcm_status_sizeof
());
/* Wait for the exact time to start playing (avoids resampling) */
vlc_mutex_lock
(
&
p_aout
->
output
.
p_sys
->
lock
);
if
(
!
p_aout
->
output
.
p_sys
->
start_date
)
vlc_cond_wait
(
&
p_aout
->
output
.
p_sys
->
wait
,
&
p_aout
->
output
.
p_sys
->
lock
);
vlc_mutex_unlock
(
&
p_aout
->
output
.
p_sys
->
lock
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
while
(
!
p_sys
->
start_date
)
vlc_cond_wait
(
&
p_sys
->
wait
,
&
p_sys
->
lock
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
mwait
(
p_
aout
->
output
.
p_
sys
->
start_date
-
AOUT_PTS_TOLERANCE
/
4
);
mwait
(
p_sys
->
start_date
-
AOUT_PTS_TOLERANCE
/
4
);
while
(
!
p_aout
->
b_die
)
{
ALSAFill
(
p_aout
);
}
snd_pcm_drop
(
p_sys
->
p_snd_pcm
);
free
(
p_aout
->
output
.
p_sys
->
p_status
);
return
0
;
}
...
...
@@ -871,12 +871,15 @@ static void ALSAFill( aout_instance_t * p_aout )
return
;
}
i_snd_rc
=
snd_pcm_writei
(
p_sys
->
p_snd_pcm
,
p_buffer
->
p_buffer
,
p_buffer
->
i_nb_samples
);
for
(;;)
{
i_snd_rc
=
snd_pcm_writei
(
p_sys
->
p_snd_pcm
,
p_buffer
->
p_buffer
,
p_buffer
->
i_nb_samples
);
if
(
i_snd_rc
!=
-
ESTRPIPE
)
break
;
if
(
i_snd_rc
==
-
ESTRPIPE
)
{
/* a suspend event occurred
* (stream is suspended and waiting for an application recovery) */
/* a suspend event occurred
* (stream is suspended and waiting for an application recovery) */
msg_Dbg
(
p_aout
,
"entering in suspend mode, trying to resume..."
);
while
(
!
p_aout
->
b_die
&&
!
p_aout
->
p_libvlc
->
b_die
&&
...
...
@@ -886,12 +889,6 @@ static void ALSAFill( aout_instance_t * p_aout )
if
(
i_snd_rc
<
0
)
/* Device does not supprot resuming, restart it */
i_snd_rc
=
snd_pcm_prepare
(
p_sys
->
p_snd_pcm
);
if
(
i_snd_rc
==
0
)
i_snd_rc
=
snd_pcm_writei
(
p_sys
->
p_snd_pcm
,
p_buffer
->
p_buffer
,
p_buffer
->
i_nb_samples
);
}
if
(
i_snd_rc
<
0
)
...
...
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