- if (cafn < 0 || !stat_task->ct)
- return -1;
- /* Do nothing if the 'N' flag is set or the 'P' flag is unset */
- if (stat_task->vss_status != VSS_STATUS_FLAG_PLAYING)
- return -1;
- ret = receiver_running(cafn);
- if (ret > 0) /* already running and not eof */
- return -1;
- if (ret < 0) { /* eof */
- /*
- * para_server uses a zero start time during the announcement
- * period, i.e. before it sends the first chunk. Wait until
- * this period begins to avoid restarting the receiver that
- * belongs to the file just completed.
- */
- if (stat_task->server_stream_start.tv_sec != 0) {
- sched_request_timeout_ms(100, s);
- return -1;
- }
- }
- if (tv_diff(now, &afi[cafn].restart_barrier, &diff) < 0) {
- if (tv_diff(&s->timeout, &diff, NULL) > 0)
- sched_request_timeout(&diff, s);
- else
- sched_min_delay(s);
- return -1;
- }
- /* start a new receiver */
- return open_receiver(cafn);
+ if (audiod_status != AUDIOD_ON)
+ return false;
+ if (cafn < 0)
+ return false;
+ if (!stat_task->ct)
+ return false;
+ if (vs & VSS_STATUS_FLAG_NEXT)
+ return false;
+ if (!(vs & VSS_STATUS_FLAG_PLAYING))
+ return false;
+ if (receiver_running())
+ return false;
+ if (tv_diff(now, &afi[cafn].restart_barrier, NULL) < 0)
+ return false;
+ return true;