}
if (audiod_status == AUDIOD_ON && !s)
goto empty;
- /* valid status items and playing */
+ /*
+ * Valid status items and playing, set length and tmp to the stream
+ * start. We use the slot info and fall back to the info from current
+ * status items if no slot info is available.
+ */
+ length = stat_task->length_seconds;
+ tmp = &stat_task->server_stream_start;
if (s && s->wns) { /* writer active in this slot */
- length = s->seconds_total;
- tmp = &s->server_stream_start;
- } else { /* standby mode, rely on status items */
- length = stat_task->length_seconds;
- tmp = &stat_task->server_stream_start;
+ btr_get_node_start(s->wns[0].btrn, &wstime);
+ if (wstime.tv_sec != 0) { /* writer wrote something */
+ if (s->server_stream_start.tv_sec == 0) {
+ /* copy status info to slot */
+ s->server_stream_start = stat_task->server_stream_start;
+ s->offset_seconds = stat_task->offset_seconds;
+ s->seconds_total = stat_task->length_seconds;
+ }
+ length = s->seconds_total;
+ tmp = &s->server_stream_start;
+ }
}
if (stat_task->sa_time_diff_sign > 0)
tv_diff(tmp, &stat_task->sa_time_diff, &sss);
seconds = diff.tv_sec + stat_task->offset_seconds;
goto out;
}
- btr_get_node_start(s->wns[0].btrn, &wstime);
tv_diff(now, &wstime, &wtime);
//PARA_CRIT_LOG("offset %d\n", s->offset_seconds);
seconds = s->offset_seconds;
register_writer_node(wn, parent);
}
}
- s->server_stream_start = stat_task->server_stream_start.tv_sec?
- stat_task->server_stream_start : *now;
- s->offset_seconds = stat_task->offset_seconds;
- s->seconds_total = stat_task->length_seconds;
}
/* returns slot num on success */