shithub: opus

Download patch

ref: aad4117d780cee87e1be03e4a108b9e601367dc8
parent: 1b28e0cae55f66f76fdd7fae433c392a039565ff
author: Jean-Marc Valin <[email protected]>
date: Fri Nov 15 08:35:04 EST 2013

Adds a simple padding test to opus_demo (disabled by default)

--- a/src/opus_demo.c
+++ b/src/opus_demo.c
@@ -727,6 +727,18 @@
             }
         }
 
+#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];