GNOME Bugzilla – Bug 336824
[mad] returns incorrect duration to queries in BYTES format
Last modified: 2006-04-21 19:40:36 UTC
Please describe the problem: The gstmad plugin returns incorrect estimations for the position/duration if queried for the format bytes. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 62532 [details] [review] Patch to fix problem This patch makes the mad plugin calculate the position/duration in bytes based on the past average compression rate.
IMHO mad should just return FALSE to queries in format BYTE. It's a completely useless query on decoder source pads, I don't see why we need that for raw audio format streams. Is there a particular use case you have in mind for this? (Also, in the patch, mad->in and mad->out should be reset to 0 in the state change function).
Created attachment 62777 [details] [review] Patch to fix problem This patch resets mad->in and mad->out to 0 when changing state (as you suggested). I wouldn't call queries for the size in bytes useless - you may want to know the size of the output file in case of conversion between formats.
Should be fixed now: 2006-04-21 Tim-Philipp Müller <tim at centricular dot net> * ext/mad/gstmad.c: (gst_mad_src_query): Fix duration query in BYTES format (#336824). Not using your patch as it breaks duration quering in TIME format for raw mp3 streams. Also, I think the result of the BYTES query should directly correlate with the result of a TIME/DEFAULT query and not be based on a different average than those two.