ref: f4f3148a41208465fdd66e07fb6dc705d918ed7f
parent: 1f0c93b20d5425f9973e86406ae9d788830ef4fd
author: Ralph Giles <[email protected]>
date: Tue Sep 4 10:41:01 EDT 2012
Reject playback of multichannel files through sys/soundcard.h. Previously we wrote out the n channel data to an fd configured for mono output, which doesn't sound very good. Better to reject it. There is a SNDCTL_DSP_CHANNELS we can use to request multichannel output, but there doesn't seem to be a way to set the channel mapping, so it's not much better.
--- a/src/opusdec.c
+++ b/src/opusdec.c
@@ -305,6 +305,17 @@
quit(1);
}
+ if (*channels > 2)
+ {
+ /* There doesn't seem to be a way to get or set the channel
+ * matrix with the sys/soundcard api, so we can't support
+ * multichannel. We should fall back to stereo downmix.
+ */
+ fprintf(stderr, "Cannot configure multichannel playback."
+ " Try decoding to a file instead.\n");
+ close(audio_fd);
+ quit(1);
+ }
stereo=0;
if (*channels==2)
stereo=1;