Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Nov 2008 15:17:56 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 153528 for review
Message-ID:  <200811251517.mAPFHucA066915@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=153528

Change 153528 by hselasky@hselasky_laptop001 on 2008/11/25 15:16:56

	
	Make sure that the blocksize is a factor of the number of bytes
	we insert per isochronous frame.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb2/sound/uaudio2.c#18 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb2/sound/uaudio2.c#18 (text+ko) ====

@@ -1067,6 +1067,10 @@
 					sample_size = ((chan->p_asf1d->bNrChannels *
 					    chan->p_asf1d->bBitResolution) / 8);
 
+					/*
+					 * NOTE: "chan->bytes_per_frame"
+					 * should not be zero!
+					 */
 					chan->bytes_per_frame = ((rate / fps) * sample_size);
 
 					if (sc->sc_sndstat_valid) {
@@ -1432,6 +1436,16 @@
 
 	RANGE(blocksize, 128, max / 2);
 
+	/*
+	 * Make sure that the blocksize is a factor of the number of bytes
+	 * we insert per isochronous frame.
+	 */
+	blocksize += (ch->bytes_per_frame - blocksize) % ch->bytes_per_frame;
+	if (blocksize > (max / 2)) {
+		/* should not happen */
+		DPRINTFN(0, "blocksize overflow!\n");
+		blocksize = (max / 2);
+	}
 	blockcount = max / blocksize;
 	RANGE(blockcount, 2, 512);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811251517.mAPFHucA066915>