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
38d91b7f
Commit
38d91b7f
authored
Nov 03, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: get PCM delay and state in a single system call
parent
f6c755c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+11
-4
No files found.
modules/audio_output/alsa.c
View file @
38d91b7f
...
...
@@ -553,15 +553,20 @@ static void Play (audio_output_t *aout, block_t *block,
sys
->
format
.
i_bitspersample
/
8
);
snd_pcm_t
*
pcm
=
sys
->
pcm
;
snd_pcm_s
frames_t
frame
s
;
snd_pcm_state_t
state
=
snd_pcm_state
(
pcm
)
;
snd_pcm_s
tatus_t
*
statu
s
;
int
val
;
if
(
snd_pcm_delay
(
pcm
,
&
frames
)
==
0
)
snd_pcm_status_alloca
(
&
status
);
val
=
snd_pcm_status
(
pcm
,
status
);
if
(
val
<
0
)
msg_Err
(
aout
,
"cannot get status: %s"
,
snd_strerror
(
val
));
else
{
snd_pcm_sframes_t
frames
=
snd_pcm_status_get_delay
(
status
);
mtime_t
delay
=
frames
*
CLOCK_FREQ
/
sys
->
format
.
i_rate
;
delay
+=
mdate
()
-
block
->
i_pts
;
if
(
s
tate
!=
SND_PCM_STATE_RUNNING
)
if
(
s
nd_pcm_status_get_state
(
status
)
!=
SND_PCM_STATE_RUNNING
)
{
if
(
delay
<
0
)
{
...
...
@@ -597,6 +602,8 @@ static void Play (audio_output_t *aout, block_t *block,
while
(
block
->
i_nb_samples
>
0
)
{
snd_pcm_sframes_t
frames
;
frames
=
snd_pcm_writei
(
pcm
,
block
->
p_buffer
,
block
->
i_nb_samples
);
if
(
frames
>=
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