make sure the muxer is closed only when its been initilized.

(cherry picked from commit 0d4c30b7da)
This commit is contained in:
John Törnblom 2012-10-18 17:45:09 +01:00 committed by Adam Sutton
parent 5ebb86fbf1
commit 90f4cdef23

View file

@ -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);
}