changeset 30836:7296ecaa30ec

Improve handling of 0-size ogg packets. Fixes bug 1664.
author reimar
date Tue, 09 Mar 2010 19:19:32 +0000
parents 264d062a3d99
children 6f68476cced7
files libmpdemux/demux_ogg.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ogg.c	Tue Mar 09 18:34:14 2010 +0000
+++ b/libmpdemux/demux_ogg.c	Tue Mar 09 19:19:32 2010 +0000
@@ -262,6 +262,7 @@
 
 static unsigned char* demux_ogg_read_packet(ogg_stream_t* os,ogg_packet* pack,float* pts,int* flags, int samplesize) {
   unsigned char* data = pack->packet;
+  int size = pack->bytes;
 
   *pts = 0;
   *flags = 0;
@@ -300,7 +301,7 @@
      /* header packets begin on 1-bit: thus check (*data&0x80).  We don't
 	have theora_state st, until all header packets were passed to the
 	decoder. */
-     if (!(*data&0x80))
+     if (!size || !(*data&0x80))
      {
         int keyframe_granule_shift=_ilog(os->keyframe_frequency_force-1);
         int64_t iframemask = (1 << keyframe_granule_shift) - 1;