mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-04-28 12:17:57 +03:00
AudioTrack: recover underruns properly
This commit is contained in:
parent
57dd86fc98
commit
e6a22df315
1 changed files with 3 additions and 1 deletions
|
@ -238,7 +238,9 @@ JNIEXPORT jint JNICALL Java_android_media_AudioTrack_native_1write(JNIEnv *env,
|
|||
if (ret < 0) {
|
||||
if (ret == -EPIPE) {
|
||||
printf("XRUN.\n");
|
||||
snd_pcm_prepare(pcm_handle);
|
||||
snd_pcm_recover(pcm_handle, ret, 0);
|
||||
ret = frames_written = snd_pcm_writei(pcm_handle, buffer + offset_in_bytes, frames_to_write);
|
||||
snd_pcm_start(pcm_handle);
|
||||
} else {
|
||||
printf("ERROR. Can't write to PCM device. %s\n", snd_strerror(ret));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue