forked from mia/Aegisub
Applied p-static's patch for ALSA
Originally committed to SVN as r1654.
This commit is contained in:
parent
1cf34a15e7
commit
e288aa6897
1 changed files with 10 additions and 1 deletions
|
@ -418,6 +418,11 @@ void AlsaPlayer::async_write_handler(snd_async_handler_t *pcm_callback)
|
|||
}
|
||||
|
||||
snd_pcm_sframes_t frames = snd_pcm_avail_update(player->pcm_handle);
|
||||
|
||||
if (frames == -EPIPE) {
|
||||
snd_pcm_prepare(player->pcm_handle);
|
||||
frames = snd_pcm_avail_update(player->pcm_handle);
|
||||
}
|
||||
|
||||
// TODO: handle underrun
|
||||
|
||||
|
@ -434,7 +439,10 @@ void AlsaPlayer::async_write_handler(snd_async_handler_t *pcm_callback)
|
|||
while (frames >= player->period) {
|
||||
unsigned long start = player->cur_frame;
|
||||
player->provider->GetAudioWithVolume(buf, player->cur_frame, player->period, player->volume);
|
||||
snd_pcm_writei(player->pcm_handle, buf, player->period);
|
||||
int err = snd_pcm_writei(player->pcm_handle, buf, player->period);
|
||||
if(err == -EPIPE) {
|
||||
snd_pcm_prepare(player->pcm_handle);
|
||||
}
|
||||
player->cur_frame += player->period;
|
||||
frames = snd_pcm_avail_update(player->pcm_handle);
|
||||
}
|
||||
|
@ -443,3 +451,4 @@ void AlsaPlayer::async_write_handler(snd_async_handler_t *pcm_callback)
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue