| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 case Application::kSpeech: | 183 case Application::kSpeech: |
| 184 conf.application = AudioEncoderOpus::kVoip; | 184 conf.application = AudioEncoderOpus::kVoip; |
| 185 break; | 185 break; |
| 186 case Application::kAudio: | 186 case Application::kAudio: |
| 187 conf.application = AudioEncoderOpus::kAudio; | 187 conf.application = AudioEncoderOpus::kAudio; |
| 188 break; | 188 break; |
| 189 } | 189 } |
| 190 return RecreateEncoderInstance(conf); | 190 return RecreateEncoderInstance(conf); |
| 191 } | 191 } |
| 192 | 192 |
| 193 bool AudioEncoderOpus::SetMaxPlaybackRate(int frequency_hz) { | 193 void AudioEncoderOpus::SetMaxPlaybackRate(int frequency_hz) { |
| 194 auto conf = config_; | 194 auto conf = config_; |
| 195 conf.max_playback_rate_hz = frequency_hz; | 195 conf.max_playback_rate_hz = frequency_hz; |
| 196 return RecreateEncoderInstance(conf); | 196 CHECK(RecreateEncoderInstance(conf)); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void AudioEncoderOpus::SetProjectedPacketLossRate(double fraction) { | 199 void AudioEncoderOpus::SetProjectedPacketLossRate(double fraction) { |
| 200 double opt_loss_rate = OptimizePacketLossRate(fraction, packet_loss_rate_); | 200 double opt_loss_rate = OptimizePacketLossRate(fraction, packet_loss_rate_); |
| 201 if (packet_loss_rate_ != opt_loss_rate) { | 201 if (packet_loss_rate_ != opt_loss_rate) { |
| 202 packet_loss_rate_ = opt_loss_rate; | 202 packet_loss_rate_ = opt_loss_rate; |
| 203 CHECK_EQ(0, WebRtcOpus_SetPacketLossRate( | 203 CHECK_EQ(0, WebRtcOpus_SetPacketLossRate( |
| 204 inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5))); | 204 inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5))); |
| 205 } | 205 } |
| 206 } | 206 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } else { | 246 } else { |
| 247 CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_)); | 247 CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_)); |
| 248 } | 248 } |
| 249 CHECK_EQ(0, WebRtcOpus_SetPacketLossRate( | 249 CHECK_EQ(0, WebRtcOpus_SetPacketLossRate( |
| 250 inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5))); | 250 inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5))); |
| 251 config_ = config; | 251 config_ = config; |
| 252 return true; | 252 return true; |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace webrtc | 255 } // namespace webrtc |
| OLD | NEW |