From 7a2ba572f871aa8b0228b25e164e714a3fced096 Mon Sep 17 00:00:00 2001 From: chme Date: Thu, 14 Feb 2019 12:15:11 +0100 Subject: [PATCH] [streaming] Remove timeout for mpeg stream requests Remove the need for clients to regularly reconnect to the mp3 stream. As long as the connection is open, we are sending mp3 stream data. --- src/httpd_streaming.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/httpd_streaming.c b/src/httpd_streaming.c index 52b6bfdb..547b624d 100644 --- a/src/httpd_streaming.c +++ b/src/httpd_streaming.c @@ -46,8 +46,6 @@ extern struct event_base *evbase_httpd; #define STREAMING_SILENCE_INTERVAL 1 // Buffer size for transmitting from player to httpd thread #define STREAMING_RAWBUF_SIZE (STOB(AIRTUNES_V2_PACKET_SAMPLES)) -// Should prevent that we keep transcoding to dead connections -#define STREAMING_CONNECTION_TIMEOUT 60 // Linked list of mp3 streaming requests struct streaming_session { @@ -74,6 +72,7 @@ static struct player_status streaming_player_status; static int streaming_player_changed; static int streaming_pipe[2]; + static void streaming_fail_cb(struct evhttp_connection *evcon, void *arg) { @@ -243,6 +242,8 @@ streaming_request(struct evhttp_request *req, struct httpd_uri_parsed *uri_parse evhttp_add_header(output_headers, "Pragma", "no-cache"); evhttp_add_header(output_headers, "Expires", "Mon, 31 Aug 2015 06:00:00 GMT"); evhttp_add_header(output_headers, "icy-name", name); + evhttp_add_header(output_headers, "Access-Control-Allow-Origin", "*"); + evhttp_add_header(output_headers, "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS"); // TODO ICY metaint evhttp_send_reply_start(req, HTTP_OK, "OK"); @@ -263,7 +264,6 @@ streaming_request(struct evhttp_request *req, struct httpd_uri_parsed *uri_parse session->next = streaming_sessions; streaming_sessions = session; - evhttp_connection_set_timeout(evcon, STREAMING_CONNECTION_TIMEOUT); evhttp_connection_set_closecb(evcon, streaming_fail_cb, session); return 0;