Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
741f1682
Commit
741f1682
authored
Jan 08, 2006
by
Cyril Deguet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* jack.c: better handling of buffer underruns
parent
40749893
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
20 deletions
+27
-20
modules/audio_output/jack.c
modules/audio_output/jack.c
+27
-20
No files found.
modules/audio_output/jack.c
View file @
741f1682
...
...
@@ -90,7 +90,7 @@ static int Open( vlc_object_t *p_this )
p_aout
->
output
.
p_sys
=
p_sys
;
/* Connect to the JACK server */
p_sys
->
p_jack_client
=
jack_client_new
(
"
VLC Media Player
"
);
p_sys
->
p_jack_client
=
jack_client_new
(
"
vlc
"
);
if
(
p_sys
->
p_jack_client
==
NULL
)
{
msg_Err
(
p_aout
,
"Failed to connect to JACK server"
);
...
...
@@ -116,7 +116,7 @@ static int Open( vlc_object_t *p_this )
for
(
i
=
0
;
i
<
p_sys
->
i_channels
;
i
++
)
{
char
p_name
[
32
];
snprintf
(
p_name
,
32
,
"channel
%d"
,
i
);
snprintf
(
p_name
,
32
,
"channel
_%d"
,
i
+
1
);
p_sys
->
p_jack_port
[
i
]
=
jack_port_register
(
p_sys
->
p_jack_client
,
p_name
,
JACK_DEFAULT_AUDIO_TYPE
,
JackPortIsOutput
,
0
);
...
...
@@ -187,14 +187,17 @@ int Process( jack_nframes_t i_frames, void *p_arg )
{
aout_buffer_t
*
p_buffer
;
jack_default_audio_sample_t
*
p_jack_buffer
;
unsigned
int
i
,
j
;
unsigned
int
i
,
j
,
i_nb_samples
=
0
;
aout_instance_t
*
p_aout
=
(
aout_instance_t
*
)
p_arg
;
/* Get the next audio data buffer */
p_buffer
=
aout_FifoPop
(
p_aout
,
&
p_aout
->
output
.
fifo
);
if
(
p_buffer
!=
NULL
)
if
(
p_buffer
)
{
i_nb_samples
=
p_buffer
->
i_nb_samples
;
}
for
(
i
=
0
;
i
<
p_aout
->
output
.
p_sys
->
i_channels
;
i
++
)
{
/* Get an output buffer from JACK */
...
...
@@ -202,19 +205,23 @@ int Process( jack_nframes_t i_frames, void *p_arg )
p_aout
->
output
.
p_sys
->
p_jack_port
[
i
],
i_frames
);
/* Fill the buffer with audio data */
for
(
j
=
0
;
j
<
p_buffer
->
i_nb_samples
;
j
++
)
for
(
j
=
0
;
j
<
i_nb_samples
;
j
++
)
{
p_jack_buffer
[
j
]
=
((
float
*
)
p_buffer
->
p_buffer
)[
2
*
j
+
i
];
}
if
(
p_buffer
->
i_nb_samples
<
i_frames
)
if
(
i_nb_samples
<
i_frames
)
{
msg_Warn
(
p_aout
,
"Buffer underrun (%d)"
,
i_frames
-
p_buffer
->
i_nb_samples
);
memset
(
p_jack_buffer
+
j
,
0
,
i_frames
-
p_buffer
->
i_nb_samples
);
memset
(
p_jack_buffer
+
i_nb_samples
,
0
,
sizeof
(
jack_default_audio_sample_t
)
*
(
i_frames
-
i_nb_samples
)
);
}
}
if
(
p_buffer
)
{
aout_BufferFree
(
p_buffer
);
}
return
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