mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-04-12 00:47:49 -04:00
playback: fix single mode briefly plays audio from the next track before pausing
Change-Id: Iab82427d5429210701e65103325f72c7919685e1
This commit is contained in:
parent
41567532a1
commit
c199d9a369
2 changed files with 21 additions and 10 deletions
|
|
@ -799,8 +799,10 @@ static void pcmbuf_pcm_callback(const void **start, size_t *size)
|
||||||
|
|
||||||
if (desc)
|
if (desc)
|
||||||
{
|
{
|
||||||
|
bool track_change = index == chunk_transidx;
|
||||||
|
|
||||||
/* If last chunk in the track, notify of track change */
|
/* If last chunk in the track, notify of track change */
|
||||||
if (index == chunk_transidx)
|
if (track_change)
|
||||||
{
|
{
|
||||||
chunk_transidx = INVALID_BUF_INDEX;
|
chunk_transidx = INVALID_BUF_INDEX;
|
||||||
audio_pcmbuf_track_change(true);
|
audio_pcmbuf_track_change(true);
|
||||||
|
|
@ -808,6 +810,13 @@ static void pcmbuf_pcm_callback(const void **start, size_t *size)
|
||||||
|
|
||||||
/* Free it for reuse */
|
/* Free it for reuse */
|
||||||
chunk_ridx = index = index_next(index);
|
chunk_ridx = index = index_next(index);
|
||||||
|
|
||||||
|
if (track_change && !audio_pcmbuf_may_play())
|
||||||
|
{
|
||||||
|
current_desc = NULL;
|
||||||
|
*size = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*- Process the new one -*/
|
/*- Process the new one -*/
|
||||||
|
|
|
||||||
|
|
@ -325,6 +325,7 @@ static unsigned int track_event_flags = TEF_NONE; /* (A, O-) */
|
||||||
static int skip_offset = 0; /* (A, O) */
|
static int skip_offset = 0; /* (A, O) */
|
||||||
|
|
||||||
static bool track_skip_is_manual = false;
|
static bool track_skip_is_manual = false;
|
||||||
|
static bool pause_on_track_change = false;
|
||||||
|
|
||||||
/* Track change notification */
|
/* Track change notification */
|
||||||
static struct
|
static struct
|
||||||
|
|
@ -1502,7 +1503,7 @@ static bool halt_decoding_track(bool stop)
|
||||||
|
|
||||||
codec_skip_pending = false;
|
codec_skip_pending = false;
|
||||||
codec_seeking = false;
|
codec_seeking = false;
|
||||||
|
pause_on_track_change = false;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2733,12 +2734,6 @@ static void audio_finalise_track_change(void)
|
||||||
{
|
{
|
||||||
buf_read_cuesheet(info.cuesheet_hid);
|
buf_read_cuesheet(info.cuesheet_hid);
|
||||||
track_id3 = bufgetid3(info.id3_hid);
|
track_id3 = bufgetid3(info.id3_hid);
|
||||||
|
|
||||||
if (single_mode_do_pause(info.id3_hid))
|
|
||||||
{
|
|
||||||
play_status = PLAY_PAUSED;
|
|
||||||
pcmbuf_pause(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Sync the next track information */
|
/* Sync the next track information */
|
||||||
have_info = track_list_current(1, &info);
|
have_info = track_list_current(1, &info);
|
||||||
|
|
@ -2934,8 +2929,9 @@ static void audio_on_codec_complete(int status)
|
||||||
int id3_hid = 0;
|
int id3_hid = 0;
|
||||||
if (audio_can_change_track(&trackstat, &id3_hid))
|
if (audio_can_change_track(&trackstat, &id3_hid))
|
||||||
{
|
{
|
||||||
|
pause_on_track_change = single_mode_do_pause(id3_hid);
|
||||||
audio_begin_track_change(
|
audio_begin_track_change(
|
||||||
single_mode_do_pause(id3_hid)
|
pause_on_track_change
|
||||||
? TRACK_CHANGE_END_OF_DATA
|
? TRACK_CHANGE_END_OF_DATA
|
||||||
: TRACK_CHANGE_AUTO, trackstat);
|
: TRACK_CHANGE_AUTO, trackstat);
|
||||||
}
|
}
|
||||||
|
|
@ -2954,6 +2950,12 @@ static void audio_on_codec_seek_complete(void)
|
||||||
(Q_AUDIO_TRACK_CHANGED) */
|
(Q_AUDIO_TRACK_CHANGED) */
|
||||||
static void audio_on_track_changed(void)
|
static void audio_on_track_changed(void)
|
||||||
{
|
{
|
||||||
|
if (pause_on_track_change)
|
||||||
|
{
|
||||||
|
play_status = PLAY_PAUSED;
|
||||||
|
pause_on_track_change = false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Finish whatever is pending so that the WPS is in sync */
|
/* Finish whatever is pending so that the WPS is in sync */
|
||||||
audio_finalise_track_change();
|
audio_finalise_track_change();
|
||||||
|
|
||||||
|
|
@ -3850,7 +3852,7 @@ void audio_pcmbuf_track_change(bool pcmbuf)
|
||||||
/* May pcmbuf start PCM playback when the buffer is full enough? */
|
/* May pcmbuf start PCM playback when the buffer is full enough? */
|
||||||
bool audio_pcmbuf_may_play(void)
|
bool audio_pcmbuf_may_play(void)
|
||||||
{
|
{
|
||||||
return play_status == PLAY_PLAYING && !ff_rw_mode;
|
return play_status == PLAY_PLAYING && !ff_rw_mode && !pause_on_track_change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue