*/
unsigned samplerate;
/**
- * the number of channels, also given by command line option or the
- * decoder of the writer node group
+ * The number of channels, given by command line option or the
+ * decoder of the writer node group.
*/
unsigned channels;
};
{
struct private_alsa_write_data *pad = wn->private_data;
PARA_INFO_LOG("closing writer node %p\n", wn);
- snd_pcm_drain(pad->handle);
- snd_pcm_close(pad->handle);
- snd_config_update_free_global();
+
+ if (pad->handle) {
+ snd_pcm_drain(pad->handle);
+ snd_pcm_close(pad->handle);
+ snd_config_update_free_global();
+ }
free(pad);
}
FOR_EACH_FECDEC_GROUP(fg, pfd) {
if (fg->h.group_num != h->group_num)
continue;
+ if (fg->num_received_slices == 0)
+ goto success;
if (fg->h.slices_per_group != h->slices_per_group)
- continue;
+ return -E_BAD_FEC_HEADER;
if (fg->h.data_slices_per_group != h->data_slices_per_group)
- continue;
+ return -E_BAD_FEC_HEADER;
+ if (fg->h.group_bytes != h->group_bytes)
+ return -E_BAD_FEC_HEADER;
+success:
*result = fg;
return 1;
}
}
if (!group_complete(oldest) && !group_empty(oldest))
PARA_WARNING_LOG("Clearing incomplete group %d "
- "(contains %d slices)\n", fg->h.group_num,
- fg->num_received_slices);
+ "(contains %d slices)\n", oldest->h.group_num,
+ oldest->num_received_slices);
clear_group(oldest);
return oldest;
}