shithub: opus

Download patch

ref: abaa348901c668542cf730e466b2c4f5e7c7c888
parent: 917cd6e6ae4a00c8f63368b5b249cc793b96bb20
author: Jean-Marc Valin <[email protected]>
date: Mon Oct 31 10:35:44 EDT 2011

Adds -random_fec option to randomly add FEC to some frames.

Undocumented for now

--- a/src/opus_demo.c
+++ b/src/opus_demo.c
@@ -142,6 +142,7 @@
     int sweep_bps = 0;
     int random_framesize=0, newsize=0, delayed_celt=0;
     int sweep_max=0, sweep_min=0;
+    int random_fec=0;
 
     if (argc < 5 )
     {
@@ -297,6 +298,10 @@
             check_encoder_option(decode_only, "-sweep_max");
             sweep_max = atoi( argv[ args + 1 ] );
             args += 2;
+        } else if( STR_CASEINSENSITIVE_COMPARE( argv[ args ], "-random_fec" ) == 0 ) {
+            check_encoder_option(decode_only, "-random_fec");
+            random_fec = 1;
+            args++;
         } else {
             printf( "Error: unrecognized setting: %s\n\n", argv[ args ] );
             print_usage( argv );
@@ -430,6 +435,10 @@
             } else {
                 frame_size = newsize;
             }
+        }
+        if (random_fec && rand()%30==0)
+        {
+           opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC(rand()%4==0));
         }
         if (decode_only)
         {