[svn-commits] sruffell: linux/trunk r5433 - /linux/trunk/drivers/dahdi/dahdi_transcode.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Dec 4 14:55:26 CST 2008


Author: sruffell
Date: Thu Dec  4 14:55:25 2008
New Revision: 5433

URL: http://svn.digium.com/view/dahdi?view=rev&rev=5433
Log:
Do not use an already built channel if the source and destination formats do
not match the formats we want. This fixes a regression introduced by the new
transcoder interface where a translation path from one complex codec to
another can result in garbled audio.

Modified:
    linux/trunk/drivers/dahdi/dahdi_transcode.c

Modified: linux/trunk/drivers/dahdi/dahdi_transcode.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/dahdi_transcode.c?view=diff&rev=5433&r1=5432&r2=5433
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_transcode.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_transcode.c Thu Dec  4 14:55:25 2008
@@ -179,8 +179,8 @@
 
 /* Find a free channel on the transcoder and mark it busy. */
 static inline struct dahdi_transcoder_channel *
-get_free_channel(struct dahdi_transcoder *tc)
-
+get_free_channel(struct dahdi_transcoder *tc,
+	const struct dahdi_transcoder_formats *fmts)
 {
 	struct dahdi_transcoder_channel *chan;
 	int i;
@@ -190,8 +190,18 @@
 	for (i = 0; i < tc->numchannels; i++) {
 		chan = &tc->channels[i];
 		if (!dahdi_tc_is_busy(chan)) {
-			dahdi_tc_set_busy(chan);
-			return chan;
+			if (!dahdi_tc_is_built(chan)) {
+				dahdi_tc_set_busy(chan);
+				return chan;
+			} else {
+				/* If the channel is already built, we must
+				 * make sure that it can support the formats
+				 * that we're interested in. */
+				if ((fmts->srcfmt|fmts->dstfmt) == chan->built_fmts) {
+					dahdi_tc_set_busy(chan);
+					return chan;
+				}
+			}
 		}
 	}
 	return NULL;
@@ -216,7 +226,7 @@
 			/* We found a transcoder that can handle our formats.
 			 * Now look for an available channel. */
 			match = 1; 
-			if ((chan = get_free_channel(tc))) {
+			if ((chan = get_free_channel(tc, fmts))) {
 				/* transcoder tc has a free channel.  In order
 				 * to spread the load among available
 				 * transcoders (when there are more than one




More information about the svn-commits mailing list