shithub: opusfile

Download patch

ref: efc0d57af6862fb77b3a0fad21d32c6fd42106d8
parent: 2862e2eaf4d655d6aaa358f8dc76068f4f49a1fb
author: Timothy B. Terriberry <[email protected]>
date: Tue May 7 16:20:44 EDT 2013

Fix 255 packet assertion.

If we actually have 255 packets on a page, this assertion always
 triggers, because ogg_stream_packetout doesn't fail until we ask
 for the _next_ packet.

--- a/src/opusfile.c
+++ b/src/opusfile.c
@@ -768,9 +768,6 @@
   total_duration=0;
   for(;;){
     int ret;
-    /*Unless libogg is broken, we can't get more than 255 packets from a
-       single page.*/
-    OP_ASSERT(op_count<255);
     /*This takes advantage of undocumented libogg behavior that returned
        ogg_packet buffers are valid at least until the next page is
        submitted.
@@ -788,6 +785,9 @@
       total_duration=OP_HOLE;
       break;
     }
+    /*Unless libogg is broken, we can't get more than 255 packets from a
+       single page.*/
+    OP_ASSERT(op_count<255);
     _durations[op_count]=op_get_packet_duration(_of->op[op_count].packet,
      _of->op[op_count].bytes);
     if(OP_LIKELY(_durations[op_count]>0)){