Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
4ecdaabb
Commit
4ecdaabb
authored
Oct 24, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jack: partial writes to ring buffer
Don't wait until there is room for the full data chunk passed to jack_playAudio(). Try to incrementally send as much as possible into the ring buffer.
parent
91ad576a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
audioOutput_jack.c
src/audioOutputs/audioOutput_jack.c
+15
-15
No files found.
src/audioOutputs/audioOutput_jack.c
View file @
4ecdaabb
...
...
@@ -386,12 +386,10 @@ static int jack_playAudio(void *data,
const
char
*
buff
,
size_t
size
)
{
JackData
*
jd
=
data
;
size_t
space
;
size_t
i
;
size_t
space
,
space1
;
const
short
*
buffer
=
(
const
short
*
)
buff
;
static
const
size_t
frame_size
=
sizeof
(
*
buffer
)
*
2
;
jack_default_audio_sample_t
sample
;
size_t
samples
=
size
/
frame_size
;
/*DEBUG("jack_playAudio: (pid=%d)!\n", getpid());*/
...
...
@@ -402,14 +400,21 @@ static int jack_playAudio(void *data,
return
0
;
}
while
(
samples
&&
!
jd
->
shutdown
)
{
size
/=
frame_size
;
while
(
size
>
0
&&
!
jd
->
shutdown
)
{
space
=
jack_ringbuffer_write_space
(
jd
->
ringbuffer
[
0
]);
if
(
space
>=
samples
*
sample_size
)
{
/*space = MIN(space, samples*sample_size);*/
/*space = samples*sample_size;*/
/*for(i=0; i<space/sample_size; i++) {*/
for
(
i
=
0
;
i
<
samples
;
i
++
)
{
space1
=
jack_ringbuffer_write_space
(
jd
->
ringbuffer
[
1
]);
if
(
space
>
space1
)
/* send data symmetrically */
space
=
space1
;
space
/=
sample_size
;
if
(
space
>
0
)
{
if
(
space
>
size
)
space
=
size
;
size
-=
space
;
while
(
space
--
>
0
)
{
sample
=
(
jack_default_audio_sample_t
)
*
(
buffer
++
)
/
32768
.
0
;
jack_ringbuffer_write
(
jd
->
ringbuffer
[
0
],
(
void
*
)
&
sample
,
...
...
@@ -419,12 +424,7 @@ static int jack_playAudio(void *data,
jack_ringbuffer_write
(
jd
->
ringbuffer
[
1
],
(
void
*
)
&
sample
,
sample_size
);
/*samples--;*/
}
samples
=
0
;
}
else
{
pthread_mutex_lock
(
&
jd
->
play_audio_lock
);
pthread_cond_wait
(
&
jd
->
play_audio
,
...
...
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