diff options
Diffstat (limited to 'apps/pcmbuf.c')
-rw-r--r-- | apps/pcmbuf.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index 6e2c51c80a..773e97cce0 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c | |||
@@ -204,6 +204,13 @@ extern void audio_pcmbuf_sync_position(void); | |||
204 | 204 | ||
205 | /**************************************/ | 205 | /**************************************/ |
206 | 206 | ||
207 | /* start PCM if callback says it's alright */ | ||
208 | static void start_audio_playback(void) | ||
209 | { | ||
210 | if (audio_pcmbuf_may_play()) | ||
211 | pcmbuf_play_start(); | ||
212 | } | ||
213 | |||
207 | /* Return number of commited bytes in buffer (committed chunks count as | 214 | /* Return number of commited bytes in buffer (committed chunks count as |
208 | a full chunk even if only partially filled) */ | 215 | a full chunk even if only partially filled) */ |
209 | static size_t pcmbuf_unplayed_bytes(void) | 216 | static size_t pcmbuf_unplayed_bytes(void) |
@@ -492,8 +499,8 @@ void * pcmbuf_request_buffer(int *count) | |||
492 | trigger_cpu_boost(); | 499 | trigger_cpu_boost(); |
493 | 500 | ||
494 | /* If pre-buffered to the watermark, start playback */ | 501 | /* If pre-buffered to the watermark, start playback */ |
495 | if (!pcmbuf_data_critical() && audio_pcmbuf_may_play()) | 502 | if (!pcmbuf_data_critical()) |
496 | pcmbuf_play_start(); | 503 | start_audio_playback(); |
497 | } | 504 | } |
498 | 505 | ||
499 | void *buf; | 506 | void *buf; |
@@ -672,15 +679,22 @@ void pcmbuf_monitor_track_change(bool monitor) | |||
672 | 679 | ||
673 | void pcmbuf_start_track_change(enum pcm_track_change_type type) | 680 | void pcmbuf_start_track_change(enum pcm_track_change_type type) |
674 | { | 681 | { |
682 | /* Commit all outstanding data before starting next track - tracks don't | ||
683 | comingle inside a single buffer chunk */ | ||
684 | commit_if_needed(COMMIT_ALL_DATA); | ||
685 | |||
686 | if (type == TRACK_CHANGE_AUTO_PILEUP) | ||
687 | { | ||
688 | /* Fill might not have been above watermark */ | ||
689 | start_audio_playback(); | ||
690 | return; | ||
691 | } | ||
692 | |||
675 | #ifdef HAVE_CROSSFADE | 693 | #ifdef HAVE_CROSSFADE |
676 | bool crossfade = false; | 694 | bool crossfade = false; |
677 | #endif | 695 | #endif |
678 | bool auto_skip = type != TRACK_CHANGE_MANUAL; | 696 | bool auto_skip = type != TRACK_CHANGE_MANUAL; |
679 | 697 | ||
680 | /* Commit all outstanding data before starting next track - tracks don't | ||
681 | comingle inside a single buffer chunk */ | ||
682 | commit_if_needed(COMMIT_ALL_DATA); | ||
683 | |||
684 | /* Update position key so that: | 698 | /* Update position key so that: |
685 | 1) Positions are keyed to the track to which they belong for sync | 699 | 1) Positions are keyed to the track to which they belong for sync |
686 | purposes | 700 | purposes |
@@ -695,9 +709,8 @@ void pcmbuf_start_track_change(enum pcm_track_change_type type) | |||
695 | { | 709 | { |
696 | crossfade_cancel(); | 710 | crossfade_cancel(); |
697 | 711 | ||
698 | /* If end of all data, force playback */ | 712 | /* Fill might not have been above watermark */ |
699 | if (audio_pcmbuf_may_play()) | 713 | start_audio_playback(); |
700 | pcmbuf_play_start(); | ||
701 | } | 714 | } |
702 | #ifdef HAVE_CROSSFADE | 715 | #ifdef HAVE_CROSSFADE |
703 | /* Determine whether this track change needs to crossfaded and how */ | 716 | /* Determine whether this track change needs to crossfaded and how */ |