diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2009-01-15 14:53:18 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2009-01-15 14:53:18 +0000 |
commit | 293671170e3d008c73cdf6b0e56bbb730726c633 (patch) | |
tree | 5de378f68d75f95161e9424f0ff661212ccabfc2 | |
parent | 9ee7150985a734fa9504599b301f5f94ad9cd195 (diff) |
gst/qtdemux/qtdemux.c: Catch invalid and commonly wrong playback rates in the elst atoms.
Original commit message from CVS:
* gst/qtdemux/qtdemux.c: (qtdemux_parse_segments):
Catch invalid and commonly wrong playback rates in the elst atoms.
Fixes #567800.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gst/qtdemux/qtdemux.c | 17 |
2 files changed, 20 insertions, 3 deletions
@@ -1,3 +1,9 @@ +2009-01-15 Wim Taymans <wim.taymans@collabora.co.uk> + + * gst/qtdemux/qtdemux.c: (qtdemux_parse_segments): + Catch invalid and commonly wrong playback rates in the elst atoms. + Fixes #567800. + 2009-01-15 Sebastian Dröge <sebastian.droege@collabora.co.uk> * gst/spectrum/gstspectrum.c: (gst_spectrum_reset_state): diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index ba11e7af..f34d2f44 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -3247,6 +3247,7 @@ qtdemux_parse_segments (GstQTDemux * qtdemux, QtDemuxStream * stream, guint64 duration; guint64 media_time; QtDemuxSegment *segment; + guint32 rate_int; media_time = QT_UINT32 (buffer + 20 + i * 12); @@ -3269,13 +3270,23 @@ qtdemux_parse_segments (GstQTDemux * qtdemux, QtDemuxStream * stream, segment->media_start = gst_util_uint64_scale (media_time, GST_SECOND, stream->timescale); segment->media_stop = segment->media_start + segment->duration; - segment->rate = QT_FP32 (buffer + 24 + i * 12); + rate_int = GST_READ_UINT32_BE (buffer + 24 + i * 12); + + if (rate_int <= 1) { + /* 0 is not allowed, some programs write 1 instead of the floating point + * value */ + GST_WARNING_OBJECT (qtdemux, "found suspicious rate %" G_GUINT32_FORMAT, + rate_int); + segment->rate = 1; + } else { + segment->rate = rate_int / 65536.0; + } GST_DEBUG_OBJECT (qtdemux, "created segment %d time %" GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT ", media_time %" GST_TIME_FORMAT - ", rate %g", i, GST_TIME_ARGS (segment->time), + ", rate %g, (%d)", i, GST_TIME_ARGS (segment->time), GST_TIME_ARGS (segment->duration), - GST_TIME_ARGS (segment->media_start), segment->rate); + GST_TIME_ARGS (segment->media_start), segment->rate, rate_int); } GST_DEBUG_OBJECT (qtdemux, "found %d non-empty segments", count); stream->n_segments = count; |