summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>2011-05-24 20:58:55 -0400
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>2011-05-24 22:33:21 -0400
commit0cf9439ab2ad82470a380053ebcb7ba23aafb158 (patch)
tree368fa0f0b3b5afcff715f28a875bcb0896416aa1
parent61a67f3865477bc20a78d17edbc7fb6eab67700f (diff)
downloadopus-0cf9439ab2ad82470a380053ebcb7ba23aafb158.tar.gz
test_opus error messages
-rw-r--r--src/test_opus.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/test_opus.c b/src/test_opus.c
index 1461716b..19165840 100644
--- a/src/test_opus.c
+++ b/src/test_opus.c
@@ -235,6 +235,17 @@ int main(int argc, char *argv[])
enc = opus_encoder_create(sampling_rate, channels);
dec = opus_decoder_create(sampling_rate, channels);
+ if (enc==NULL)
+ {
+ fprintf(stderr, "Failed to create an encoder\n");
+ exit(1);
+ }
+ if (dec==NULL)
+ {
+ fprintf(stderr, "Failed to create a decoder\n");
+ exit(1);
+ }
+
opus_encoder_ctl(enc, OPUS_SET_MODE(mode));
opus_encoder_ctl(enc, OPUS_SET_BITRATE(bitrate_bps));
opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(bandwidth));
@@ -275,7 +286,7 @@ int main(int argc, char *argv[])
bandwidth_string = "unknown";
}
- printf("Encoding %d Hz input at %.3f kb/s in %s mode with %d-sample frames.\n", sampling_rate, bitrate_bps*0.001, bandwidth_string, frame_size);
+ fprintf(stderr, "Encoding %d Hz input at %.3f kb/s in %s mode with %d-sample frames.\n", sampling_rate, bitrate_bps*0.001, bandwidth_string, frame_size);
in = (short*)malloc(frame_size*channels*sizeof(short));
out = (short*)malloc(frame_size*channels*sizeof(short));