ref: e790b37d86aa439d6207a9695e810c0b17ef9c97
parent: 9a7967a1eaae389c9d2323485fe33366d03cdbbc
author: Jean-Marc Valin <[email protected]>
date: Tue May 24 16:58:55 EDT 2011
test_opus error messages
--- a/src/test_opus.c
+++ b/src/test_opus.c
@@ -235,6 +235,17 @@
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 @@
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));