static void wng_event_handler(struct task *t)
{
- struct writer_node_group *g = t->private_data;
- int i;
-
PARA_INFO_LOG("%s\n", PARA_STRERROR(-t->ret));
unregister_task(t);
- FOR_EACH_SLOT(i) {
- if (slot[i].wng != g)
- continue;
- wng_close(g);
- wng_destroy(g);
- slot[i].wng = NULL;
- }
}
-static void open_writer(int slot_num)
+static void open_writers(int slot_num)
{
int ret, i;
struct slot_info *s = &slot[slot_num];
}
}
-static void close_decoder_if_idle(int slot_num)
+static void try_to_close_slot(int slot_num)
{
struct slot_info *s = &slot[slot_num];
if (s->format < 0)
return;
- if (!s->fc)
+ if (s->receiver_node && !s->receiver_node->eof)
+ return;
+ if (s->fc && !s->fc->eof)
return;
- if (s->wng)
+ if (s->wng && !s->wng->eof)
return;
- PARA_INFO_LOG("closing all filters in slot %d (filter_chain %p)\n",
- slot_num, s->fc);
+ PARA_INFO_LOG("closing slot %d \n", slot_num);
+ wng_close(s->wng);
+ wng_destroy(s->wng);
close_filters(s->fc);
free(s->fc);
close_receiver(slot_num);
FOR_EACH_SLOT(i) {
struct receiver_node *rn;
- close_decoder_if_idle(i);
+ try_to_close_slot(i);
if (slot[i].format < 0)
continue;
rn = slot[i].receiver_node;
if (rn && rn->loaded && !slot[i].wng) {
open_filters(i);
- open_writer(i);
+ open_writers(i);
}
}
}