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 30 matching lines...) Expand all Loading... | |
| 41 #include "webrtc/voice_engine/transmit_mixer.h" | 41 #include "webrtc/voice_engine/transmit_mixer.h" |
| 42 #include "webrtc/voice_engine/utility.h" | 42 #include "webrtc/voice_engine/utility.h" |
| 43 | 43 |
| 44 namespace webrtc { | 44 namespace webrtc { |
| 45 namespace voe { | 45 namespace voe { |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 constexpr int64_t kMaxRetransmissionWindowMs = 1000; | 49 constexpr int64_t kMaxRetransmissionWindowMs = 1000; |
| 50 constexpr int64_t kMinRetransmissionWindowMs = 30; | 50 constexpr int64_t kMinRetransmissionWindowMs = 30; |
| 51 constexpr int64_t kDefaultBitrateSmoothingTimeConstantMs = 20000; | |
| 51 | 52 |
| 52 } // namespace | 53 } // namespace |
| 53 | 54 |
| 54 const int kTelephoneEventAttenuationdB = 10; | 55 const int kTelephoneEventAttenuationdB = 10; |
| 55 | 56 |
| 56 class RtcEventLogProxy final : public webrtc::RtcEventLog { | 57 class RtcEventLogProxy final : public webrtc::RtcEventLog { |
| 57 public: | 58 public: |
| 58 RtcEventLogProxy() : event_log_(nullptr) {} | 59 RtcEventLogProxy() : event_log_(nullptr) {} |
| 59 | 60 |
| 60 bool StartLogging(const std::string& file_name, | 61 bool StartLogging(const std::string& file_name, |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 888 _outputSpeechType(AudioFrame::kNormalSpeech), | 889 _outputSpeechType(AudioFrame::kNormalSpeech), |
| 889 restored_packet_in_use_(false), | 890 restored_packet_in_use_(false), |
| 890 rtcp_observer_(new VoERtcpObserver(this)), | 891 rtcp_observer_(new VoERtcpObserver(this)), |
| 891 associate_send_channel_(ChannelOwner(nullptr)), | 892 associate_send_channel_(ChannelOwner(nullptr)), |
| 892 pacing_enabled_(config.enable_voice_pacing), | 893 pacing_enabled_(config.enable_voice_pacing), |
| 893 feedback_observer_proxy_(new TransportFeedbackProxy()), | 894 feedback_observer_proxy_(new TransportFeedbackProxy()), |
| 894 seq_num_allocator_proxy_(new TransportSequenceNumberProxy()), | 895 seq_num_allocator_proxy_(new TransportSequenceNumberProxy()), |
| 895 rtp_packet_sender_proxy_(new RtpPacketSenderProxy()), | 896 rtp_packet_sender_proxy_(new RtpPacketSenderProxy()), |
| 896 retransmission_rate_limiter_(new RateLimiter(Clock::GetRealTimeClock(), | 897 retransmission_rate_limiter_(new RateLimiter(Clock::GetRealTimeClock(), |
| 897 kMaxRetransmissionWindowMs)), | 898 kMaxRetransmissionWindowMs)), |
| 898 decoder_factory_(config.acm_config.decoder_factory) { | 899 decoder_factory_(config.acm_config.decoder_factory), |
| 900 bitrate_bps_smoothed_(kDefaultBitrateSmoothingTimeConstantMs, | |
| 901 Clock::GetRealTimeClock()) { | |
| 899 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId), | 902 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId), |
| 900 "Channel::Channel() - ctor"); | 903 "Channel::Channel() - ctor"); |
| 901 AudioCodingModule::Config acm_config(config.acm_config); | 904 AudioCodingModule::Config acm_config(config.acm_config); |
| 902 acm_config.id = VoEModuleId(instanceId, channelId); | 905 acm_config.id = VoEModuleId(instanceId, channelId); |
| 903 acm_config.neteq_config.enable_muted_state = true; | 906 acm_config.neteq_config.enable_muted_state = true; |
| 904 audio_coding_.reset(AudioCodingModule::Create(acm_config)); | 907 audio_coding_.reset(AudioCodingModule::Create(acm_config)); |
| 905 | 908 |
| 906 _outputAudioLevel.Clear(); | 909 _outputAudioLevel.Clear(); |
| 907 | 910 |
| 908 RtpRtcp::Configuration configuration; | 911 RtpRtcp::Configuration configuration; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1302 } | 1305 } |
| 1303 | 1306 |
| 1304 void Channel::SetBitRate(int bitrate_bps) { | 1307 void Channel::SetBitRate(int bitrate_bps) { |
| 1305 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1308 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 1306 "Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps); | 1309 "Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps); |
| 1307 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { | 1310 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
| 1308 if (*encoder) | 1311 if (*encoder) |
| 1309 (*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps); | 1312 (*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps); |
| 1310 }); | 1313 }); |
| 1311 retransmission_rate_limiter_->SetMaxRate(bitrate_bps); | 1314 retransmission_rate_limiter_->SetMaxRate(bitrate_bps); |
| 1315 bitrate_bps_smoothed_.AddSample(bitrate_bps); | |
|
minyue-webrtc
2016/11/15 14:36:03
will it obtain time constant here? if so, does the
michaelt
2016/11/16 09:50:24
Yes.
Not really but we have to set it anyway.
| |
| 1316 OnUplinkBandwidthUpdated( | |
| 1317 static_cast<int>(*bitrate_bps_smoothed_.GetAverage())); | |
| 1312 } | 1318 } |
| 1313 | 1319 |
| 1314 void Channel::OnIncomingFractionLoss(int fraction_lost) { | 1320 void Channel::OnIncomingFractionLoss(int fraction_lost) { |
| 1315 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { | 1321 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
| 1316 if (*encoder) | 1322 if (*encoder) |
| 1317 (*encoder)->OnReceivedUplinkPacketLossFraction(fraction_lost / 255.0f); | 1323 (*encoder)->OnReceivedUplinkPacketLossFraction(fraction_lost / 255.0f); |
| 1318 }); | 1324 }); |
| 1319 } | 1325 } |
| 1320 | 1326 |
| 1321 int32_t Channel::SetVADStatus(bool enableVAD, | 1327 int32_t Channel::SetVADStatus(bool enableVAD, |
| (...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3226 int64_t avg_rtt = 0; | 3232 int64_t avg_rtt = 0; |
| 3227 int64_t max_rtt = 0; | 3233 int64_t max_rtt = 0; |
| 3228 int64_t min_rtt = 0; | 3234 int64_t min_rtt = 0; |
| 3229 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3235 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 3230 0) { | 3236 0) { |
| 3231 return 0; | 3237 return 0; |
| 3232 } | 3238 } |
| 3233 return rtt; | 3239 return rtt; |
| 3234 } | 3240 } |
| 3235 | 3241 |
| 3242 void Channel::OnUplinkBandwidthUpdated(int bitrate_bps) { | |
|
minyue-webrtc
2016/11/15 14:36:03
I don't think we need to add this function. put th
michaelt
2016/11/16 09:50:24
Ok
| |
| 3243 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { | |
| 3244 if (*encoder) { | |
| 3245 (*encoder)->OnReceivedUplinkBandwidth(bitrate_bps); | |
| 3246 } | |
| 3247 }); | |
| 3248 } | |
| 3249 | |
| 3236 } // namespace voe | 3250 } // namespace voe |
| 3237 } // namespace webrtc | 3251 } // namespace webrtc |
| OLD | NEW |