Skip to content
Snippets Groups Projects
Commit c1d1c130 authored by Monty Montgomery's avatar Monty Montgomery
Browse files

Alter underrun recovery to not toss buffers after successful resume.

git-svn-id: http://svn.xiph.org/trunk/ao@16819 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent bdc3e3a3
No related branches found
No related tags found
No related merge requests found
......@@ -123,12 +123,12 @@ static driver_list *_get_plugin(char *plugin_file)
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 @@ static driver_list* _load_static_drivers(driver_list **end)
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 @@ static driver_list* _load_static_drivers(driver_list **end)
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 @@ int ao_append_option(ao_option **options, const char *key, const char *value)
{
ao_option *op, *list;
op = malloc(sizeof(ao_option));
op = calloc(1,sizeof(ao_option));
if (op == NULL) return 0;
op->key = strdup(key);
......
......@@ -447,7 +447,7 @@ static inline int alsa_error_recovery(ao_alsa_internal *internal, int err)
{
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 @@ int ao_plugin_play(ao_device *device, const char *output_samples,
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 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment