[Tremor] ov_pcm_seek_page stuck on 1st page if non-Vorbis packet

Dave Milici davemilici at sbcglobal.net
Thu Aug 5 18:17:54 PDT 2010


Hi all--

We have been using Tremor codec modified to handle Ogg streams with interleaved Theora & Vorbis packets.

One of our audio developers encountered an interesting bug when attempting to seek to the beginning of the audio stream. The Tremor codec loops indefinitely inside ov_pcm_seek_page() stuck on the 1st page if it contains a non-Vorbis packet.

The developer noticed there was no return code being checked from ogg_stream_pagein(), so thought it was sensible to construct a do-while loop around the code which was endlessly checking the same page.

Pasted below is diff from our local svn. Comments? 

--Dave Milici

Index: vorbisfile.c
===================================================================
--- vorbisfile.c	(revision 7919)
+++ vorbisfile.c	(working copy)
@@ -1442,11 +1442,12 @@
     {
       ogg_page og;
       ogg_packet op;
-      
+      int pagein_result;
       /* seek */
       result=_seek_helper(vf,best);
       vf->pcm_offset=-1;
       if(result) goto seek_error;
+      do{
       result=_get_next_page(vf,&og,-1);
       if(result<0) goto seek_error;
       
@@ -1463,8 +1464,8 @@
       }
 
       ogg_stream_reset_serialno(&vf->os,vf->current_serialno);
-      ogg_stream_pagein(&vf->os,&og);
-
+      pagein_result = ogg_stream_pagein(&vf->os,&og);
+	  }while(pagein_result == -1);
       /* pull out all but last packet; the one with granulepos */
       while(1){
 	result=ogg_stream_packetpeek(&vf->os,&op);



More information about the Tremor mailing list