[xiph-commits] r16819 - in trunk/ao/src: . plugins/alsa09
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Tue Jan 26 03:07:15 PST 2010
Author: xiphmont
Date: 2010-01-26 03:07:15 -0800 (Tue, 26 Jan 2010)
New Revision: 16819
Modified:
trunk/ao/src/audio_out.c
trunk/ao/src/plugins/alsa09/ao_alsa09.c
Log:
Alter underrun recovery to not toss buffers after successful resume.
Modified: trunk/ao/src/audio_out.c
===================================================================
--- trunk/ao/src/audio_out.c 2010-01-26 10:56:58 UTC (rev 16818)
+++ trunk/ao/src/audio_out.c 2010-01-26 11:07:15 UTC (rev 16819)
@@ -123,12 +123,12 @@
handle = dlopen(plugin_file, DLOPEN_FLAG /* See ao_private.h */);
if (handle) {
- dt = (driver_list *)malloc(sizeof(driver_list));
+ dt = (driver_list *)calloc(1,sizeof(driver_list));
if (!dt) return NULL;
dt->handle = handle;
- dt->functions = (ao_functions *)malloc(sizeof(ao_functions));
+ dt->functions = (ao_functions *)calloc(1,sizeof(ao_functions));
if (!(dt->functions)) {
free(dt);
return NULL;
@@ -218,7 +218,7 @@
int i;
/* insert first driver */
- head = driver = malloc(sizeof(driver_list));
+ head = driver = calloc(1,sizeof(driver_list));
if (driver != NULL) {
driver->functions = static_drivers[0];
driver->handle = NULL;
@@ -226,7 +226,7 @@
i = 1;
while (static_drivers[i] != NULL) {
- driver->next = malloc(sizeof(driver_list));
+ driver->next = calloc(1,sizeof(driver_list));
if (driver->next == NULL)
break;
@@ -918,7 +918,7 @@
{
ao_option *op, *list;
- op = malloc(sizeof(ao_option));
+ op = calloc(1,sizeof(ao_option));
if (op == NULL) return 0;
op->key = strdup(key);
Modified: trunk/ao/src/plugins/alsa09/ao_alsa09.c
===================================================================
--- trunk/ao/src/plugins/alsa09/ao_alsa09.c 2010-01-26 10:56:58 UTC (rev 16818)
+++ trunk/ao/src/plugins/alsa09/ao_alsa09.c 2010-01-26 11:07:15 UTC (rev 16819)
@@ -447,7 +447,7 @@
{
if (err == -EPIPE) {
/* FIXME: underrun length detection */
- fprintf(stderr,"ALSA: underrun, at least %dms.\n", 0);
+ //fprintf(stderr,"ALSA: underrun, at least %dms.\n", 0);
/* output buffer underrun */
internal->cmd = "underrun recovery: snd_pcm_prepare";
err = snd_pcm_prepare(internal->pcm_handle);
@@ -500,10 +500,8 @@
fprintf(stderr,"ALSA write error: %s\n",
snd_strerror(err));
return 0;
- }
-
- /* abandon the rest of the buffer */
- break;
+ }else /* recovered, continue */
+ continue;
}
/* decrement the sample counter */
More information about the commits
mailing list