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
110cfc0d
Commit
110cfc0d
authored
Dec 23, 2002
by
Arnaud de Bossoreille de Ribou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Little fixes.
parent
5ac588e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
30 deletions
+25
-30
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+25
-30
No files found.
modules/audio_output/alsa.c
View file @
110cfc0d
...
...
@@ -2,7 +2,7 @@
* alsa.c : alsa plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: alsa.c,v 1.1
6 2002/12/11 17:27:29
bozo Exp $
* $Id: alsa.c,v 1.1
7 2002/12/23 17:22:46
bozo Exp $
*
* Authors: Henri Fallon <henri@videolan.org> - Original Author
* Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API
...
...
@@ -53,7 +53,7 @@ struct aout_sys_t
{
snd_pcm_t
*
p_snd_pcm
;
int
i_period_time
;
mtime_t
grut
;
#ifdef DEBUG
snd_output_t
*
p_snd_stderr
;
#endif
...
...
@@ -522,8 +522,9 @@ static void Close( vlc_object_t *p_this )
struct
aout_sys_t
*
p_sys
=
p_aout
->
output
.
p_sys
;
int
i_snd_rc
;
p_aout
->
b_die
=
1
;
p_aout
->
b_die
=
VLC_TRUE
;
vlc_thread_join
(
p_aout
);
p_aout
->
b_die
=
VLC_FALSE
;
i_snd_rc
=
snd_pcm_close
(
p_sys
->
p_snd_pcm
);
...
...
@@ -557,7 +558,7 @@ static int ALSAThread( aout_instance_t * p_aout )
/* Why do we need to sleep ? --Meuuh */
/* Maybe because I don't want to eat all the cpu by looping
all the time. --Bozo */
msleep
(
p_sys
->
i_period_time
>>
2
);
msleep
(
p_sys
->
i_period_time
>>
1
);
}
return
0
;
...
...
@@ -574,6 +575,7 @@ static void ALSAFill( aout_instance_t * p_aout )
snd_pcm_status_t
*
p_status
;
snd_timestamp_t
ts_next
;
int
i_snd_rc
;
mtime_t
next_date
;
snd_pcm_status_alloca
(
&
p_status
);
...
...
@@ -629,39 +631,32 @@ static void ALSAFill( aout_instance_t * p_aout )
/* Here the device should be either in the RUNNING state either in
the PREPARE state. p_status is valid. */
if
(
1
)
{
mtime_t
next_date
;
snd_pcm_status_get_tstamp
(
p_status
,
&
ts_next
);
next_date
=
(
mtime_t
)
ts_next
.
tv_sec
*
1000000
+
ts_next
.
tv_usec
;
next_date
+=
(
mtime_t
)
snd_pcm_status_get_delay
(
p_status
)
*
1000000
/
p_aout
->
output
.
output
.
i_rate
;
snd_pcm_status_get_tstamp
(
p_status
,
&
ts_next
);
next_date
=
(
mtime_t
)
ts_next
.
tv_sec
*
1000000
+
ts_next
.
tv_usec
;
next_date
+=
(
mtime_t
)
snd_pcm_status_get_delay
(
p_status
)
*
1000000
/
p_aout
->
output
.
output
.
i_rate
;
p_buffer
=
aout_OutputNextBuffer
(
p_aout
,
next_date
,
p_buffer
=
aout_OutputNextBuffer
(
p_aout
,
next_date
,
(
p_aout
->
output
.
output
.
i_format
==
VLC_FOURCC
(
's'
,
'p'
,
'd'
,
'i'
))
);
/* Audio output buffer shortage -> stop the fill process and
wait in ALSAThread */
if
(
p_buffer
==
NULL
)
return
;
VLC_FOURCC
(
's'
,
'p'
,
'd'
,
'i'
))
);
i_snd_rc
=
snd_pcm_writei
(
p_sys
->
p_snd_pcm
,
p_buffer
->
p_buffer
,
p_buffer
->
i_nb_samples
);
/* Audio output buffer shortage -> stop the fill process and
wait in ALSAThread */
if
(
p_buffer
==
NULL
)
return
;
if
(
i_snd_rc
<
0
)
{
msg_Err
(
p_aout
,
"write failed (%s)"
,
snd_strerror
(
i_snd_rc
)
);
}
i_snd_rc
=
snd_pcm_writei
(
p_sys
->
p_snd_pcm
,
p_buffer
->
p_buffer
,
p_buffer
->
i_nb_samples
);
aout_BufferFree
(
p_buffer
);
}
else
if
(
i_snd_rc
<
0
)
{
/* Don't eat all the CPU. We will try to write later. */
return
;
msg_Err
(
p_aout
,
"write failed (%s)"
,
snd_strerror
(
i_snd_rc
)
)
;
}
aout_BufferFree
(
p_buffer
);
msleep
(
p_sys
->
i_period_time
>>
2
);
}
}
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