summaryrefslogtreecommitdiff
path: root/src/test_opus.c
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2011-09-02 14:47:26 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2011-09-02 14:47:26 -0400
commitc681bd0480a8c6a99ff30e240ec52fe129f8eff9 (patch)
tree30d01dc933ba7f7b988afaef813851e7cbd7e470 /src/test_opus.c
parentbafbd08db132d387bcef0637258f90e862a8e4ea (diff)
downloadopus-c681bd0480a8c6a99ff30e240ec52fe129f8eff9.tar.gz
Improved mode/channel/bandwidth control mechanism
Now has tuning parameters for mono/stereo and voice/music. Also switches to stereo during swb and without reducing the bandwidth.
Diffstat (limited to 'src/test_opus.c')
-rw-r--r--src/test_opus.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test_opus.c b/src/test_opus.c
index 7ec1e059..62af93ec 100644
--- a/src/test_opus.c
+++ b/src/test_opus.c
@@ -116,6 +116,7 @@ int main(int argc, char *argv[])
int encode_only=0, decode_only=0;
int max_frame_size = 960*6;
int curr_read=0;
+ int sweep_bps = 0;
if (argc < 7 )
{
@@ -223,6 +224,9 @@ int main(int argc, char *argv[])
} else if( STR_CASEINSENSITIVE_COMPARE( argv[ args ], "-loss" ) == 0 ) {
packet_loss_perc = atoi( argv[ args + 1 ] );
args += 2;
+ } else if( STR_CASEINSENSITIVE_COMPARE( argv[ args ], "-sweep" ) == 0 ) {
+ sweep_bps = atoi( argv[ args + 1 ] );
+ args += 2;
} else {
printf( "Error: unrecognized setting: %s\n\n", argv[ args ] );
print_usage( argv );
@@ -363,6 +367,14 @@ int main(int argc, char *argv[])
}
len[toggle] = opus_encode(enc, in, frame_size, data[toggle], max_payload_bytes);
+ if (sweep_bps!=0)
+ {
+ bitrate_bps += sweep_bps;
+ /* safety */
+ if (bitrate_bps<1000)
+ bitrate_bps = 1000;
+ opus_encoder_ctl(enc, OPUS_SET_BITRATE(bitrate_bps));
+ }
opus_encoder_ctl(enc, OPUS_GET_FINAL_RANGE(&enc_final_range[toggle]));
if (len[toggle] < 0)
{