int ret, slot_num;
struct receiver *r = a->receiver;
struct receiver_node *rn;
- const struct timeval restart_delay = {2, 0};
+ tv_add(now, &(struct timeval)EMBRACE(2, 0), &a->restart_barrier);
ret = get_empty_slot();
if (ret < 0)
- goto err;
+ return ret;
slot_num = ret;
- s = &slot[slot_num];
- s->format = format;
- s->receiver_node = para_calloc(sizeof(struct receiver_node));
- rn = s->receiver_node;
+ rn = para_calloc(sizeof(*rn));
rn->receiver = r;
rn->conf = a->receiver_conf;
rn->btrn = btr_new_node(&(struct btr_node_description)
if (ret < 0) {
btr_free_node(rn->btrn);
free(rn);
- s->receiver_node = NULL;
- goto err;
+ return ret;
}
+ s = &slot[slot_num];
+ s->format = format;
+ s->receiver_node = rn;
PARA_NOTICE_LOG("started %s: %s receiver in slot %d\n",
- audio_formats[s->format], r->name, slot_num);
+ audio_formats[format], r->name, slot_num);
rn->task.pre_select = r->pre_select;
rn->task.post_select = r->post_select;
sprintf(rn->task.status, "%s receiver node", r->name);
register_task(&rn->task);
- ret = slot_num;
-err:
- if (ret < 0)
- PARA_ERROR_LOG("%s\n", para_strerror(-ret));
- tv_add(now, &restart_delay, &afi[format].restart_barrier);
- return ret;
+ return slot_num;
}
/* return: 0: Not running, 1: Running, -1: Running but eof (or error) */
if (!must_start_decoder())
return;
ret = open_receiver(stat_task->current_audio_format_num);
- if (ret < 0)
+ if (ret < 0) {
+ PARA_ERROR_LOG("%s\n", para_strerror(-ret));
return;
+ }
sl = slot + ret;
a = afi + sl->format;
if (a->num_filters)