According to the Ogg specification, an ogg page that doesn't have any

packets ending on it (which commonly happens with video keyframes, for 
instance) must have a granulepos of -1. 

libogg never implemented this correctly; this patch ensures it does.

svn path=/trunk/ogg/; revision=9598
This commit is contained in:
Mike Smith 2005-07-22 16:39:42 +00:00
parent a84a79abbb
commit 5d4aa6d6cb

View File

@ -336,7 +336,7 @@ int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
int maxvals=(os->lacing_fill>255?255:os->lacing_fill);
int bytes=0;
long acc=0;
ogg_int64_t granule_pos=os->granule_vals[0];
ogg_int64_t granule_pos=-1;
if(maxvals==0)return(0);
@ -357,7 +357,8 @@ int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
for(vals=0;vals<maxvals;vals++){
if(acc>4096)break;
acc+=os->lacing_vals[vals]&0x0ff;
granule_pos=os->granule_vals[vals];
if((os->lacing_vals[vals]&0xff)<255)
granule_pos=os->granule_vals[vals];
}
}