| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 int AudioEncoderOpus::Num10MsFramesInNextPacket() const { | 124 int AudioEncoderOpus::Num10MsFramesInNextPacket() const { |
| 125 return num_10ms_frames_per_packet_; | 125 return num_10ms_frames_per_packet_; |
| 126 } | 126 } |
| 127 | 127 |
| 128 int AudioEncoderOpus::Max10MsFramesInAPacket() const { | 128 int AudioEncoderOpus::Max10MsFramesInAPacket() const { |
| 129 return num_10ms_frames_per_packet_; | 129 return num_10ms_frames_per_packet_; |
| 130 } | 130 } |
| 131 | 131 |
| 132 int AudioEncoderOpus::GetTargetBitrate() const { |
| 133 return bitrate_bps_; |
| 134 } |
| 135 |
| 132 void AudioEncoderOpus::SetTargetBitrate(int bits_per_second) { | 136 void AudioEncoderOpus::SetTargetBitrate(int bits_per_second) { |
| 133 bitrate_bps_ = std::max(std::min(bits_per_second, kMaxBitrateBps), | 137 bitrate_bps_ = std::max(std::min(bits_per_second, kMaxBitrateBps), |
| 134 kMinBitrateBps); | 138 kMinBitrateBps); |
| 135 CHECK_EQ(WebRtcOpus_SetBitRate(inst_, bitrate_bps_), 0); | 139 CHECK_EQ(WebRtcOpus_SetBitRate(inst_, bitrate_bps_), 0); |
| 136 } | 140 } |
| 137 | 141 |
| 138 void AudioEncoderOpus::SetProjectedPacketLossRate(double fraction) { | 142 void AudioEncoderOpus::SetProjectedPacketLossRate(double fraction) { |
| 139 DCHECK_GE(fraction, 0.0); | 143 DCHECK_GE(fraction, 0.0); |
| 140 DCHECK_LE(fraction, 1.0); | 144 DCHECK_LE(fraction, 1.0); |
| 141 // Optimize the loss rate to configure Opus. Basically, optimized loss rate is | 145 // Optimize the loss rate to configure Opus. Basically, optimized loss rate is |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 return Reconstruct(conf); | 260 return Reconstruct(conf); |
| 257 } | 261 } |
| 258 | 262 |
| 259 bool AudioEncoderMutableOpus::SetMaxPlaybackRate(int frequency_hz) { | 263 bool AudioEncoderMutableOpus::SetMaxPlaybackRate(int frequency_hz) { |
| 260 auto conf = config(); | 264 auto conf = config(); |
| 261 conf.max_playback_rate_hz = frequency_hz; | 265 conf.max_playback_rate_hz = frequency_hz; |
| 262 return Reconstruct(conf); | 266 return Reconstruct(conf); |
| 263 } | 267 } |
| 264 | 268 |
| 265 } // namespace webrtc | 269 } // namespace webrtc |
| OLD | NEW |