After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 508595 - [lame] wrong output caps in mono encoding mode
[lame] wrong output caps in mono encoding mode
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
0.10.6
Other Linux
: Normal normal
: 0.10.7
Assigned To: Sebastian Dröge (slomo)
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-01-10 19:46 UTC by Mark Nauwelaerts
Modified: 2008-01-14 09:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Possible patch. (821 bytes, patch)
2008-01-10 19:48 UTC, Mark Nauwelaerts
committed Details | Review

Description Mark Nauwelaerts 2008-01-10 19:46:03 UTC
In mono encoding mode of non-mono input, lame encoder performs downmixing (resulting in 1-channel output).  However, the sink caps still retains most of the source caps (such as #channels).
Comment 1 Mark Nauwelaerts 2008-01-10 19:48:34 UTC
Created attachment 102534 [details] [review]
Possible patch.

* Indicate 1 channel in source caps in mono-encoding mode.
* Also fix calculation of duration of (last) buffer sent at EOS-time.
Comment 2 Sebastian Dröge (slomo) 2008-01-12 04:28:06 UTC
Why is this changed duration calculation correct? (and why is the old still correct for the return of lame_encode_buffer?)
Comment 3 Mark Nauwelaerts 2008-01-12 09:41:50 UTC
lame_encode_buffer/flush (lame API calls) return number of mp3 (encoded) bytes, so a calculation based on it using samplerate (etc) does not make sense.  However, (assuming CBR) based on bitrate (etc) does make sense (as it has been changed to in EOS event handling).
On the other hand, in gst_lame_chain, duration calculation is based on the input buffer size (not mp3 buffer), so it makes sense there to use samplerate.

[Using (possibly delayed) input buffer sizes for output buffer ones seems more or less approximate but OK, and can also handle VBR cases, but minor errors might accumulate up to the last-to-be-flushed buffer.  There is also no input buffer that can be used when receiving EOS, hence best shot fall-back to mp3 buffer size]
Comment 4 Sebastian Dröge (slomo) 2008-01-14 09:17:40 UTC
Ok, committed. But if you're going with _bit_ rate you should divide that value by 8 again to get the correct result. Changed that...

2008-01-14  Sebastian Dröge  <slomo@circular-chaos.org>

        Patch by: Mark Nauwelaerts <manauw at syknet dot be>

        * ext/lame/gstlame.c: (gst_lame_sink_setcaps),
        (gst_lame_sink_event):
        Correctly set number of channels when using mono-encoding mode
        and fix the duration calculation of the EOS buffer.