Annotation of /trunk/xine-lib/patches/xine-lib-1.1.1-novell--alsa-resume-fix.patch
Parent Directory | Revision Log
Revision 153 -
(hide annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 1563 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 1563 byte(s)
-import
1 | niro | 153 | Index: xine-lib-1.1.1/src/audio_out/audio_alsa_out.c |
2 | =================================================================== | ||
3 | --- xine-lib-1.1.1.orig/src/audio_out/audio_alsa_out.c | ||
4 | +++ xine-lib-1.1.1/src/audio_out/audio_alsa_out.c | ||
5 | @@ -719,6 +719,19 @@ static void xrun(alsa_driver_t *this) | ||
6 | #endif | ||
7 | |||
8 | /* | ||
9 | + * resume from suspend | ||
10 | + */ | ||
11 | +static int resume(snd_pcm_t *pcm) | ||
12 | +{ | ||
13 | + int res; | ||
14 | + while ((res = snd_pcm_resume(pcm)) == -EAGAIN) | ||
15 | + sleep(1); | ||
16 | + if (! res) | ||
17 | + return 0; | ||
18 | + return snd_pcm_prepare(pcm); | ||
19 | +} | ||
20 | + | ||
21 | +/* | ||
22 | * Write audio data to output buffer (blocking using snd_pcm_wait) | ||
23 | */ | ||
24 | static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { | ||
25 | @@ -742,6 +755,12 @@ static int ao_alsa_write(ao_driver_t *th | ||
26 | #endif | ||
27 | snd_pcm_status_alloca(&pcm_stat); | ||
28 | state = snd_pcm_state(this->audio_fd); | ||
29 | + if (state == SND_PCM_STATE_SUSPENDED) { | ||
30 | + res = resume(this->audio_fd); | ||
31 | + if (res < 0) | ||
32 | + return 0; | ||
33 | + state = snd_pcm_state(this->audio_fd); | ||
34 | + } | ||
35 | if (state == SND_PCM_STATE_XRUN) { | ||
36 | #ifdef LOG_DEBUG | ||
37 | printf("audio_alsa_out:write:XRUN before\n"); | ||
38 | @@ -791,6 +810,12 @@ static int ao_alsa_write(ao_driver_t *th | ||
39 | printf("audio_alsa_out:write:result=%ld:%s\n",result, snd_strerror(result)); | ||
40 | #endif | ||
41 | state = snd_pcm_state(this->audio_fd); | ||
42 | + if (state == SND_PCM_STATE_SUSPENDED) { | ||
43 | + res = resume(this->audio_fd); | ||
44 | + if (res < 0) | ||
45 | + return 0; | ||
46 | + continue; | ||
47 | + } | ||
48 | if ( (state != SND_PCM_STATE_PREPARED) && | ||
49 | (state != SND_PCM_STATE_RUNNING) && | ||
50 | (state != SND_PCM_STATE_DRAINING) ) { |