diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-11-18 19:07:53 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-11-18 19:11:51 +0200 |
commit | b404b2239a628917540252b7a0bf8b2d9506bf3a (patch) | |
tree | a8f5753f51a4c4e4dc3f5a765a44be67f96db4b6 | |
parent | 40aa27b788c0b13250312d3f876406b27229a91a (diff) |
qtdemux: Cast to signed integers to prevent unsigned compare between negative and positive numbers
This fixes seeking if the first entries in the samples table are negative. The
binary search would always fail on this as the array would not be sorted if
interpreting the negative numbers as huge positive numbers. This caused us to
always output buffers from the beginning after a seek instead of close to the
seek position.
Also add a case to the comparison function for equality.
-rw-r--r-- | gst/isomp4/qtdemux.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index f2c8c73f2..c15406081 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -991,10 +991,12 @@ typedef struct } FindData; static gint -find_func (QtDemuxSample * s1, guint64 * media_time, gpointer user_data) +find_func (QtDemuxSample * s1, gint64 * media_time, gpointer user_data) { - if (s1->timestamp + s1->pts_offset > *media_time) + if ((gint64) s1->timestamp + s1->pts_offset > *media_time) return 1; + if ((gint64) s1->timestamp + s1->pts_offset == *media_time) + return 0; return -1; } |