OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h" | 13 #include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h" |
14 #include "webrtc/test/testsupport/fileutils.h" | 14 #include "webrtc/test/testsupport/fileutils.h" |
| 15 #include "webrtc/test/testsupport/gtest_disable.h" |
15 | 16 |
16 struct WebRtcISACStruct; | 17 struct WebRtcISACStruct; |
17 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 | 20 |
20 // Number of samples in a 60 ms, sampled at 32 kHz. | 21 // Number of samples in a 60 ms, sampled at 32 kHz. |
21 const int kIsacNumberOfSamples = 320 * 6; | 22 const int kIsacNumberOfSamples = 320 * 6; |
22 // Maximum number of bytes in output bitstream. | 23 // Maximum number of bytes in output bitstream. |
23 const size_t kMaxBytes = 1000; | 24 const size_t kMaxBytes = 1000; |
24 | 25 |
(...skipping 22 matching lines...) Expand all Loading... |
47 input_file = fopen(file_name.c_str(), "rb"); | 48 input_file = fopen(file_name.c_str(), "rb"); |
48 ASSERT_TRUE(input_file != NULL); | 49 ASSERT_TRUE(input_file != NULL); |
49 ASSERT_EQ(kIsacNumberOfSamples, | 50 ASSERT_EQ(kIsacNumberOfSamples, |
50 static_cast<int32_t>(fread(speech_data_, sizeof(int16_t), | 51 static_cast<int32_t>(fread(speech_data_, sizeof(int16_t), |
51 kIsacNumberOfSamples, input_file))); | 52 kIsacNumberOfSamples, input_file))); |
52 fclose(input_file); | 53 fclose(input_file); |
53 input_file = NULL; | 54 input_file = NULL; |
54 } | 55 } |
55 | 56 |
56 // Test failing Create. | 57 // Test failing Create. |
57 TEST_F(IsacTest, IsacCreateFail) { | 58 TEST_F(IsacTest, DISABLED_ON_IOS(IsacCreateFail)) { |
58 // Test to see that an invalid pointer is caught. | 59 // Test to see that an invalid pointer is caught. |
59 EXPECT_EQ(-1, WebRtcIsac_Create(NULL)); | 60 EXPECT_EQ(-1, WebRtcIsac_Create(NULL)); |
60 } | 61 } |
61 | 62 |
62 // Test failing Free. | 63 // Test failing Free. |
63 TEST_F(IsacTest, IsacFreeFail) { | 64 TEST_F(IsacTest, DISABLED_ON_IOS(IsacFreeFail)) { |
64 // Test to see that free function doesn't crash. | 65 // Test to see that free function doesn't crash. |
65 EXPECT_EQ(0, WebRtcIsac_Free(NULL)); | 66 EXPECT_EQ(0, WebRtcIsac_Free(NULL)); |
66 } | 67 } |
67 | 68 |
68 // Test normal Create and Free. | 69 // Test normal Create and Free. |
69 TEST_F(IsacTest, IsacCreateFree) { | 70 TEST_F(IsacTest, DISABLED_ON_IOS(IsacCreateFree)) { |
70 EXPECT_EQ(0, WebRtcIsac_Create(&isac_codec_)); | 71 EXPECT_EQ(0, WebRtcIsac_Create(&isac_codec_)); |
71 EXPECT_TRUE(isac_codec_ != NULL); | 72 EXPECT_TRUE(isac_codec_ != NULL); |
72 EXPECT_EQ(0, WebRtcIsac_Free(isac_codec_));} | 73 EXPECT_EQ(0, WebRtcIsac_Free(isac_codec_));} |
73 | 74 |
74 TEST_F(IsacTest, IsacUpdateBWE) { | 75 TEST_F(IsacTest, DISABLED_ON_IOS(IsacUpdateBWE)) { |
75 // Create encoder memory. | 76 // Create encoder memory. |
76 EXPECT_EQ(0, WebRtcIsac_Create(&isac_codec_)); | 77 EXPECT_EQ(0, WebRtcIsac_Create(&isac_codec_)); |
77 | 78 |
78 // Init encoder (adaptive mode) and decoder. | 79 // Init encoder (adaptive mode) and decoder. |
79 WebRtcIsac_EncoderInit(isac_codec_, 0); | 80 WebRtcIsac_EncoderInit(isac_codec_, 0); |
80 WebRtcIsac_DecoderInit(isac_codec_); | 81 WebRtcIsac_DecoderInit(isac_codec_); |
81 | 82 |
82 int encoded_bytes; | 83 int encoded_bytes; |
83 | 84 |
84 // Test with call with a small packet (sync packet). | 85 // Test with call with a small packet (sync packet). |
(...skipping 15 matching lines...) Expand all Loading... |
100 | 101 |
101 // Call to update bandwidth estimator with real data. | 102 // Call to update bandwidth estimator with real data. |
102 EXPECT_EQ(0, WebRtcIsac_UpdateBwEstimate(isac_codec_, bitstream_, | 103 EXPECT_EQ(0, WebRtcIsac_UpdateBwEstimate(isac_codec_, bitstream_, |
103 encoded_bytes, 1, 12345, 56789)); | 104 encoded_bytes, 1, 12345, 56789)); |
104 | 105 |
105 // Free memory. | 106 // Free memory. |
106 EXPECT_EQ(0, WebRtcIsac_Free(isac_codec_)); | 107 EXPECT_EQ(0, WebRtcIsac_Free(isac_codec_)); |
107 } | 108 } |
108 | 109 |
109 } // namespace webrtc | 110 } // namespace webrtc |
OLD | NEW |