oggdemux: only keep last valid granulepos
authorWim Taymans <wim.taymans@collabora.co.uk>
Tue, 12 Oct 2010 14:03:36 +0000 (16:03 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 12 Oct 2010 14:06:57 +0000 (16:06 +0200)
Only keep the last valid granulepos we see when scanning the last
pages. It is possible that the last page that we inspect has a -1 granulepos, in
which case we want to keep the previous valid time instead.

Fixes #631703

ext/ogg/gstoggdemux.c

index c4e64c8..bb20a81 100644 (file)
@@ -2827,9 +2827,9 @@ gst_ogg_demux_read_end_chain (GstOggDemux * ogg, GstOggChain * chain)
         if (pad->map.serialno == ogg_page_serialno (&og)) {
           gint64 granulepos = ogg_page_granulepos (&og);
 
-          last_granule = granulepos;
-          last_pad = pad;
-          if (last_granule != -1) {
+          if (granulepos != -1) {
+            last_granule = granulepos;
+            last_pad = pad;
             done = TRUE;
           }
           break;