- if (*cwt->loaded < WAV_HEADER_LEN) {
- if (*cwt->input_error < 0)
- t->error = *cwt->input_error;
- return;
- }
- cwt->channels = 2;
- cwt->samplerate = 44100;
- a = (unsigned char*)cwt->buf;
- if (a[0] != 'R' || a[1] != 'I' || a[2] != 'F' || a[3] != 'F') {
- PARA_NOTICE_LOG("wav header not found\n");
- t->error = -E_NO_WAV_HEADER;
- goto out;
- }
- cwt->channels = (unsigned) a[22];
- cwt->samplerate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24);
- *cwt->loaded -= WAV_HEADER_LEN;
- memmove(cwt->buf, cwt->buf + WAV_HEADER_LEN, *cwt->loaded);
- t->error = -E_WAV_HEADER_SUCCESS;
- PARA_INFO_LOG("channels: %d, sample rate: %d\n", cwt->channels, cwt->samplerate);
-out:
- wng->channels = &cwt->channels;
- wng->samplerate = &cwt->samplerate;
- ret = wng_open(wng);
- if (ret < 0)
- t->error = ret;
- s->timeout.tv_sec = 0;
- s->timeout.tv_usec = 1;
-}
-
-static void check_wav_pre_select_btr(__a_unused struct sched *s, struct task *t)
-{
- struct check_wav_task_btr *cwt = container_of(t, struct check_wav_task_btr, task);
-
- if (btr_get_input_queue_size(cwt->btrn) < WAV_HEADER_LEN)
- return;
- s->timeout.tv_sec = 0;
- s->timeout.tv_usec = 1;