Skip to content

Commit

Permalink
snd_pcm_recover() now supports underrun
Browse files Browse the repository at this point in the history
  • Loading branch information
clementgallet committed Nov 19, 2021
1 parent f26c9fc commit 166d472
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Support binding keys to mouse buttons
* Add a toggle fast-forward hotkey
* Implements alGetString() (#447)
* snd_pcm_recover() now supports underrun

### Changed
### Fixed
Expand Down
13 changes: 12 additions & 1 deletion src/library/audio/alsa/pcm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,18 @@ int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
}

DEBUGLOGCALL(LCF_SOUND);
return 0;

if (err == -EPIPE) {
int sourceId = reinterpret_cast<intptr_t>(pcm);
auto source = audiocontext.getSource(sourceId);

if (source->state == AudioSource::SOURCE_UNDERRUN)
source->state = AudioSource::SOURCE_PREPARED;

return 0;
}

return err;
}

int snd_pcm_reset(snd_pcm_t *pcm)
Expand Down

0 comments on commit 166d472

Please sign in to comment.