static unsigned int get_stream_frame_size()

in most_usb.c [193:223]


static unsigned int get_stream_frame_size(struct device *dev,
					  struct most_channel_config *cfg)
{
	unsigned int frame_size;
	unsigned int sub_size = cfg->subbuffer_size;

	if (!sub_size) {
		dev_warn(dev, "Misconfig: Subbuffer size zero.\n");
		return 0;
	}
	switch (cfg->data_type) {
	case MOST_CH_ISOC:
		frame_size = AV_PACKETS_PER_XACT * sub_size;
		break;
	case MOST_CH_SYNC:
		if (cfg->packets_per_xact == 0) {
			dev_warn(dev, "Misconfig: Packets per XACT zero\n");
			frame_size = 0;
		} else if (cfg->packets_per_xact == 0xFF) {
			frame_size = (USB_MTU / sub_size) * sub_size;
		} else {
			frame_size = cfg->packets_per_xact * sub_size;
		}
		break;
	default:
		dev_warn(dev, "Query frame size of non-streaming channel\n");
		frame_size = 0;
		break;
	}
	return frame_size;
}