cleanup
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 12 May 2017 22:20:44 +0000 (18:20 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 12 May 2017 22:20:44 +0000 (18:20 -0400)
src/opusenc.c

index 7efbe4a..50a08f6 100644 (file)
@@ -435,17 +435,15 @@ static void encode_buffer(OggOpusEnc *enc) {
     assert(nbBytes > 0);
     enc->curr_granule += enc->frame_size;
     do {
+      unsigned char *p;
       opus_int64 granulepos;
       granulepos=enc->curr_granule-enc->streams->granule_offset;
       e_o_s=enc->curr_granule >= end_granule48k;
       cont = 0;
       if (e_o_s) granulepos=end_granule48k-enc->streams->granule_offset;
-      {
-        unsigned char *p;
-        p = oggp_get_packet_buffer(enc->oggp, MAX_PACKET_SIZE);
-        memcpy(p, packet, nbBytes);
-        oggp_commit_packet(enc->oggp, nbBytes, granulepos, e_o_s);
-      }
+      p = oggp_get_packet_buffer(enc->oggp, MAX_PACKET_SIZE);
+      memcpy(p, packet, nbBytes);
+      oggp_commit_packet(enc->oggp, nbBytes, granulepos, e_o_s);
       if (enc->packet_callback) enc->packet_callback(enc->packet_callback_data, packet, nbBytes, 0);
       /* FIXME: Also flush on too many segments. */
       if (e_o_s) oe_flush_page(enc);
@@ -468,12 +466,9 @@ static void encode_buffer(OggOpusEnc *enc) {
         init_stream(enc);
         if (enc->chaining_keyframe) {
           opus_int64 granulepos2=enc->curr_granule - enc->streams->granule_offset - enc->frame_size;
-          {
-            unsigned char *p;
-            p = oggp_get_packet_buffer(enc->oggp, MAX_PACKET_SIZE);
-            memcpy(p, enc->chaining_keyframe, enc->chaining_keyframe_length);
-            oggp_commit_packet(enc->oggp, enc->chaining_keyframe_length, granulepos2, 0);
-          }
+          p = oggp_get_packet_buffer(enc->oggp, MAX_PACKET_SIZE);
+          memcpy(p, enc->chaining_keyframe, enc->chaining_keyframe_length);
+          oggp_commit_packet(enc->oggp, enc->chaining_keyframe_length, granulepos2, 0);
           if (enc->packet_callback) enc->packet_callback(enc->packet_callback_data, enc->chaining_keyframe, enc->chaining_keyframe_length, 0);
         }
         end_granule48k = (enc->streams->end_granule*48000 + enc->rate - 1)/enc->rate + enc->global_granule_offset;