1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-05-18 00:58:26 -04:00

Fix: Make actual streaming work

This commit is contained in:
Philipp Schafft 2018-06-10 10:10:06 +00:00
parent ded5c145f1
commit f567b6240a

View File

@ -287,7 +287,7 @@ int format_advance_queue(source_t *source, client_t *client)
* calling functions will use a already freed client struct and * calling functions will use a already freed client struct and
* cause a segfault! * cause a segfault!
*/ */
static int format_prepare_headers (source_t *source, client_t *client) static int format_prepare_headers_http (source_t *source, client_t *client)
{ {
size_t remaining; size_t remaining;
char *ptr; char *ptr;
@ -404,13 +404,34 @@ static int format_prepare_headers (source_t *source, client_t *client)
ptr += bytes; ptr += bytes;
client->refbuf->len -= remaining; client->refbuf->len -= remaining;
if (source->format->create_client_data) return 0;
}
static int format_prepare_headers (source_t *source, client_t *client)
{
switch (client->protocol) {
case ICECAST_PROTOCOL_HTTP:
case ICECAST_PROTOCOL_SHOUTCAST:
if (format_prepare_headers_http(source, client) != 0)
return -1;
break;
case ICECAST_PROTOCOL_GOPHER:
client->refbuf->len = 0;
break;
}
if (source->format->create_client_data) {
if (source->format->create_client_data (source, client) < 0) { if (source->format->create_client_data (source, client) < 0) {
ICECAST_LOG_ERROR("Client format header generation failed. " ICECAST_LOG_ERROR("Client format header generation failed. "
"(Likely not enough or wrong source data) Dropping client."); "(Likely not enough or wrong source data) Dropping client.");
client->respcode = 500; client->respcode = 500;
return -1; return -1;
} }
}
return 0; return 0;
} }