[MPlayer-cvslog] CVS: main/libao2 ao_alsa.c,1.26,1.27
Clemens Ladisch CVS
syncmail at mplayerhq.hu
Fri Feb 10 10:21:20 CET 2006
CVS change done by Clemens Ladisch CVS
Update of /cvsroot/mplayer/main/libao2
In directory mail:/var2/tmp/cvs-serv14294/libao2
Modified Files:
ao_alsa.c
Log Message:
Fix get_space(): we don't need to differentiate between the various PCM
device states, and there is no need to avoid returning a positive value
less than 1024.
Index: ao_alsa.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_alsa.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- ao_alsa.c 10 Feb 2006 09:20:08 -0000 1.26
+++ ao_alsa.c 10 Feb 2006 09:21:17 -0000 1.27
@@ -64,8 +64,6 @@
static int alsa_fragcount = 16;
static snd_pcm_uframes_t chunk_size = 1024;//is alsa_fragsize / 4
-#define MIN_CHUNK_SIZE 1024
-
static size_t bits_per_sample, bytes_per_sample, bits_per_frame;
static size_t chunk_bytes;
@@ -1021,9 +1019,6 @@
{
snd_pcm_status_t *status;
int ret;
- char *str_status;
-
- //snd_pcm_sframes_t avail_frames = 0;
snd_pcm_status_alloca(&status);
@@ -1033,56 +1028,9 @@
return(0);
}
- switch(snd_pcm_status_get_state(status))
- {
- case SND_PCM_STATE_OPEN:
- str_status = "open";
- ret = snd_pcm_status_get_avail(status) * bytes_per_sample;
- break;
- case SND_PCM_STATE_PREPARED:
- str_status = "prepared";
- first = 1;
- ret = snd_pcm_status_get_avail(status) * bytes_per_sample;
- if (ret == 0) //ugly workaround for hang in mmap-mode
- ret = 10;
- break;
- case SND_PCM_STATE_RUNNING:
- ret = snd_pcm_status_get_avail(status) * bytes_per_sample;
- //avail_frames = snd_pcm_avail_update(alsa_handler) * bytes_per_sample;
- if (str_status != "open" && str_status != "prepared")
- str_status = "running";
- break;
- case SND_PCM_STATE_PAUSED:
- mp_msg(MSGT_AO,MSGL_V,"alsa-space: paused");
- str_status = "paused";
- ret = 0;
- break;
- case SND_PCM_STATE_XRUN:
- xrun("space");
- str_status = "xrun";
- first = 1;
- ret = 0;
- break;
- default:
- str_status = "undefined";
- ret = snd_pcm_status_get_avail(status) * bytes_per_sample;
- if (ret <= 0) {
- xrun("space");
- }
- }
-
- if (snd_pcm_status_get_state(status) != SND_PCM_STATE_RUNNING)
- mp_msg(MSGT_AO,MSGL_V,"alsa-space: free space = %i, %s --\n", ret, str_status);
-
- if (ret < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,"negative value!!\n");
- ret = 0;
- }
-
- // workaround for too small value returned
- if (ret < MIN_CHUNK_SIZE)
- ret = 0;
-
+ ret = snd_pcm_status_get_avail(status) * bytes_per_sample;
+ if (ret > MAX_OUTBURST)
+ ret = MAX_OUTBURST;
return(ret);
}
More information about the MPlayer-cvslog
mailing list