From 236b99864a036eef7ea318e0aa6c74e2ebc0814c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 17 Sep 2014 09:00:22 +0200 Subject: [PATCH] globalheaders: add restart support to gh_pass() --- src/plumbing/globalheaders.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/plumbing/globalheaders.c b/src/plumbing/globalheaders.c index 4710f560..6e23fbc7 100644 --- a/src/plumbing/globalheaders.c +++ b/src/plumbing/globalheaders.c @@ -44,15 +44,15 @@ typedef struct globalheaders { static void gh_flush(globalheaders_t *gh) { - if(gh->gh_ss != NULL) + if(gh->gh_ss != NULL) { streaming_start_unref(gh->gh_ss); - gh->gh_ss = NULL; + gh->gh_ss = NULL; + } pktref_clear_queue(&gh->gh_holdq); } - /** * */ @@ -208,7 +208,7 @@ gh_hold(globalheaders_t *gh, streaming_message_t *sm) assert(ssc != NULL); if(ssc->ssc_type == SCT_TELETEXT) { - free(sm); + streaming_msg_free(sm); ssc->ssc_disabled = 1; break; } @@ -278,7 +278,13 @@ gh_pass(globalheaders_t *gh, streaming_message_t *sm) switch(sm->sm_type) { case SMT_START: - abort(); // Should not happen + /* stop */ + gh->gh_passthru = 0; + gh_flush(gh); + /* restart */ + gh->gh_ss = streaming_start_copy(sm->sm_data); + streaming_msg_free(sm); + break; case SMT_STOP: gh->gh_passthru = 0; @@ -348,4 +354,3 @@ globalheaders_destroy(streaming_target_t *pad) gh_flush(gh); free(gh); } -