[xiph-commits] r9711 - icecast/trunk/icecast/src
karl at svn.xiph.org
karl at svn.xiph.org
Sun Aug 7 07:51:04 PDT 2005
Author: karl
Date: 2005-08-07 07:50:59 -0700 (Sun, 07 Aug 2005)
New Revision: 9711
Modified:
icecast/trunk/icecast/src/auth.h
icecast/trunk/icecast/src/cfgfile.c
icecast/trunk/icecast/src/client.h
icecast/trunk/icecast/src/connection.c
icecast/trunk/icecast/src/format.c
icecast/trunk/icecast/src/format_ogg.c
icecast/trunk/icecast/src/format_ogg.h
icecast/trunk/icecast/src/refbuf.h
icecast/trunk/icecast/src/source.c
Log:
merge extra checks. minor cleanup work
Modified: icecast/trunk/icecast/src/auth.h
===================================================================
--- icecast/trunk/icecast/src/auth.h 2005-08-07 01:32:37 UTC (rev 9710)
+++ icecast/trunk/icecast/src/auth.h 2005-08-07 14:50:59 UTC (rev 9711)
@@ -40,7 +40,7 @@
source_t *source, char *username, char *password);
void (*free)(struct auth_tag *self);
void *state;
- void *type;
+ char *type;
} auth_t;
auth_result auth_check_client(source_t *source, client_t *client);
Modified: icecast/trunk/icecast/src/cfgfile.c
===================================================================
--- icecast/trunk/icecast/src/cfgfile.c 2005-08-07 01:32:37 UTC (rev 9710)
+++ icecast/trunk/icecast/src/cfgfile.c 2005-08-07 14:50:59 UTC (rev 9711)
@@ -768,6 +768,8 @@
}
}
+ if (listener == NULL)
+ return;
do {
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
Modified: icecast/trunk/icecast/src/client.h
===================================================================
--- icecast/trunk/icecast/src/client.h 2005-08-07 01:32:37 UTC (rev 9710)
+++ icecast/trunk/icecast/src/client.h 2005-08-07 14:50:59 UTC (rev 9711)
@@ -32,8 +32,8 @@
/* http response code for this client */
int respcode;
- /* is client getting intro data */
- long intro_offset;
+ /* is client getting intro data */
+ long intro_offset;
/* where in the queue the client is */
refbuf_t *refbuf;
Modified: icecast/trunk/icecast/src/connection.c
===================================================================
--- icecast/trunk/icecast/src/connection.c 2005-08-07 01:32:37 UTC (rev 9710)
+++ icecast/trunk/icecast/src/connection.c 2005-08-07 14:50:59 UTC (rev 9711)
@@ -898,7 +898,7 @@
client->write_to_client = format_generic_write_to_client;
client->check_buffer = format_check_http_buffer;
- client->refbuf = refbuf_new (4096);
+ client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
avl_tree_wlock(source->pending_tree);
avl_insert(source->pending_tree, (void *)client);
Modified: icecast/trunk/icecast/src/format.c
===================================================================
--- icecast/trunk/icecast/src/format.c 2005-08-07 01:32:37 UTC (rev 9710)
+++ icecast/trunk/icecast/src/format.c 2005-08-07 14:50:59 UTC (rev 9711)
@@ -156,7 +156,7 @@
return -1;
}
/* source -> file fallback, need a refbuf for data */
- refbuf = refbuf_new (4096);
+ refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
client->refbuf = refbuf;
client->pos = refbuf->len;
client->intro_offset = 0;
Modified: icecast/trunk/icecast/src/format_ogg.c
===================================================================
--- icecast/trunk/icecast/src/format_ogg.c 2005-08-07 01:32:37 UTC (rev 9710)
+++ icecast/trunk/icecast/src/format_ogg.c 2005-08-07 14:50:59 UTC (rev 9711)
@@ -150,6 +150,7 @@
ogg_info->codecs = NULL;
ogg_info->current = NULL;
ogg_info->bos_completed = 0;
+ ogg_info->codec_count = 0;
}
@@ -211,6 +212,12 @@
}
do
{
+ if (ogg_info->codec_count > 10)
+ {
+ ERROR0 ("many codecs in stream, playing safe, dropping source");
+ ogg_info->error = 1;
+ return -1;
+ }
codec = initial_vorbis_page (plugin, page);
if (codec)
break;
@@ -241,6 +248,7 @@
/* add codec to list */
codec->next = ogg_info->codecs;
ogg_info->codecs = codec;
+ ogg_info->codec_count++;
}
return 0;
@@ -374,14 +382,14 @@
ogg_state_t *ogg_info = source->format->_state;
format_plugin_t *format = source->format;
char *data = NULL;
- int bytes;
+ int bytes = 0;
while (1)
{
while (1)
{
ogg_page page;
- refbuf_t *refbuf;
+ refbuf_t *refbuf = NULL;
ogg_codec_t *codec = ogg_info->current;
/* if a codec has just been given a page then process it */
@@ -399,10 +407,12 @@
if (ogg_page_bos (&page))
{
process_initial_page (source->format, &page);
- continue;
}
- ogg_info->bos_completed = 1;
- refbuf = process_ogg_page (ogg_info, &page);
+ else
+ {
+ ogg_info->bos_completed = 1;
+ refbuf = process_ogg_page (ogg_info, &page);
+ }
if (ogg_info->error)
{
ERROR0 ("Problem processing stream");
@@ -420,7 +430,7 @@
data = ogg_sync_buffer (&ogg_info->oy, 4096);
bytes = client_read_bytes (source->client, data, 4096);
- if (bytes < 0)
+ if (bytes <= 0)
{
ogg_sync_wrote (&ogg_info->oy, 0);
return NULL;
Modified: icecast/trunk/icecast/src/format_ogg.h
===================================================================
--- icecast/trunk/icecast/src/format_ogg.h 2005-08-07 01:32:37 UTC (rev 9710)
+++ icecast/trunk/icecast/src/format_ogg.h 2005-08-07 14:50:59 UTC (rev 9711)
@@ -28,6 +28,7 @@
ogg_sync_state oy;
int error;
+ int codec_count;
struct ogg_codec_tag *codecs;
char *artist;
char *title;
Modified: icecast/trunk/icecast/src/refbuf.h
===================================================================
--- icecast/trunk/icecast/src/refbuf.h 2005-08-07 01:32:37 UTC (rev 9710)
+++ icecast/trunk/icecast/src/refbuf.h 2005-08-07 14:50:59 UTC (rev 9711)
@@ -36,5 +36,7 @@
void refbuf_addref(refbuf_t *self);
void refbuf_release(refbuf_t *self);
+#define PER_CLIENT_REFBUF_SIZE 4096
+
#endif /* __REFBUF_H__ */
Modified: icecast/trunk/icecast/src/source.c
===================================================================
--- icecast/trunk/icecast/src/source.c 2005-08-07 01:32:37 UTC (rev 9710)
+++ icecast/trunk/icecast/src/source.c 2005-08-07 14:50:59 UTC (rev 9711)
@@ -610,8 +610,11 @@
source->running = 1;
mountinfo = config_find_mount (config_get_config(), source->mount);
- if (mountinfo && mountinfo->on_connect)
- source_run_script (mountinfo->on_connect, source->mount);
+ if (mountinfo)
+ {
+ if (mountinfo->on_connect)
+ source_run_script (mountinfo->on_connect, source->mount);
+ }
config_release_config();
/*
@@ -810,8 +813,11 @@
INFO1("Source \"%s\" exiting", source->mount);
mountinfo = config_find_mount (config_get_config(), source->mount);
- if (mountinfo && mountinfo->on_disconnect)
- source_run_script (mountinfo->on_disconnect, source->mount);
+ if (mountinfo)
+ {
+ if (mountinfo->on_disconnect)
+ source_run_script (mountinfo->on_disconnect, source->mount);
+ }
config_release_config();
/* we have de-activated the source now, so no more clients will be
More information about the commits
mailing list