Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
7c679214
Commit
7c679214
authored
Feb 23, 2017
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auhal: don't drop blocks if the circular buffer is full
Sleep a little and try again instead.
parent
43918c10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
modules/audio_output/auhal.c
modules/audio_output/auhal.c
+26
-4
No files found.
modules/audio_output/auhal.c
View file @
7c679214
...
...
@@ -1102,10 +1102,32 @@ Play(audio_output_t * p_aout, block_t * p_block)
}
/* move data to buffer */
if
(
unlikely
(
!
TPCircularBufferProduceBytes
(
&
p_sys
->
circular_buffer
,
p_block
->
p_buffer
,
p_block
->
i_buffer
)))
msg_Warn
(
p_aout
,
"dropped buffer"
);
while
(
!
TPCircularBufferProduceBytes
(
&
p_sys
->
circular_buffer
,
p_block
->
p_buffer
,
p_block
->
i_buffer
))
{
if
(
unlikely
(
p_block
->
i_buffer
>
(
uint32_t
)
p_sys
->
circular_buffer
.
length
))
{
msg_Err
(
p_aout
,
"the block is too big for the circular buffer"
);
assert
(
false
);
break
;
}
/* Wait for the render buffer to play the remaining data */
int32_t
i_avalaible_bytes
;
TPCircularBufferTail
(
&
p_sys
->
circular_buffer
,
&
i_avalaible_bytes
);
assert
(
i_avalaible_bytes
>=
0
);
if
(
unlikely
((
size_t
)
i_avalaible_bytes
>=
p_block
->
i_buffer
))
continue
;
int32_t
i_waiting_bytes
=
p_block
->
i_buffer
-
i_avalaible_bytes
;
const
mtime_t
i_frame_us
=
FramesToUs
(
p_sys
,
BytesToFrames
(
p_sys
,
i_waiting_bytes
));
/* Don't sleep less than 10ms */
msleep
(
__MAX
(
i_frame_us
,
10000
));
}
}
unsigned
i_underrun_size
=
atomic_exchange
(
&
p_sys
->
i_underrun_size
,
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