service: another STOP/START msg cleanup

This commit is contained in:
Jaroslav Kysela 2014-11-23 17:47:42 +01:00
parent 3ba0ae6e62
commit 085fd89465
3 changed files with 9 additions and 1 deletions

View file

@ -1159,7 +1159,8 @@ service_restart(service_t *t)
pthread_mutex_lock(&t->s_stream_mutex);
had_components = TAILQ_FIRST(&t->s_filt_components) != NULL;
had_components = TAILQ_FIRST(&t->s_filt_components) != NULL &&
t->s_running;
service_build_filter(t);
@ -1172,10 +1173,12 @@ service_restart(service_t *t)
streaming_pad_deliver(&t->s_streaming_pad,
streaming_msg_create_data(SMT_START,
service_build_stream_start(t)));
t->s_running = 1;
} else {
streaming_pad_deliver(&t->s_streaming_pad,
streaming_msg_create_code(SMT_STOP,
SM_CODE_NO_SERVICE));
t->s_running = 0;
}
pthread_mutex_unlock(&t->s_stream_mutex);

View file

@ -411,6 +411,7 @@ typedef struct service {
*
*/
int s_streaming_live;
int s_running;
// Live status
#define TSS_LIVE 0x01

View file

@ -100,6 +100,7 @@ subscription_link_service(th_subscription_t *s, service_t *t)
// Send a START message to the subscription client
streaming_target_deliver(s->ths_output, s->ths_start_message);
s->ths_start_message = NULL;
t->s_running = 1;
// Send status report
sm = streaming_msg_create_code(SMT_SERVICE_STATUS,
@ -134,6 +135,7 @@ subscription_unlink_service0(th_subscription_t *s, int reason, int stop)
// Send a STOP message to the subscription client
sm = streaming_msg_create_code(SMT_STOP, reason);
streaming_target_deliver(s->ths_output, sm);
t->s_running = 0;
}
pthread_mutex_unlock(&t->s_stream_mutex);
@ -480,6 +482,8 @@ subscription_input(void *opauqe, streaming_message_t *sm)
if(s->ths_start_message != NULL) {
streaming_target_deliver(s->ths_output, s->ths_start_message);
s->ths_start_message = NULL;
if (s->ths_service)
s->ths_service->s_running = 1;
}
s->ths_state = SUBSCRIPTION_GOT_SERVICE;
}