[Tremor] Some issues with Nicholas' comment truncation patch

Andy Grundman andy at slimdevices.com
Sat Jan 24 14:28:25 PST 2009


Good news, I fixed a few bugs in the truncation code that were  
preventing some files from playing.  It now appears that I can play  
files with any size comments!

The first fix I made was to only truncate if we're processing the  
comment header.  Some files have codebooks that are > 4K and we can't  
truncate those.  This is just a simple matter of creating a new  
ogg_stream_packetout function that passes a truncate flag down to  
_span_queued_page.

In _fetch_headers:

       if (i==1) {
         // special packetout function for truncating the comment header
         result=ogg_stream_packetout_truncate(vf->os,&op);
       }
       else {
         result=ogg_stream_packetout(vf->os,&op);
       }

The second fix that was needed was to check if FINFLAG was set on os- 
 >body_fill before truncating.  This was preventing several files from  
playing, while others would work fine:

         if (truncate) {
           if( !(os->body_fill&FINFLAG) && (os->body_fill&0x0FFFFFFF)  
 > 4145 ) {
             os->body_head=ogg_buffer_posttruncate(os->body_tail, os- 
 >body_fill-1024);
             os->body_fill = 1024;
             os->has_been_trunc = 1;
           }
         }

-Andy


More information about the Tremor mailing list