GNOME Bugzilla – Bug 430677
[audioconvert] does not preserve channel positions when fixating
Last modified: 2007-10-31 18:33:05 UTC
Currently, audioconvert does not pass the channel positions, which disallows i.e. recoding from DTS do AC3, because dtsdec produces float samples while ffmpeg AC3 encoder accents only integers.
The attached patch ensures that the position information is passed when the channel count does not change.
Created attachment 86499 [details] [review]
I wonder if the channel positions shouldn't always be set in the outcaps... Currently when converting I see no place where the channel positions are set so the channel positions in the output are more or less undefined unless I'm mistaken.
Other than that, if the channel positions were set before, this patch looks fine IMHO... having someone who knows a bit more about the channel position business take a look at it would be better before committing though :)
I noticed this issue as well when working on bug #398033.
I think we really need some unit tests for this stuff (there might already be one or two related tests in the patch for the other bug to build on, but we need to check down/upmixing too both for channels >2 and <=2).
*** Bug 490184 has been marked as a duplicate of this bug. ***
Created attachment 97911 [details] [review]
don't loose channel positions
Behavior of this patch:
- if no channel up/down-mixing keep the same channel-positions.
- if up/down-mixing use the channel-positions from the otherpeer.
If channel positions are not present, add the default channel positions and give a warning that there is a multichannel element without proper channel positions.
I think we need something a bit more elaborate here, since there's no guarantee the possible output caps have a fixed channel layout (it may be a list of possible layouts), or -- in case that input and output have the same number of channels -- that downstream can do the input channel layout:
2007-10-31 Tim-Philipp Müller <tim at centricular dot net>
* gst/audioconvert/gstaudioconvert.c: (find_suitable_channel_layout),
Preserve channel layout when fixating the number of channels in the
output caps, or make sure there's a suitable channel position layout
set on the caps if required. Fixes #430677.
(Thijs: also, you probably meant to fixate first and only read the number of output channels fixated to after that :)).
Please test and re-open if it doesn't work right.