From bb1561644f47dcf3991fccb2d8ad64dc766c73f0 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Tue, 26 May 2009 22:43:34 +0200 Subject: [PATCH] theoraparse: fix assertions in make_granulepos when using the new theora granulepos mapping. Fixes #583903. --- ext/theora/theoraparse.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ext/theora/theoraparse.c b/ext/theora/theoraparse.c index 3d46a91..ed5e57e 100644 --- a/ext/theora/theoraparse.c +++ b/ext/theora/theoraparse.c @@ -408,17 +408,24 @@ theora_parse_clear_queue (GstTheoraParse * parse) static gint64 make_granulepos (GstTheoraParse * parse, gint64 keyframe, gint64 frame) { + gint64 iframe; + if (keyframe == -1) keyframe = 0; - /* If using newer theora, offset the granulepos by +1, see comment - * in theora_parse_set_streamheader */ + /* If using newer theora, offset the granulepos by +1, see comment in + * theora_parse_set_streamheader. + * + * We don't increment keyframe directly, as internally we always index frames + * starting from 0 and we do some sanity checking below. */ if (!parse->is_old_bitstream) - keyframe += 1; + iframe = keyframe + 1; + else + iframe = keyframe; g_return_val_if_fail (frame >= keyframe, -1); g_return_val_if_fail (frame - keyframe < 1 << parse->shift, -1); - return (keyframe << parse->shift) + (frame - keyframe); + return (iframe << parse->shift) + (frame - keyframe); } static void -- 2.7.4