shithub: opusfile

Download patch

ref: 49233ebf56be60e811cd30913eb75edc7762af0a
parent: a5a9911640f2bda3f33f28edc5698e28e5f17c0b
author: Timothy B. Terriberry <[email protected]>
date: Wed Aug 28 19:58:40 EDT 2013

Remove some OP_UNLIKELY macros.

These were unlikely when I originally expected applications to
 normally provide a decode buffer in the right format of sufficient
 size.
However, the decode filter API works by asking to decode into a
 0-byte buffer, which will trigger both of these tests on every
 packet.
Since this is how three of the four decoding APIs are implemented,
 this is not really that unlikely anymore.

--- a/src/opusfile.c
+++ b/src/opusfile.c
@@ -2638,10 +2638,8 @@
       od_buffer_pos=_of->od_buffer_pos;
       nsamples=_of->od_buffer_size-od_buffer_pos;
       /*If we have buffered samples, return them.*/
-      if(OP_UNLIKELY(nsamples>0)){
-        if(OP_UNLIKELY(nsamples*nchannels>_buf_size)){
-          nsamples=_buf_size/nchannels;
-        }
+      if(nsamples>0){
+        if(nsamples*nchannels>_buf_size)nsamples=_buf_size/nchannels;
         memcpy(_pcm,_of->od_buffer+nchannels*od_buffer_pos,
          sizeof(*_pcm)*nchannels*nsamples);
         od_buffer_pos+=nsamples;