static int open_current_receiver(struct sched *s)
{
- int i;
struct timeval diff;
- char *audio_format = stat_task->stat_item_values[SI_FORMAT];
+ int cafn = stat_task->current_audio_format_num;
- if (!audio_format || !stat_task->pcd)
- return 0;
- i = get_audio_format_num(audio_format + strlen(
- status_item_list[SI_FORMAT]) + 1);
- if (i < 0)
+ if (cafn < 0 || !stat_task->pcd)
return 0;
- if (receiver_running(i))
+ if (receiver_running(cafn))
return 0;
- if (tv_diff(now, &afi[i].restart_barrier, &diff) < 0) {
+ if (tv_diff(now, &afi[cafn].restart_barrier, &diff) < 0) {
s->timeout = diff;
return 0;
}
- return open_receiver(i) < 0? 0 : 1;
+ return open_receiver(cafn) < 0? 0 : 1;
}
static unsigned compute_time_diff(const struct timeval *status_time)
if (stat_task->clock_diff_count)
stat_task->clock_diff_count--;
break;
+ case SI_FORMAT:
+ stat_task->current_audio_format_num = get_audio_format_num(
+ line + ilen + 1);
}
return 1;
}
st->task.private_data = st;
st->sa_time_diff_sign = 1;
st->clock_diff_count = conf.clock_diff_count_arg;
+ st->current_audio_format_num = -1;
sprintf(st->task.status, "status task");
}
unsigned clock_diff_count;
/** when to start the next check for clock difference */
struct timeval clock_diff_barrier;
+ /** Number of the audio format as announced by para_server. */
+ int current_audio_format_num;
};
extern struct status_task *stat_task;