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
89d23df7
Commit
89d23df7
authored
Apr 02, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: correct S/PDIF start timing (fixes #6565)
This is completely untested, but it seems logical.
parent
d521b25d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+20
-12
No files found.
modules/audio_output/alsa.c
View file @
89d23df7
...
@@ -580,22 +580,30 @@ static void Play (audio_output_t *aout, block_t *block)
...
@@ -580,22 +580,30 @@ static void Play (audio_output_t *aout, block_t *block)
if
(
state
!=
SND_PCM_STATE_RUNNING
)
if
(
state
!=
SND_PCM_STATE_RUNNING
)
{
{
delay
=
block
->
i_pts
-
(
mdate
()
+
delay
);
delay
=
block
->
i_pts
-
(
mdate
()
+
delay
);
if
(
delay
>
0
&&
aout
->
format
.
i_format
!=
VLC_CODEC_SPDIFL
)
if
(
delay
>
0
)
{
{
frames
=
(
delay
*
aout
->
format
.
i_rate
)
/
CLOCK_FREQ
;
if
(
aout
->
format
.
i_format
!=
VLC_CODEC_SPDIFL
)
msg_Dbg
(
aout
,
"prepending %ld zeroes"
,
frames
);
{
frames
=
(
delay
*
aout
->
format
.
i_rate
)
/
CLOCK_FREQ
;
void
*
pad
=
calloc
(
frames
,
aout
->
format
.
i_bytes_per_frame
);
msg_Dbg
(
aout
,
"prepending %ld zeroes"
,
frames
);
if
(
likely
(
pad
!=
NULL
))
void
*
z
=
calloc
(
frames
,
aout
->
format
.
i_bytes_per_frame
);
if
(
likely
(
z
!=
NULL
))
{
snd_pcm_writei
(
pcm
,
z
,
frames
);
free
(
z
);
delay
=
0
;
}
}
/* Lame fallback if zero padding does not work */
if
(
delay
>
0
)
{
{
snd_pcm_writei
(
pcm
,
pad
,
frames
);
msg_Dbg
(
aout
,
"deferring start (%"
PRId64
" us)"
,
delay
);
free
(
pad
);
msleep
(
delay
);
delay
=
0
;
}
}
}
}
/* Lame fallback if zero padding does not work */
else
if
(
delay
>
0
)
msg_Dbg
(
aout
,
"starting late (%"
PRId64
" us)"
,
delay
);
mwait
(
block
->
i_pts
-
delay
);
}
}
else
else
aout_TimeReport
(
aout
,
block
->
i_pts
-
delay
);
aout_TimeReport
(
aout
,
block
->
i_pts
-
delay
);
...
...
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