Adds a simple padding test to opus_demo (disabled by default)
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 15 Nov 2013 18:35:04 +0000 (13:35 -0500)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 15 Nov 2013 18:35:04 +0000 (13:35 -0500)
src/opus_demo.c

index ea8b7a7..f2349b2 100644 (file)
@@ -727,6 +727,18 @@ int main(int argc, char *argv[])
             }
         }
 
+#if 0 /* This is for testing the padding code, do not enable by default */
+        if (len[toggle]<1275)
+        {
+           int new_len = len[toggle]+rand()%(max_payload_bytes-len[toggle]);
+           if ((err = opus_packet_pad(data[toggle], len[toggle], new_len)) != OPUS_OK)
+           {
+              fprintf(stderr, "padding failed: %s\n", opus_strerror(err));
+              return EXIT_FAILURE;
+           }
+           len[toggle] = new_len;
+        }
+#endif
         if (encode_only)
         {
             unsigned char int_field[4];