diff options
Diffstat (limited to 'apps/pcmbuf.c')
-rw-r--r-- | apps/pcmbuf.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index 6a8e2f2607..2d61f238b6 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c | |||
@@ -401,8 +401,6 @@ void pcmbuf_pause(bool pause) { | |||
401 | /* Force playback. */ | 401 | /* Force playback. */ |
402 | void pcmbuf_play_start(void) | 402 | void pcmbuf_play_start(void) |
403 | { | 403 | { |
404 | mutex_lock(&pcmbuf_mutex); | ||
405 | |||
406 | if (!pcm_is_playing() && pcmbuf_unplayed_bytes) | 404 | if (!pcm_is_playing() && pcmbuf_unplayed_bytes) |
407 | { | 405 | { |
408 | /** Prevent a very tiny pop from happening by muting audio | 406 | /** Prevent a very tiny pop from happening by muting audio |
@@ -417,8 +415,6 @@ void pcmbuf_play_start(void) | |||
417 | /* Now unmute the audio. */ | 415 | /* Now unmute the audio. */ |
418 | pcm_mute(false); | 416 | pcm_mute(false); |
419 | } | 417 | } |
420 | |||
421 | mutex_unlock(&pcmbuf_mutex); | ||
422 | } | 418 | } |
423 | 419 | ||
424 | /** | 420 | /** |
@@ -426,27 +422,22 @@ void pcmbuf_play_start(void) | |||
426 | */ | 422 | */ |
427 | static void pcmbuf_flush_fillpos(void) | 423 | static void pcmbuf_flush_fillpos(void) |
428 | { | 424 | { |
429 | mutex_lock(&pcmbuf_mutex); | ||
430 | |||
431 | if (audiobuffer_fillpos) { | 425 | if (audiobuffer_fillpos) { |
432 | /* Never use the last buffer descriptor */ | 426 | /* Never use the last buffer descriptor */ |
433 | while (pcmbuf_write == pcmbuf_write_end) { | 427 | while (pcmbuf_write == pcmbuf_write_end) { |
434 | logf("pcmbuf_flush_fillpos no descriptors"); | 428 | logf("pcmbuf_flush_fillpos no descriptors"); |
435 | /* Deboost to let the playback catchup */ | 429 | /* Deboost to let the playback catchup */ |
436 | pcmbuf_boost(false); | 430 | pcmbuf_boost(false); |
437 | /* Let someone else have fun in the meantime */ | 431 | /* If this happens, something is being stupid */ |
438 | sleep(1); | ||
439 | /* This is a fatal error situation that should never happen. */ | ||
440 | if (!pcm_is_playing()) { | 432 | if (!pcm_is_playing()) { |
441 | logf("pcmbuf_flush_fillpos error"); | 433 | logf("pcmbuf_flush_fillpos error"); |
442 | pcmbuf_play_start(); | 434 | pcmbuf_play_start(); |
443 | return ; | ||
444 | } | 435 | } |
436 | /* Let approximately one chunk of data playback */ | ||
437 | sleep(PCMBUF_TARGET_CHUNK/(NATIVE_FREQUENCY * 4) / 5); | ||
445 | } | 438 | } |
446 | pcmbuf_add_chunk(); | 439 | pcmbuf_add_chunk(); |
447 | } | 440 | } |
448 | |||
449 | mutex_unlock(&pcmbuf_mutex); | ||
450 | } | 441 | } |
451 | 442 | ||
452 | /** | 443 | /** |