diff --git a/src/webui/webui.c b/src/webui/webui.c index 768591b0..7f7a4d78 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -144,6 +144,7 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq, { streaming_message_t *sm; int run = 1; + int started = 0; muxer_t *mux = NULL; int timeouts = 0; struct timespec ts; @@ -208,10 +209,11 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq, http_output_content(hc, muxer_mime(mux, sm->sm_data)); muxer_init(mux, sm->sm_data, name); + + started = 1; break; case SMT_STOP: - muxer_close(mux); tvhlog(LOG_WARNING, "webui", "Stop streaming %s, %s", hc->hc_url_orig, streaming_code2txt(sm->sm_code)); run = 0; @@ -248,6 +250,9 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq, } } + if(started) + muxer_close(mux); + muxer_destroy(mux); }