Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
439
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
a5e5e641
Commit
a5e5e641
authored
2 years ago
by
KO Myung-Hun
Committed by
Jean-Baptiste Kempf
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
kai: make it non-blocking
Fixes
#27543
.
parent
7ec9e48d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2892
make kai non-blocking
Pipeline
#289642
passed with stage
in 16 minutes and 48 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/audio_output/kai.c
+25
-9
25 additions, 9 deletions
modules/audio_output/kai.c
with
25 additions
and
9 deletions
modules/audio_output/kai.c
+
25
−
9
View file @
a5e5e641
...
...
@@ -47,7 +47,6 @@ struct audio_buffer_t
int
length
;
int
size
;
vlc_mutex_t
mutex
;
vlc_cond_t
cond
;
};
typedef
struct
audio_buffer_t
audio_buffer_t
;
...
...
@@ -356,7 +355,6 @@ static int CreateBuffer( audio_output_t *aout, int size )
buffer
->
size
=
size
;
vlc_mutex_init
(
&
buffer
->
mutex
);
vlc_cond_init
(
&
buffer
->
cond
);
aout_sys_t
*
sys
=
aout
->
sys
;
sys
->
buffer
=
buffer
;
...
...
@@ -401,8 +399,6 @@ static int ReadBuffer( audio_output_t *aout, uint8_t *data, int size )
buffer
->
length
-=
len
;
vlc_cond_signal
(
&
buffer
->
cond
);
vlc_mutex_unlock
(
&
buffer
->
mutex
);
return
len
;
...
...
@@ -417,11 +413,31 @@ static int WriteBuffer( audio_output_t *aout, uint8_t *data, int size )
vlc_mutex_lock
(
&
buffer
->
mutex
);
/* FIXME :
* If size is larger than buffer->size, this is locked indefinitely.
*/
while
(
buffer
->
length
+
size
>
buffer
->
size
)
vlc_cond_wait
(
&
buffer
->
cond
,
&
buffer
->
mutex
);
if
(
buffer
->
length
+
size
>
buffer
->
size
)
{
int
delta
=
AUDIO_BUFFER_SIZE_IN_SECONDS
*
sys
->
format
.
i_rate
*
sys
->
format
.
i_bytes_per_frame
;
int
new_size
=
((
buffer
->
length
+
size
+
delta
-
1
)
/
delta
)
*
delta
;
uint8_t
*
p
;
msg_Dbg
(
aout
,
"Trying to enlarge audio buffer: "
"buffer length = %d, buffer size = %d, "
"block size = %d, new buffer size = %d"
,
buffer
->
length
,
buffer
->
size
,
size
,
new_size
);
p
=
realloc
(
buffer
->
data
,
new_size
);
if
(
unlikely
(
p
==
NULL
))
{
msg_Err
(
aout
,
"Enlarging audio buffer failed! Drop a block!"
);
return
0
;
}
buffer
->
data
=
p
;
buffer
->
size
=
new_size
;
}
len
=
size
;
if
(
buffer
->
write_pos
+
len
>
buffer
->
size
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment