Revision
14478
Author
rupa
Date
2009-08-10 11:27:42 -0500 (Mon, 10 Aug 2009)

Log Message

terminate shoutcast read thread when requested

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c (14477 => 14478)


--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	2009-08-10 06:08:09 UTC (rev 14477)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	2009-08-10 16:27:42 UTC (rev 14478)
@@ -144,8 +144,10 @@
 			int sanity = 0;
 
 			while (context->thread_running) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for stream to terminate: %s\n", context->stream_url);
 				switch_yield(500000);
 				if (++sanity > 10) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Giving up waiting for stream to terminate: %s\n", context->stream_url);
 					break;
 				}
 			}
@@ -368,7 +370,7 @@
 			context->eof++;
 		} else if (decode_status == MPG123_ERR || decode_status > 0) {
 			if (++context->mp3err >= 5) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error!\n");
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error! %s\n", context->stream_url);
 				context->eof++;
 				goto error;
 			}
@@ -382,6 +384,10 @@
 		switch_mutex_unlock(context->audio_mutex);
 	} while (!context->err && !context->eof && decode_status != MPG123_NEED_MORE);
 
+	if (context->err) {
+		goto error;
+	}
+	
 	return realsize;
 
   error: