GNOME Bugzilla – Bug 614317
[oss4] should always accept PCM in native endianness even if the hardware doesn't
Last modified: 2010-04-08 09:20:19 UTC
Created attachment 157442 [details] [review] patch fixing problem Jan Schmidt did the following analysis about this bug: I did some investigating. What I discovered is: * audiotestsrc and audioresample operate on native-endian samples only - ie big-endian on SPARC. * audioconvert supports both big endian and little endian samples * oss4sink on this machine supports *only* 16-bit little-endian samples. This means that the pipeline cannot work, because audioresample and oss4sink support no common format - one is big endian, and the other is little. In that case, negotiation (correctly) fails. The pipeline 'audiotestsrc ! audioconvert ! audioresample ! audioconvert ! oss4sink' does work fine, because the extra audioconvert provides the big-endian to little-endian sample conversion. I'm not sure what the best solution is here. Options include: * Enhance audioresample to also be able to operate on non-native-endianness sample formats. This probably doesn't help playbin, because it's also inserting a 'volume' element - which also only supports native-endianness. * Extend OSSv4 to support sample format conversion internally. * Add an extra audioconvert into pipelines like the one playbin builds to ensure negotiation can happen. The attached patch fixes the problem by enhancing the OSS plugin to handle endian conversion internally. More information is here: http://defect.opensolaris.org/bz/show_bug.cgi?id=9375
In my review of the OSS code we are using and the latest upstream code, this is the only change we have applied that is not yet upstream.
Created attachment 157469 [details] [review] oss4: also accept formats not natively supported I think it's reasonable to expect that an audiosink supports PCM in native endianness, and if playbin doesn't get this stuff right, no other application will, so I agree that oss4sink is the right place to fix this. However, I actually had to read through the Sun bug report to make sense of this patch, so I propose an alternative patch with a few more comments. It should (hopefully) do the same thing, but I haven't had a chance to test it yet. Would be great if you could test it and confirm it does the right thing.
Thanks, Tim. I have verified your patch, it works on my sparc. with gstreamer 0.10.25.
Great, thanks for testing. Committed this then: commit cd4099db89ff4b2ebbb3329a643a2a8a1ef0db05 Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Tue Mar 30 11:43:04 2010 +0100 oss4: also accept formats not natively supported Also accept formats that are not natively supported by the hardware, OSS4 can convert them internally. List the native formats first in the caps though, to express our preference for the native formats. We need this in order to support the case properly where the audio hardware supports only e.g. little endian PCM, but the host is big endian, since many audio elements only support native endianness and make the reasonable assumption that any audiosink will be able to handle audio in native endianness. Based on patch by Jerry Tan <jerry.tan@sun.com> Fixes #614317.