From 90f4cdef23999a18fbfd44588cac4c4b2cd076fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20T=C3=B6rnblom?= Date: Thu, 18 Oct 2012 17:45:09 +0100 Subject: [PATCH] make sure the muxer is closed only when its been initilized. (cherry picked from commit 0d4c30b7da80686a0aa451ee2362537dd8f219b3) --- src/webui/webui.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); }