GNOME Bugzilla – Bug 380199
[matroskademux] Wrong framerate conversion
Last modified: 2006-12-11 14:00:51 UTC
When default block duration is converted to framerate, fps is accidentaly converted to integer. As result, framerates < 1 are interpreted as fraction 0/1 Patch follows.
Created attachment 77300 [details] [review] Patch to convert to gdouble correctly As I do not know about guint64 to gdouble conversion limitations on some platforms, I have done the fix this way. May be context->default_duration should be converted by gst_guint64_to_gdouble too.
Created attachment 78127 [details] [review] alternative patch for default framerate in caps Does this patch also make things work fine for you? I think it's better to save the float value we extract and re-use it here than to do two 1/N calculations including uint64/double conversion. Also, the reason for the gst_guint64_to_gdouble() is that some compilers (MSVC) apparently can't convert double <=> guint64 by just casting, so it needs to be used on context->default_duration not GST_SECOND here (GST_SECOND still fits into an int IIRC).
Hi Tim, I have checked your patch and it works in my scenario. Duration <=> FPS conversion works well.
Great, thanks for testing! 2006-12-11 Tim-Philipp Müller <tim at centricular dot net> * gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream), (gst_matroska_demux_video_caps): * gst/matroska/matroska-ids.c: (gst_matroska_track_init_video_context): * gst/matroska/matroska-ids.h: Try harder to extract the framerate for video tracks correctly and save it directly instead of converting it back and forth a few times. Mostly makes a difference for very small framerates (<1). Fixes #380199.