Chromium Code Reviews| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 int SetOpusApplication(OpusApplicationMode application) override; | 183 int SetOpusApplication(OpusApplicationMode application) override; |
| 184 | 184 |
| 185 // If current send codec is Opus, informs it about the maximum playback rate | 185 // If current send codec is Opus, informs it about the maximum playback rate |
| 186 // the receiver will render. | 186 // the receiver will render. |
| 187 int SetOpusMaxPlaybackRate(int frequency_hz) override; | 187 int SetOpusMaxPlaybackRate(int frequency_hz) override; |
| 188 | 188 |
| 189 int EnableOpusDtx() override; | 189 int EnableOpusDtx() override; |
| 190 | 190 |
| 191 int DisableOpusDtx() override; | 191 int DisableOpusDtx() override; |
| 192 | 192 |
| 193 int EnableOpusCbr() override; | |
|
minyue-webrtc
2017/03/29 20:45:26
nit: make order between Cbr and Dtx consistent
| |
| 194 | |
| 195 int DisableOpusCbr() override; | |
| 196 | |
| 193 int UnregisterReceiveCodec(uint8_t payload_type) override; | 197 int UnregisterReceiveCodec(uint8_t payload_type) override; |
| 194 | 198 |
| 195 int EnableNack(size_t max_nack_list_size) override; | 199 int EnableNack(size_t max_nack_list_size) override; |
| 196 | 200 |
| 197 void DisableNack() override; | 201 void DisableNack() override; |
| 198 | 202 |
| 199 std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const override; | 203 std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const override; |
| 200 | 204 |
| 201 void GetDecodingCallStatistics(AudioDecodingCallStats* stats) const override; | 205 void GetDecodingCallStatistics(AudioDecodingCallStats* stats) const override; |
| 202 | 206 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 return enc_->Max10MsFramesInAPacket(); | 397 return enc_->Max10MsFramesInAPacket(); |
| 394 } | 398 } |
| 395 int GetTargetBitrate() const override { return enc_->GetTargetBitrate(); } | 399 int GetTargetBitrate() const override { return enc_->GetTargetBitrate(); } |
| 396 EncodedInfo EncodeImpl(uint32_t rtp_timestamp, | 400 EncodedInfo EncodeImpl(uint32_t rtp_timestamp, |
| 397 rtc::ArrayView<const int16_t> audio, | 401 rtc::ArrayView<const int16_t> audio, |
| 398 rtc::Buffer* encoded) override { | 402 rtc::Buffer* encoded) override { |
| 399 return enc_->Encode(rtp_timestamp, audio, encoded); | 403 return enc_->Encode(rtp_timestamp, audio, encoded); |
| 400 } | 404 } |
| 401 void Reset() override { return enc_->Reset(); } | 405 void Reset() override { return enc_->Reset(); } |
| 402 bool SetFec(bool enable) override { return enc_->SetFec(enable); } | 406 bool SetFec(bool enable) override { return enc_->SetFec(enable); } |
| 407 bool SetCbr(bool enable) override { return enc_->SetCbr(enable); } | |
| 403 bool SetDtx(bool enable) override { return enc_->SetDtx(enable); } | 408 bool SetDtx(bool enable) override { return enc_->SetDtx(enable); } |
| 404 bool SetApplication(Application application) override { | 409 bool SetApplication(Application application) override { |
| 405 return enc_->SetApplication(application); | 410 return enc_->SetApplication(application); |
| 406 } | 411 } |
| 407 void SetMaxPlaybackRate(int frequency_hz) override { | 412 void SetMaxPlaybackRate(int frequency_hz) override { |
| 408 return enc_->SetMaxPlaybackRate(frequency_hz); | 413 return enc_->SetMaxPlaybackRate(frequency_hz); |
| 409 } | 414 } |
| 410 | 415 |
| 411 private: | 416 private: |
| 412 AudioEncoder* enc_; | 417 AudioEncoder* enc_; |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1227 } | 1232 } |
| 1228 | 1233 |
| 1229 int AudioCodingModuleImpl::DisableOpusDtx() { | 1234 int AudioCodingModuleImpl::DisableOpusDtx() { |
| 1230 rtc::CritScope lock(&acm_crit_sect_); | 1235 rtc::CritScope lock(&acm_crit_sect_); |
| 1231 if (!HaveValidEncoder("DisableOpusDtx")) { | 1236 if (!HaveValidEncoder("DisableOpusDtx")) { |
| 1232 return -1; | 1237 return -1; |
| 1233 } | 1238 } |
| 1234 return encoder_stack_->SetDtx(false) ? 0 : -1; | 1239 return encoder_stack_->SetDtx(false) ? 0 : -1; |
| 1235 } | 1240 } |
| 1236 | 1241 |
| 1242 int AudioCodingModuleImpl::EnableOpusCbr() { | |
| 1243 rtc::CritScope lock(&acm_crit_sect_); | |
| 1244 if (!HaveValidEncoder("EnableOpusCbr")) { | |
| 1245 return -1; | |
| 1246 } | |
| 1247 return encoder_stack_->SetCbr(true) ? 0 : -1; | |
| 1248 } | |
| 1249 | |
| 1250 int AudioCodingModuleImpl::DisableOpusCbr() { | |
| 1251 rtc::CritScope lock(&acm_crit_sect_); | |
| 1252 if (!HaveValidEncoder("DisableOpusCbr")) { | |
| 1253 return -1; | |
| 1254 } | |
| 1255 return encoder_stack_->SetCbr(false) ? 0 : -1; | |
| 1256 } | |
| 1257 | |
| 1237 int32_t AudioCodingModuleImpl::PlayoutTimestamp(uint32_t* timestamp) { | 1258 int32_t AudioCodingModuleImpl::PlayoutTimestamp(uint32_t* timestamp) { |
| 1238 rtc::Optional<uint32_t> ts = PlayoutTimestamp(); | 1259 rtc::Optional<uint32_t> ts = PlayoutTimestamp(); |
| 1239 if (!ts) | 1260 if (!ts) |
| 1240 return -1; | 1261 return -1; |
| 1241 *timestamp = *ts; | 1262 *timestamp = *ts; |
| 1242 return 0; | 1263 return 0; |
| 1243 } | 1264 } |
| 1244 | 1265 |
| 1245 rtc::Optional<uint32_t> AudioCodingModuleImpl::PlayoutTimestamp() { | 1266 rtc::Optional<uint32_t> AudioCodingModuleImpl::PlayoutTimestamp() { |
| 1246 return receiver_.GetPlayoutTimestamp(); | 1267 return receiver_.GetPlayoutTimestamp(); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1376 // Checks the validity of the parameters of the given codec | 1397 // Checks the validity of the parameters of the given codec |
| 1377 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { | 1398 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { |
| 1378 bool valid = acm2::RentACodec::IsCodecValid(codec); | 1399 bool valid = acm2::RentACodec::IsCodecValid(codec); |
| 1379 if (!valid) | 1400 if (!valid) |
| 1380 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, | 1401 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, |
| 1381 "Invalid codec setting"); | 1402 "Invalid codec setting"); |
| 1382 return valid; | 1403 return valid; |
| 1383 } | 1404 } |
| 1384 | 1405 |
| 1385 } // namespace webrtc | 1406 } // namespace webrtc |
| OLD | NEW |