Don't fail so hard in subscription_create_from_transport() if the adapter cannot be started

This commit is contained in:
Andreas Öman 2009-12-10 23:20:06 +00:00
parent e43ff33d87
commit 79846a46b1
3 changed files with 20 additions and 5 deletions

View file

@ -483,7 +483,7 @@ rtsp_streaming_input(void *opaque, streaming_message_t *sm)
/**
*
*/
static void
static int
rtsp_subscribe(rtsp_t *rtsp, rtsp_resource_t *rr)
{
th_subscription_t *s = NULL;
@ -493,11 +493,11 @@ rtsp_subscribe(rtsp_t *rtsp, rtsp_resource_t *rr)
switch(rr->rr_type) {
case RTSP_RESOURCE_CHANNEL:
if(rtsp->rtsp_sub->ths_channel == rr->rr_channel)
return;
return 0;
break;
case RTSP_RESOURCE_SERVICE:
if(rtsp->rtsp_sub->ths_transport == rr->rr_service)
return;
return 0;
}
subscription_unsubscribe(rtsp->rtsp_sub);
}
@ -521,6 +521,7 @@ rtsp_subscribe(rtsp_t *rtsp, rtsp_resource_t *rr)
}
rtsp->rtsp_sub = s;
return s == NULL;
}

View file

@ -113,6 +113,13 @@ serviceprobe_thread(void *aux)
t->tht_svcname);
s = subscription_create_from_transport(t, "serviceprobe", &sq.sq_st, 0);
if(s == NULL) {
t->tht_sp_onqueue = 0;
TAILQ_REMOVE(&serviceprobe_queue, t, tht_sp_link);
tvhlog(LOG_INFO, "serviceprobe", "%20s: could not subscribe",
t->tht_svcname);
continue;
}
transport_ref(t);
pthread_mutex_unlock(&global_lock);

View file

@ -287,8 +287,15 @@ subscription_create_from_transport(th_transport_t *t, const char *name,
th_subscription_t *s = subscription_create(INT32_MAX, name, st, flags);
source_info_t si;
if(t->tht_status != TRANSPORT_RUNNING)
transport_start(t, INT32_MAX, 1);
if(t->tht_status != TRANSPORT_RUNNING) {
if(transport_start(t, INT32_MAX, 1)) {
subscription_unsubscribe(s);
tvhlog(LOG_INFO, "subscription",
"\"%s\" direct subscription failed");
return NULL;
}
}
t->tht_setsourceinfo(t, &si);