I've been working on Web Audio, which needs support for arbitrary numbers of channels, and has to interface with the rest of our media code via the MediaStreamGraph.
It seems to me the sanest way to handle multi-channel audio is to agree on a standard set of channel layouts (one per number of channels) and use them consistently within Gecko. This means codecs need to produce those layouts (and not downmix!) and audio output (AudioStream, libcubeb) needs to consume them, and potentially downmix for platforms that can't do it themselves. Since Web Audio needs standard layouts, I suggest we use those. The current spec for them is here: https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#ChannelLayouts There's ongoing discussion in public-audio about how to extend those to cover more channels. We can track whatever happens there. At some point we'll probably need to support variable/custom layouts, which will require passing around some kind of metadata with audio buffers, but I think we shouldn't worry about that now. Web Audio specifies standard up-mixing and down-mixing. Those will have to be implemented for Web Audio, but we can use alternative up-mix and down-mix code for other use-cases (such as playing back media files) if we want to provide higher quality. I think we should share the code behind the same interface though. http://pastebin.mozilla.org/2059726 is the API I've come up with so far. Since I don't actually know what I'm doing, comments appreciated. (I suppose that high-quality mixing might need to be stateful, in which case we probably would define a different interface for that.) Rob -- Jesus called them together and said, “You know that the rulers of the Gentiles lord it over them, and their high officials exercise authority over them. Not so with you. Instead, whoever wants to become great among you must be your servant, and whoever wants to be first must be your slave — just as the Son of Man did not come to be served, but to serve, and to give his life as a ransom for many.” [Matthew 20:25-28] _______________________________________________ dev-media mailing list [email protected] https://lists.mozilla.org/listinfo/dev-media

