[vlc-commits] [Git][videolan/vlc][master] 2 commits: demux: ogg: do not output a sample time for streams with no timing info

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Fri May 1 14:08:33 UTC 2026



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
aa5adccb by Steve Lhomme at 2026-05-01T15:42:13+02:00
demux: ogg: do not output a sample time for streams with no timing info

The function already outputs VLC_TICK_INVALID when Ogg_ShiftPacketSample() fails.

Ref. #29809

- - - - -
ff6f387b by Steve Lhomme at 2026-05-01T15:42:13+02:00
demux: ogg: read the Skeleton presentation time

As described in the Skeleton documentation [^1].
And as done in libavformat [^2].

[^1]: https://xiph.org/ogg/doc/skeleton.html
[^2]: https://code.ffmpeg.org/FFmpeg/FFmpeg/src/branch/master/libavformat/oggparseskeleton.c#L58

- - - - -


2 changed files:

- modules/demux/ogg.c
- modules/demux/ogg_granule.c


Changes:

=====================================
modules/demux/ogg.c
=====================================
@@ -52,6 +52,8 @@
 #include "ogg_granule.h"
 #include "opus.h"
 
+#include <limits.h>
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -3230,13 +3232,26 @@ static void Ogg_ReadSkeletonHeader( demux_t *p_demux, logical_stream_t *p_stream
                                     ogg_packet *p_oggpacket )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
-    if( p_oggpacket->bytes < 12 )
+    if( p_oggpacket->bytes < 24 )
         return;
 
     p_sys->p_skelstream = p_stream;
     /* There can be only 1 skeleton for streams */
     p_sys->skeleton.major = GetWLE( &p_oggpacket->packet[8] );
     p_sys->skeleton.minor = GetWLE( &p_oggpacket->packet[10] );
+    uint64_t presentationtime_num = GetQWLE( &p_oggpacket->packet[12] );
+    uint64_t presentationtime_den = GetQWLE( &p_oggpacket->packet[20] );
+    if ( presentationtime_num != 0 && presentationtime_den != 0 )
+    {
+        int64_t presentationtime_gcd = GCD(presentationtime_num, presentationtime_den);
+        if ( presentationtime_gcd > 1 )
+        {
+            presentationtime_num = presentationtime_num / presentationtime_gcd;
+            presentationtime_den = presentationtime_den / presentationtime_gcd;
+        }
+        if ( presentationtime_num <= UINT32_MAX && presentationtime_den <= UINT32_MAX )
+            date_Init( &p_stream->dts, presentationtime_num, presentationtime_den );
+    }
     if ( asprintf( & p_stream->fmt.psz_description,
                    "OGG Skeleton version %" PRIu16 ".%" PRIu16,
                    p_sys->skeleton.major, p_sys->skeleton.minor ) < 0 )


=====================================
modules/demux/ogg_granule.c
=====================================
@@ -172,6 +172,8 @@ vlc_tick_t Ogg_SampleToTime( const logical_stream_t *p_stream, int64_t i_sample,
         return VLC_TICK_INVALID;
 
     date_t d = p_stream->dts;
+    if ( d.i_divider_num == 0 )
+        return VLC_TICK_INVALID;
     date_Set(&d, VLC_TICK_0);
     return date_Increment( &d, i_sample );
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/379275229e068ebb3a990fe4c586e0f91e319c98...ff6f387be0bbb6485ffe07e8a9c3cbeb8da6978e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/379275229e068ebb3a990fe4c586e0f91e319c98...ff6f387be0bbb6485ffe07e8a9c3cbeb8da6978e
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list