Fixes mixed declaration and code
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 19 May 2017 20:18:01 +0000 (16:18 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 19 May 2017 20:18:01 +0000 (16:18 -0400)
src/opusenc.c

index c883862..31a26da 100644 (file)
@@ -373,9 +373,10 @@ static void init_stream(OggOpusEnc *enc) {
 
   /*Write header*/
   {
+    int packet_size;
     unsigned char *p;
     p = oggp_get_packet_buffer(enc->oggp, 276);
-    int packet_size = opus_header_to_packet(&enc->header, p, 276);
+    packet_size = opus_header_to_packet(&enc->header, p, 276);
     if (enc->packet_callback) enc->packet_callback(enc->packet_callback_data, p, packet_size, 0);
     oggp_commit_packet(enc->oggp, packet_size, 0, 0);
     oe_flush_page(enc);
@@ -652,8 +653,8 @@ int ope_encoder_continue_new_file(OggOpusEnc *enc, const char *path, OggOpusComm
 
 /* Ends the stream and create a new file (callback-based). */
 int ope_encoder_continue_new_callbacks(OggOpusEnc *enc, void *user_data, OggOpusComments *comments) {
-  if (enc->unrecoverable) return OPE_UNRECOVERABLE;
   EncStream *new_stream;
+  if (enc->unrecoverable) return OPE_UNRECOVERABLE;
   assert(enc->streams);
   assert(enc->last_stream);
   new_stream = stream_create(comments);