From 773cd69efd60d4db2f13c7eab2a9447102af15f1 Mon Sep 17 00:00:00 2001
From: "Timothy B. Terriberry" <tterribe@xiph.org>
Date: Tue, 11 Mar 2014 20:25:10 -0700
Subject: [PATCH] Minor simplification to op_fetch_headers_impl().

---
 src/opusfile.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/opusfile.c b/src/opusfile.c
index 392ddb2..1289504 100644
--- a/src/opusfile.c
+++ b/src/opusfile.c
@@ -512,14 +512,10 @@ static int op_fetch_headers_impl(OggOpusFile *_of,OpusHead *_head,
      OP_ADV_OFFSET(_of->offset,OP_CHUNK_SIZE))<0)){
       return OP_ENOTFORMAT;
     }
-    /*If this page also belongs to our Opus stream, submit it and break.*/
-    if(_of->ready_state==OP_STREAMSET
-     &&_of->os.serialno==ogg_page_serialno(_og)){
-      ogg_stream_pagein(&_of->os,_og);
-      break;
-    }
   }
   if(OP_UNLIKELY(_of->ready_state!=OP_STREAMSET))return OP_ENOTFORMAT;
+  /*If the first non-header page belonged to our Opus stream, submit it.*/
+  if(_of->os.serialno==ogg_page_serialno(_og))ogg_stream_pagein(&_of->os,_og);
   /*Loop getting packets.*/
   for(;;){
     switch(ogg_stream_packetout(&_of->os,&op)){
-- 
GitLab