mirror of https://github.com/odrling/Aegisub
Applied p-static's patch for ALSA
Originally committed to SVN as r1654.
This commit is contained in:
parent
1cf34a15e7
commit
e288aa6897
|
@ -419,6 +419,11 @@ void AlsaPlayer::async_write_handler(snd_async_handler_t *pcm_callback)
|
||||||
|
|
||||||
snd_pcm_sframes_t frames = snd_pcm_avail_update(player->pcm_handle);
|
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
|
// TODO: handle underrun
|
||||||
|
|
||||||
if (player->cur_frame >= player->end_frame) {
|
if (player->cur_frame >= player->end_frame) {
|
||||||
|
@ -434,7 +439,10 @@ void AlsaPlayer::async_write_handler(snd_async_handler_t *pcm_callback)
|
||||||
while (frames >= player->period) {
|
while (frames >= player->period) {
|
||||||
unsigned long start = player->cur_frame;
|
unsigned long start = player->cur_frame;
|
||||||
player->provider->GetAudioWithVolume(buf, player->cur_frame, player->period, player->volume);
|
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;
|
player->cur_frame += player->period;
|
||||||
frames = snd_pcm_avail_update(player->pcm_handle);
|
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 New Issue