[vlc-commits] demux: ogg: keep searching for 1st page if incomplete

Francois Cartegnie git at videolan.org
Sat Mar 8 20:13:40 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Mar  7 03:33:15 2014 +0100| [a1f1c15f6c78d170a04e1b03eb915ada7ce1c9f5] | committer: Francois Cartegnie

demux: ogg: keep searching for 1st page if incomplete

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a1f1c15f6c78d170a04e1b03eb915ada7ce1c9f5
---

 modules/demux/oggseek.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/demux/oggseek.c b/modules/demux/oggseek.c
index a08d105..5b6830c 100644
--- a/modules/demux/oggseek.c
+++ b/modules/demux/oggseek.c
@@ -510,6 +510,13 @@ static int64_t find_first_page_granule( demux_t *p_demux,
             return p_sys->i_input_position;
         }
 
+        if ( ogg_page_granulepos( &p_sys->current_page ) <= 0 )
+        {
+            p_sys->i_input_position += i_result;
+            i_bytes_to_read += OGGSEEK_BYTES_TO_READ;
+            continue;
+        }
+
         // found a page
         if ( ogg_stream_pagein( &p_stream->os, &p_sys->current_page ) != 0 )
         {
@@ -772,6 +779,8 @@ int64_t Oggseek_GranuleToAbsTimestamp( logical_stream_t *p_stream,
                                        int64_t i_granule, bool b_presentation )
 {
     int64_t i_timestamp = -1;
+    if ( i_granule < 0 )
+        return -1;
 
     if ( p_stream->b_oggds )
     {
@@ -897,7 +906,7 @@ static int64_t OggBisectSearchByTime( demux_t *p_demux, logical_stream_t *p_stre
         current.i_timestamp = Oggseek_GranuleToAbsTimestamp( p_stream,
                                                              current.i_granule, false );
 
-        if ( current.i_timestamp == -1 )
+        if ( current.i_timestamp == -1 && current.i_granule > 0 )
         {
             msg_Err( p_demux, "Unmatched granule. New codec ?" );
             return -1;



More information about the vlc-commits mailing list