Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 DeliveryStatus DeliverPacket(MediaType media_type, | 82 DeliveryStatus DeliverPacket(MediaType media_type, |
| 83 const uint8_t* packet, | 83 const uint8_t* packet, |
| 84 size_t length, | 84 size_t length, |
| 85 const PacketTime& packet_time) override; | 85 const PacketTime& packet_time) override; |
| 86 | 86 |
| 87 void SetBitrateConfig( | 87 void SetBitrateConfig( |
| 88 const webrtc::Call::Config::BitrateConfig& bitrate_config) override; | 88 const webrtc::Call::Config::BitrateConfig& bitrate_config) override; |
| 89 | 89 |
| 90 void SignalChannelNetworkState(MediaType media, NetworkState state) override; | 90 void SignalChannelNetworkState(MediaType media, NetworkState state) override; |
| 91 | 91 |
| 92 void OnNetworkRouteChanged( | |
| 93 const std::string& transport_name, | |
| 94 const cricket::NetworkRoute& network_route) override; | |
| 95 | |
| 92 void OnSentPacket(const rtc::SentPacket& sent_packet) override; | 96 void OnSentPacket(const rtc::SentPacket& sent_packet) override; |
| 93 | 97 |
| 94 // Implements BitrateObserver. | 98 // Implements BitrateObserver. |
| 95 void OnNetworkChanged(uint32_t bitrate_bps, uint8_t fraction_loss, | 99 void OnNetworkChanged(uint32_t bitrate_bps, uint8_t fraction_loss, |
| 96 int64_t rtt_ms) override; | 100 int64_t rtt_ms) override; |
| 97 | 101 |
| 98 private: | 102 private: |
| 99 DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet, | 103 DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet, |
| 100 size_t length); | 104 size_t length); |
| 101 DeliveryStatus DeliverRtp(MediaType media_type, | 105 DeliveryStatus DeliverRtp(MediaType media_type, |
| 102 const uint8_t* packet, | 106 const uint8_t* packet, |
| 103 size_t length, | 107 size_t length, |
| 104 const PacketTime& packet_time); | 108 const PacketTime& packet_time); |
| 105 | |
| 106 void ConfigureSync(const std::string& sync_group) | 109 void ConfigureSync(const std::string& sync_group) |
| 107 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); | 110 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); |
| 108 | 111 |
| 109 VoiceEngine* voice_engine() { | 112 VoiceEngine* voice_engine() { |
| 110 internal::AudioState* audio_state = | 113 internal::AudioState* audio_state = |
| 111 static_cast<internal::AudioState*>(config_.audio_state.get()); | 114 static_cast<internal::AudioState*>(config_.audio_state.get()); |
| 112 if (audio_state) | 115 if (audio_state) |
| 113 return audio_state->voice_engine(); | 116 return audio_state->voice_engine(); |
| 114 else | 117 else |
| 115 return nullptr; | 118 return nullptr; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 int64_t last_rtp_packet_received_ms_; | 166 int64_t last_rtp_packet_received_ms_; |
| 164 int64_t first_packet_sent_ms_; | 167 int64_t first_packet_sent_ms_; |
| 165 | 168 |
| 166 // TODO(holmer): Remove this lock once BitrateController no longer calls | 169 // TODO(holmer): Remove this lock once BitrateController no longer calls |
| 167 // OnNetworkChanged from multiple threads. | 170 // OnNetworkChanged from multiple threads. |
| 168 rtc::CriticalSection bitrate_crit_; | 171 rtc::CriticalSection bitrate_crit_; |
| 169 int64_t estimated_send_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); | 172 int64_t estimated_send_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); |
| 170 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); | 173 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); |
| 171 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_); | 174 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_); |
| 172 | 175 |
| 176 std::map<std::string, cricket::NetworkRoute> network_routes_; | |
| 177 | |
| 173 VieRemb remb_; | 178 VieRemb remb_; |
| 174 const std::unique_ptr<CongestionController> congestion_controller_; | 179 const std::unique_ptr<CongestionController> congestion_controller_; |
| 175 | 180 |
| 176 RTC_DISALLOW_COPY_AND_ASSIGN(Call); | 181 RTC_DISALLOW_COPY_AND_ASSIGN(Call); |
| 177 }; | 182 }; |
| 178 } // namespace internal | 183 } // namespace internal |
| 179 | 184 |
| 180 Call* Call::Create(const Call::Config& config) { | 185 Call* Call::Create(const Call::Config& config) { |
| 181 return new internal::Call(config); | 186 return new internal::Call(config); |
| 182 } | 187 } |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 ReadLockScoped read_lock(*receive_crit_); | 589 ReadLockScoped read_lock(*receive_crit_); |
| 585 for (auto& kv : audio_receive_ssrcs_) { | 590 for (auto& kv : audio_receive_ssrcs_) { |
| 586 kv.second->SignalNetworkState(audio_network_state_); | 591 kv.second->SignalNetworkState(audio_network_state_); |
| 587 } | 592 } |
| 588 for (auto& kv : video_receive_ssrcs_) { | 593 for (auto& kv : video_receive_ssrcs_) { |
| 589 kv.second->SignalNetworkState(video_network_state_); | 594 kv.second->SignalNetworkState(video_network_state_); |
| 590 } | 595 } |
| 591 } | 596 } |
| 592 } | 597 } |
| 593 | 598 |
| 599 // TODO(honghaiz): Add tests for this method. | |
| 600 void Call::OnNetworkRouteChanged(const std::string& transport_name, | |
| 601 const cricket::NetworkRoute& network_route) { | |
| 602 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | |
| 603 // Check if the network route is connected. | |
| 604 if (!network_route.connected) { | |
| 605 LOG(LS_INFO) << "Transport " << transport_name << " is disconnected"; | |
| 606 // TODO(honghaiz): Perhaps it should stop sending until a connected route is | |
| 607 // established. | |
|
stefan-webrtc
2016/03/31 07:17:05
This makes me wonder if this method should replace
honghaiz3
2016/03/31 17:42:52
Currently SignalChannelNetworkState is triggered b
stefan-webrtc
2016/04/01 08:08:38
Sounds good, it would be nice to keep the number o
honghaiz3
2016/04/01 22:21:07
Not sure what you mean by that.
| |
| 608 return; | |
| 609 } | |
| 610 | |
| 611 // Check whether the network route has changed on each transport. | |
| 612 auto result = | |
| 613 network_routes_.insert(std::make_pair(transport_name, network_route)); | |
| 614 auto kv = result.first; | |
| 615 bool inserted = result.second; | |
| 616 if (inserted) { | |
| 617 // No need to reset BWE if this is the first time the network connects. | |
| 618 return; | |
| 619 } | |
| 620 bool changed = kv->second != network_route; | |
| 621 if (changed) { | |
| 622 kv->second = network_route; | |
| 623 LOG(LS_INFO) << "Network route changed on transport " << transport_name | |
| 624 << ": new local network id " << network_route.local_network_id | |
| 625 << " new remote network id " | |
| 626 << network_route.remote_network_id; | |
| 627 // TODO(stefan@): Update the BWE bitrates. | |
|
stefan-webrtc
2016/03/31 07:17:05
TODO(holmer) preferred
honghaiz3
2016/03/31 17:42:52
Done.
| |
| 628 } | |
| 629 } | |
| 630 | |
| 594 void Call::UpdateAggregateNetworkState() { | 631 void Call::UpdateAggregateNetworkState() { |
| 595 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 632 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 596 | 633 |
| 597 bool have_audio = false; | 634 bool have_audio = false; |
| 598 bool have_video = false; | 635 bool have_video = false; |
| 599 { | 636 { |
| 600 ReadLockScoped read_lock(*send_crit_); | 637 ReadLockScoped read_lock(*send_crit_); |
| 601 if (audio_send_ssrcs_.size() > 0) | 638 if (audio_send_ssrcs_.size() > 0) |
| 602 have_audio = true; | 639 have_audio = true; |
| 603 if (video_send_ssrcs_.size() > 0) | 640 if (video_send_ssrcs_.size() > 0) |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 798 // thread. Then this check can be enabled. | 835 // thread. Then this check can be enabled. |
| 799 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 836 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
| 800 if (RtpHeaderParser::IsRtcp(packet, length)) | 837 if (RtpHeaderParser::IsRtcp(packet, length)) |
| 801 return DeliverRtcp(media_type, packet, length); | 838 return DeliverRtcp(media_type, packet, length); |
| 802 | 839 |
| 803 return DeliverRtp(media_type, packet, length, packet_time); | 840 return DeliverRtp(media_type, packet, length, packet_time); |
| 804 } | 841 } |
| 805 | 842 |
| 806 } // namespace internal | 843 } // namespace internal |
| 807 } // namespace webrtc | 844 } // namespace webrtc |
| OLD | NEW |