Skip to content

Commit

Permalink
fix bug - song start time after end of file would cause no STOP indic…
Browse files Browse the repository at this point in the history
…ation to be sent
  • Loading branch information
blumamir committed Feb 14, 2020
1 parent d8a5700 commit 9bf9ba3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/alsa_frames_transfer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ namespace wavplayeralsa {
bool AlsaFramesTransfer::IsAlsaStatePlaying()
{
int status = snd_pcm_state(alsa_playback_handle_);
return (status == SND_PCM_STATE_RUNNING) || (status == SND_PCM_STATE_PREPARED);
// the code had SND_PCM_STATE_PREPARED as well.
// it is removed, to resolve issue of song start playing after end of file.
// the drain function would not finish since the status is 'SND_PCM_STATE_PREPARED'
// because no frames were sent to alsa.
return (status == SND_PCM_STATE_RUNNING); // || (status == SND_PCM_STATE_PREPARED);
}

void AlsaFramesTransfer::StartPlay(uint32_t position_in_ms, uint32_t play_seq_id)
Expand Down

0 comments on commit 9bf9ba3

Please sign in to comment.