OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 return false; | 43 return false; |
44 switch (sample_rate_hz) { | 44 switch (sample_rate_hz) { |
45 case 16000: | 45 case 16000: |
46 if (max_bit_rate > 53400) | 46 if (max_bit_rate > 53400) |
47 return false; | 47 return false; |
48 if (max_payload_size_bytes > 400) | 48 if (max_payload_size_bytes > 400) |
49 return false; | 49 return false; |
50 return (frame_size_ms == 30 || frame_size_ms == 60) && | 50 return (frame_size_ms == 30 || frame_size_ms == 60) && |
51 (bit_rate == 0 || (bit_rate >= 10000 && bit_rate <= 32000)); | 51 (bit_rate == 0 || (bit_rate >= 10000 && bit_rate <= 32000)); |
52 case 32000: | 52 case 32000: |
53 case 48000: | |
54 if (max_bit_rate > 160000) | 53 if (max_bit_rate > 160000) |
55 return false; | 54 return false; |
56 if (max_payload_size_bytes > 600) | 55 if (max_payload_size_bytes > 600) |
57 return false; | 56 return false; |
58 return T::has_swb && | 57 return T::has_swb && |
59 (frame_size_ms == 30 && | 58 (frame_size_ms == 30 && |
60 (bit_rate == 0 || (bit_rate >= 10000 && bit_rate <= 56000))); | 59 (bit_rate == 0 || (bit_rate >= 10000 && bit_rate <= 56000))); |
61 default: | 60 default: |
62 return false; | 61 return false; |
63 } | 62 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 config.enforce_frame_size)); | 169 config.enforce_frame_size)); |
171 } else { | 170 } else { |
172 RTC_CHECK_EQ(0, T::Control(isac_state_, bit_rate, config.frame_size_ms)); | 171 RTC_CHECK_EQ(0, T::Control(isac_state_, bit_rate, config.frame_size_ms)); |
173 } | 172 } |
174 if (config.max_payload_size_bytes != -1) | 173 if (config.max_payload_size_bytes != -1) |
175 RTC_CHECK_EQ( | 174 RTC_CHECK_EQ( |
176 0, T::SetMaxPayloadSize(isac_state_, config.max_payload_size_bytes)); | 175 0, T::SetMaxPayloadSize(isac_state_, config.max_payload_size_bytes)); |
177 if (config.max_bit_rate != -1) | 176 if (config.max_bit_rate != -1) |
178 RTC_CHECK_EQ(0, T::SetMaxRate(isac_state_, config.max_bit_rate)); | 177 RTC_CHECK_EQ(0, T::SetMaxRate(isac_state_, config.max_bit_rate)); |
179 | 178 |
180 // When config.sample_rate_hz is set to 48000 Hz (iSAC-fb), the decoder is | |
181 // still set to 32000 Hz, since there is no full-band mode in the decoder. | |
182 const int decoder_sample_rate_hz = std::min(config.sample_rate_hz, 32000); | |
183 | |
184 // Set the decoder sample rate even though we just use the encoder. This | 179 // Set the decoder sample rate even though we just use the encoder. This |
185 // doesn't appear to be necessary to produce a valid encoding, but without it | 180 // doesn't appear to be necessary to produce a valid encoding, but without it |
186 // we get an encoding that isn't bit-for-bit identical with what a combined | 181 // we get an encoding that isn't bit-for-bit identical with what a combined |
187 // encoder+decoder object produces. | 182 // encoder+decoder object produces. |
188 RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, decoder_sample_rate_hz)); | 183 RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, config.sample_rate_hz)); |
189 | 184 |
190 config_ = config; | 185 config_ = config; |
191 } | 186 } |
192 | 187 |
193 } // namespace webrtc | 188 } // namespace webrtc |
194 | 189 |
195 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_IMPL_H_ | 190 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_IMPL_H_ |
OLD | NEW |