Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Unified Diff: src/opus_demo.c

Issue 107243004: Updating Opus to release 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/opus_decoder.c ('k') | src/opus_encoder.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opus_demo.c
diff --git a/src/opus_demo.c b/src/opus_demo.c
index 9771ed8bb81c3914e743da7a7520a9477d7573ee..f8cdf0310863ce474ad8383367ba1f84ed6d70f7 100644
--- a/src/opus_demo.c
+++ b/src/opus_demo.c
@@ -79,15 +79,6 @@ static opus_uint32 char_to_int(unsigned char ch[4])
| ((opus_uint32)ch[2]<< 8) | (opus_uint32)ch[3];
}
-static void check_decoder_option(int encode_only, const char *opt)
-{
- if (encode_only)
- {
- fprintf(stderr, "option %s is only for decoding\n", opt);
- exit(EXIT_FAILURE);
- }
-}
-
static void check_encoder_option(int decode_only, const char *opt)
{
if (decode_only)
@@ -317,13 +308,6 @@ int main(int argc, char *argv[])
}
sampling_rate = (opus_int32)atol(argv[args]);
args++;
- channels = atoi(argv[args]);
- args++;
- if (!decode_only)
- {
- bitrate_bps = (opus_int32)atol(argv[args]);
- args++;
- }
if (sampling_rate != 8000 && sampling_rate != 12000
&& sampling_rate != 16000 && sampling_rate != 24000
@@ -335,6 +319,21 @@ int main(int argc, char *argv[])
}
frame_size = sampling_rate/50;
+ channels = atoi(argv[args]);
+ args++;
+
+ if (channels < 1 || channels > 2)
+ {
+ fprintf(stderr, "Opus_demo supports only 1 or 2 channels.\n");
+ return EXIT_FAILURE;
+ }
+
+ if (!decode_only)
+ {
+ bitrate_bps = (opus_int32)atol(argv[args]);
+ args++;
+ }
+
/* defaults: */
use_vbr = 1;
bandwidth = OPUS_AUTO;
@@ -425,7 +424,6 @@ int main(int argc, char *argv[])
use_dtx = 1;
args++;
} else if( strcmp( argv[ args ], "-loss" ) == 0 ) {
- check_decoder_option(encode_only, "-loss");
packet_loss_perc = atoi( argv[ args + 1 ] );
args += 2;
} else if( strcmp( argv[ args ], "-sweep" ) == 0 ) {
@@ -737,6 +735,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];
« no previous file with comments | « src/opus_decoder.c ('k') | src/opus_encoder.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698