Commit 64350e06 authored by Michael Smith's avatar Michael Smith
Browse files

Calculate number of samples correctly for any number of channels, so we don't

overrun our destination array for > 2 channels.


git-svn-id: https://svn.xiph.org/trunk/Tremor@13794 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent e4241cfb
......@@ -1564,13 +1564,8 @@ long ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){
long channels=ov_info(vf,-1)->channels;
if(channels==1){
if(samples>(bytes_req/2))
samples=bytes_req/2;
}else{
if(samples>(bytes_req/4))
samples=bytes_req/4;
}
if(samples>(bytes_req/(2*channels)))
samples=bytes_req/(2*channels);
for(i=0;i<channels;i++) { /* It's faster in this order */
ogg_int32_t *src=pcm[i];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment