[vlc-commits] audiotrack: wait more when internal buffer is full
Thomas Guillem
git at videolan.org
Thu Mar 5 19:05:56 CET 2015
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar 5 19:03:32 2015 +0100| [8770588670798b80daa16be57f830fed69d40791] | committer: Jean-Baptiste Kempf
audiotrack: wait more when internal buffer is full
Less CPU usage.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8770588670798b80daa16be57f830fed69d40791
---
modules/audio_output/audiotrack.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index 42b2d35..a8eb020 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -808,8 +808,11 @@ JNIThread_Play( JNIEnv *env, audio_output_t *p_aout,
msg_Err( p_aout, "Write failed: %s", str );
}
} else if( i_ret == 0 )
- *p_wait = FRAMES_TO_US( p_buffer->i_nb_samples );
- else
+ {
+ /* audiotrack internal buffer is full, wait a little: between 10ms and
+ * 20ms depending on devices or rate */
+ *p_wait = FRAMES_TO_US( p_sys->i_max_audiotrack_samples / 20 );
+ } else
{
uint32_t i_samples = i_ret / p_sys->i_bytes_per_frame;
p_sys->i_samples_queued -= i_samples;
More information about the vlc-commits
mailing list