# HG changeset patch # User diego # Date 1218820493 0 # Node ID f3cd247a4aa358a74ae5ec60f99b9fba9ee6fa58 # Parent 8f9c58ac2af29922dde6b27169a41f02942102ff Work correctly with very small files where less than outburst is to be played. patch by Tobias Diedrich, ranma tdiedrich de diff -r 8f9c58ac2af2 -r f3cd247a4aa3 libao2/ao_nas.c --- a/libao2/ao_nas.c Fri Aug 15 11:40:01 2008 +0000 +++ b/libao2/ao_nas.c Fri Aug 15 17:14:53 2008 +0000 @@ -574,6 +574,29 @@ if (len == 0) return 0; + if (len < ao_data.outburst) { + unsigned tempbufsz = ao_data.outburst; + void *tempbuf = malloc(tempbufsz); + + memset(tempbuf, 0, tempbufsz); + memcpy(tempbuf, data, len); + + play(tempbuf, ao_data.outburst, flags); + + if (nas_data->state != AuStateStart) { + mp_msg(MSGT_AO, MSGL_DBG2, "ao_nas: play(): Starting flow.\n"); + nas_data->expect_underrun = 1; + nas_data->state = AuStateStart; + AuStartFlow(nas_data->aud, nas_data->flow, &as); + if (as != AuSuccess) + nas_print_error(nas_data->aud, "play(): AuStartFlow", as); + } + + free(tempbuf); + + return len; + } + pthread_mutex_lock(&nas_data->buffer_mutex); maxbursts = (nas_data->client_buffer_size - nas_data->client_buffer_used) / ao_data.outburst;