diff options
author | Thibaut Mattern <thibaut.mattern@gmail.com> | 2007-04-05 13:07:13 +0200 |
---|---|---|
committer | Thibaut Mattern <thibaut.mattern@gmail.com> | 2007-04-05 13:07:13 +0200 |
commit | 66f1aca41a4ff7668e5c21f59c3b2170d3d265e7 (patch) | |
tree | 0d4be90c36f89347f9165e27898b1959298ff8c0 | |
parent | f5dc5087a79d813259a674bd96ba4dea43fb254c (diff) | |
download | xine-lib-66f1aca41a4ff7668e5c21f59c3b2170d3d265e7.tar.gz xine-lib-66f1aca41a4ff7668e5c21f59c3b2170d3d265e7.tar.bz2 |
Fixed current audio sync, delay was always 0.
Checked snd_pcm_delay return code, and don't trust negative values.
-rw-r--r-- | src/audio_out/audio_alsa_out.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 3651d21da..f176b7594 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -663,15 +663,7 @@ static int ao_alsa_delay (ao_driver_t *this_gen) { struct timeval now; printf("audio_alsa_out:delay:ENTERED\n"); #endif - err=snd_pcm_delay( this->audio_fd, &delay ); - - int state = snd_pcm_state(this->audio_fd); - - /* check for idle states, which need to be handled as delay=0 */ - if(state == SND_PCM_STATE_PREPARED || state == SND_PCM_STATE_PAUSED || - state == SND_PCM_STATE_OPEN || SND_PCM_STATE_XRUN) { - return 0; - } + err = snd_pcm_delay( this->audio_fd, &delay ); #ifdef LOG_DEBUG printf("audio_alsa_out:delay:delay all=%ld err=%d\n",delay, err); @@ -679,8 +671,11 @@ static int ao_alsa_delay (ao_driver_t *this_gen) { printf("audio_alsa_out:delay: Time = %ld.%ld\n", now.tv_sec, now.tv_usec); printf("audio_alsa_out:delay:FINISHED\n"); #endif - return delay; + if (err || (delay < 0)) + delay = 0; + + return delay; } #if 0 |