[vlc-commits] demux: ogg: check first frame granule index

Francois Cartegnie git at videolan.org
Wed Feb 13 19:00:38 CET 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Feb 13 17:58:53 2019 +0100| [e81b889d9820a2a6e3c51a8d8a27fb89864a17d6] | committer: Francois Cartegnie

demux: ogg: check first frame granule index

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

 modules/demux/ogg_granule.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/demux/ogg_granule.c b/modules/demux/ogg_granule.c
index d10e91a540..87b05d5f3e 100644
--- a/modules/demux/ogg_granule.c
+++ b/modules/demux/ogg_granule.c
@@ -100,6 +100,9 @@ static int64_t Ogg_GranuleToSample( const logical_stream_t *p_stream, int64_t i_
     switch( p_stream->fmt.i_codec )
     {
         case VLC_CODEC_THEORA:
+            if( p_stream->i_first_frame_index == 0 && !p_stream->b_oggds )
+                i_granule++;
+            /* fallthrough */
         case VLC_CODEC_DAALA:
         case VLC_CODEC_KATE:
         {
@@ -176,7 +179,7 @@ vlc_tick_t Ogg_SampleToTime( const logical_stream_t *p_stream, int64_t i_sample,
 bool Ogg_GranuleIsValid( const logical_stream_t *p_stream, int64_t i_granule )
 {
     /* First frame in ogm is 0 (0[header] 0[frame] -1 2 3 -1 5 ...) */
-    return !( i_granule < 1 - !!p_stream->b_oggds );
+    return !( i_granule < p_stream->i_first_frame_index - !!p_stream->b_oggds );
 }
 
 vlc_tick_t Ogg_GranuleToTime( const logical_stream_t *p_stream, int64_t i_granule,



More information about the vlc-commits mailing list