SnowHow
Joined: 17 Aug 2014 Posts: 1
|
Posted: Wed Aug 20, 2014 12:34 am Post subject: Icecast KH and Icecast2 stats |
|
|
Hi.
I would like to report an Icecast KH statistics bug we found on the RadioDJ forums.
The issue is a letter case difference between Icecast2 and KH. The RadioDJ program and encoder plugin use the un4seen bass library for it's audio and encoding functions. The bass library has an Icecast class which works perfectly with Icecast2 but not KH in so far as statistics retrieval and we discovered why:
When the encoder connects to Icecast 2.3.2 it sends this request:
Code: |
GET /admin/listclients?mount=%2Ftest_stream%2Emp3 HTTP/1.0
User-Agent: BASSenc/2.4
Authorization: Basic XXXXXXX
|
And the response is:
Code: |
HTTP/1.0 200 OK
Content-Type: text/xml
Content-Length: 107
<?xml version="1.0"?>
<icestats><source mount="/test_stream.mp3"><Listeners>0</Listeners></source></icestats>
|
However, KH responds this way:
Code: |
HTTP/1.0 200 OK
Content-Type: text/xml
Content-Length: 305
<?xml version="1.0"?>
<icestats>
<source mount="/RadioH2O.mp3">
<listeners>1</listeners>
<listener id="68">
<ID>68</ID>
<IP>127.0.0.1</IP>
<UserAgent>VLC/2.1.3 LibVLC/2.1.3</UserAgent>
<lag>0</lag>
<Connected>139</Connected>
</listener>
|
The difference is the "Listeners". In KH it is lowercase. This is preventing our users from grabbing statistics from the encoder to be recorded in the database for licensing reporting requirements.
What we did to fix the issue was locate the following in admin.c:
Code: |
static int command_show_listeners (client_t *client, source_t *source, int response)
{
xmlDocPtr doc;
xmlNodePtr node, srcnode;
uint64_t id = -1;
const char *ID_str = NULL;
char buf[22];
doc = xmlNewDoc(XMLSTR("1.0"));
node = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
srcnode = xmlNewChild(node, NULL, XMLSTR("source"), NULL);
xmlSetProp(srcnode, XMLSTR("mount"), XMLSTR(source->mount));
xmlDocSetRootElement(doc, node);
snprintf(buf, sizeof(buf), "%lu", source->listeners);
xmlNewChild(srcnode, NULL, XMLSTR("listeners"), XMLSTR(buf)); <---- This line needs to be Listeners with capital L.
......
|
and recompiled the binary. It worked. Our users can now get stats from Icecast KH with the modded binary.
If this could be corrected, that would be wonderful. If this is by design, could you explain why the difference?
Thanks!
SH |
|