| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 } | 492 } |
| 493 } | 493 } |
| 494 | 494 |
| 495 if (testNum != 1) { | 495 if (testNum != 1) { |
| 496 if (WebRtcIsac_EncoderInit(ISAC_main_inst, CodingMode) < 0) { | 496 if (WebRtcIsac_EncoderInit(ISAC_main_inst, CodingMode) < 0) { |
| 497 printf("Error could not initialize the encoder \n"); | 497 printf("Error could not initialize the encoder \n"); |
| 498 cout << flush; | 498 cout << flush; |
| 499 return 0; | 499 return 0; |
| 500 } | 500 } |
| 501 } | 501 } |
| 502 if (testNum != 2) { | 502 if (testNum != 2) |
| 503 if (WebRtcIsac_DecoderInit(ISAC_main_inst) < 0) { | 503 WebRtcIsac_DecoderInit(ISAC_main_inst); |
| 504 printf("Error could not initialize the decoder \n"); | |
| 505 cout << flush; | |
| 506 return 0; | |
| 507 } | |
| 508 } | |
| 509 if (CodingMode == 1) { | 504 if (CodingMode == 1) { |
| 510 err = WebRtcIsac_Control(ISAC_main_inst, bottleneck, framesize); | 505 err = WebRtcIsac_Control(ISAC_main_inst, bottleneck, framesize); |
| 511 if (err < 0) { | 506 if (err < 0) { |
| 512 /* exit if returned with error */ | 507 /* exit if returned with error */ |
| 513 errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); | 508 errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); |
| 514 printf("\n\n Error in initialization (control): %d.\n\n", errtype); | 509 printf("\n\n Error in initialization (control): %d.\n\n", errtype); |
| 515 cout << flush; | 510 cout << flush; |
| 516 if (testNum == 0) { | 511 if (testNum == 0) { |
| 517 exit(EXIT_FAILURE); | 512 exit(EXIT_FAILURE); |
| 518 } | 513 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 /* Call init functions at random, fault test number 7 */ | 558 /* Call init functions at random, fault test number 7 */ |
| 564 if (testNum == 7 && (rand() % 2 == 0)) { | 559 if (testNum == 7 && (rand() % 2 == 0)) { |
| 565 err = WebRtcIsac_EncoderInit(ISAC_main_inst, CodingMode); | 560 err = WebRtcIsac_EncoderInit(ISAC_main_inst, CodingMode); |
| 566 /* Error check */ | 561 /* Error check */ |
| 567 if (err < 0) { | 562 if (err < 0) { |
| 568 errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); | 563 errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); |
| 569 printf("\n\n Error in encoderinit: %d.\n\n", errtype); | 564 printf("\n\n Error in encoderinit: %d.\n\n", errtype); |
| 570 cout << flush; | 565 cout << flush; |
| 571 } | 566 } |
| 572 | 567 |
| 573 err = WebRtcIsac_DecoderInit(ISAC_main_inst); | 568 WebRtcIsac_DecoderInit(ISAC_main_inst); |
| 574 /* Error check */ | |
| 575 if (err < 0) { | |
| 576 errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); | |
| 577 printf("\n\n Error in decoderinit: %d.\n\n", errtype); | |
| 578 cout << flush; | |
| 579 } | |
| 580 } | 569 } |
| 581 | 570 |
| 582 cur_framesmpls = 0; | 571 cur_framesmpls = 0; |
| 583 while (1) { | 572 while (1) { |
| 584 int stream_len_int = 0; | 573 int stream_len_int = 0; |
| 585 | 574 |
| 586 /* Read 10 ms speech block */ | 575 /* Read 10 ms speech block */ |
| 587 endfile = readframe(shortdata, inp, samplesIn10Ms); | 576 endfile = readframe(shortdata, inp, samplesIn10Ms); |
| 588 | 577 |
| 589 if (endfile) { | 578 if (endfile) { |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 fprintf(stderr, " transcoding rate %.0f kbps", | 938 fprintf(stderr, " transcoding rate %.0f kbps", |
| 950 (double)numTransCodingBytes * 8.0 * (sampFreqKHz) / totalsmpls); | 939 (double)numTransCodingBytes * 8.0 * (sampFreqKHz) / totalsmpls); |
| 951 } | 940 } |
| 952 | 941 |
| 953 fclose(inp); | 942 fclose(inp); |
| 954 fclose(outp); | 943 fclose(outp); |
| 955 WebRtcIsac_Free(ISAC_main_inst); | 944 WebRtcIsac_Free(ISAC_main_inst); |
| 956 | 945 |
| 957 exit(0); | 946 exit(0); |
| 958 } | 947 } |
| OLD | NEW |