+struct btr_node *audiod_get_btr_root(void)
+{
+ int i, newest_slot = -1;
+ struct timeval newest_rstime = {0, 0};
+
+ FOR_EACH_SLOT(i) {
+ struct slot_info *s = &slot[i];
+ struct timeval rstime;
+ if (!s->receiver_node)
+ continue;
+ if (s->receiver_node->task.error < 0)
+ continue;
+ btr_get_node_start(s->receiver_node->btrn, &rstime);
+ if (newest_slot >= 0 && tv_diff(&rstime, &newest_rstime, NULL) < 0)
+ continue;
+ newest_rstime = rstime;
+ newest_slot = i;
+ }
+ if (newest_slot == -1)
+ return NULL;
+ return slot[newest_slot].receiver_node->btrn;
+}
+