[MPlayer-cvslog] r27467 - trunk/libao2/ao_nas.c

diego subversion at mplayerhq.hu
Fri Aug 15 19:14:54 CEST 2008


Author: diego
Date: Fri Aug 15 19:14:53 2008
New Revision: 27467

Log:
Work correctly with very small files where less than outburst is to be played.
patch by Tobias Diedrich, ranma tdiedrich de


Modified:
   trunk/libao2/ao_nas.c

Modified: trunk/libao2/ao_nas.c
==============================================================================
--- trunk/libao2/ao_nas.c	(original)
+++ trunk/libao2/ao_nas.c	Fri Aug 15 19:14:53 2008
@@ -574,6 +574,29 @@ static int play(void* data,int len,int f
 	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;



More information about the MPlayer-cvslog mailing list