shithub: opusfile

Download patch

ref: ee911775715d0b3721938cad2e21823fe4b19bd7
parent: 773cd69efd60d4db2f13c7eab2a9447102af15f1
author: Timothy B. Terriberry <tterribe@xiph.org>
date: Sun Mar 16 06:24:33 EDT 2014

Fix header reading for non-Opus streams.

We were skipping the BOS page for non-Opus streams, but never read
 in the next page, causing setup to fail with a duplicate serial
 number validation error.
Thanks to Lithopsian for the report.

--- a/src/opusfile.c
+++ b/src/opusfile.c
@@ -496,13 +496,14 @@
       ogg_stream_pagein(&_of->os,_og);
       if(OP_LIKELY(ogg_stream_packetout(&_of->os,&op)>0)){
         ret=opus_head_parse(_head,op.packet,op.bytes);
-        /*If it's just a stream type we don't recognize, ignore it.*/
-        if(ret==OP_ENOTFORMAT)continue;
-        /*Everything else is fatal.*/
-        if(OP_UNLIKELY(ret<0))return ret;
+        if(OP_UNLIKELY(ret<0)){
+          /*If it's just a stream type we don't recognize, ignore it.
+            Everything else is fatal.*/
+          if(ret!=OP_ENOTFORMAT)return ret;
+        }
         /*Found a valid Opus header.
           Continue setup.*/
-        _of->ready_state=OP_STREAMSET;
+        else _of->ready_state=OP_STREAMSET;
       }
     }
     /*Get the next page.