[Freeswitch-svn] [commit] r9172 - freeswitch/trunk/src/mod/formats/mod_shout

Freeswitch SVN anthm at freeswitch.org
Thu Jul 24 14:43:11 EDT 2008


Author: anthm
Date: Thu Jul 24 14:43:10 2008
New Revision: 9172

Modified:
   freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c

Log:
never-ending mp3 saga

Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	Thu Jul 24 14:43:10 2008
@@ -223,13 +223,13 @@
 	int dlen = 0;
 	int x = 0;
 	char *in;
-	int inlen;
+	int inlen = 0;
 	char *out;
 	int outlen;
 	int usedlen;
 	char inbuf[MP3_SCACHE];
 	int done = 0;
-
+	size_t used;
 	size_t lp;
 	size_t rb = 0;
 
@@ -248,10 +248,9 @@
 		x = 0;
 
 		if (inlen < bytes) {
-			bytes = inlen;
 			done = 1;
 		}
-
+		
 		do {
 			decode_status = decodeMP3(&context->mp, in, inlen, out, outlen, &dlen);
 
@@ -310,8 +309,10 @@
 		}
 	}
 
-	if (done || switch_buffer_inuse(context->audio_buffer) >= bytes) {
-		rb = switch_buffer_read(context->audio_buffer, data, bytes);
+	used = switch_buffer_inuse(context->audio_buffer);
+	
+	if (done || used >= bytes) {
+		rb = switch_buffer_read(context->audio_buffer, data, used);
 		return rb;
 	}
 



More information about the Freeswitch-svn mailing list