Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1091)

Side by Side Diff: webrtc/call/call.cc

Issue 1844773002: Update the call when the network route changes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Merge with head Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/call.h ('k') | webrtc/media/base/fakemediaengine.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(const std::string& transport_name,
93 const rtc::NetworkRoute& network_route) override;
94
92 void OnSentPacket(const rtc::SentPacket& sent_packet) override; 95 void OnSentPacket(const rtc::SentPacket& sent_packet) override;
93 96
94 // Implements BitrateObserver. 97 // Implements BitrateObserver.
95 void OnNetworkChanged(uint32_t bitrate_bps, uint8_t fraction_loss, 98 void OnNetworkChanged(uint32_t bitrate_bps, uint8_t fraction_loss,
96 int64_t rtt_ms) override; 99 int64_t rtt_ms) override;
97 100
98 private: 101 private:
99 DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet, 102 DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet,
100 size_t length); 103 size_t length);
101 DeliveryStatus DeliverRtp(MediaType media_type, 104 DeliveryStatus DeliverRtp(MediaType media_type,
102 const uint8_t* packet, 105 const uint8_t* packet,
103 size_t length, 106 size_t length,
104 const PacketTime& packet_time); 107 const PacketTime& packet_time);
105
106 void ConfigureSync(const std::string& sync_group) 108 void ConfigureSync(const std::string& sync_group)
107 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); 109 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_);
108 110
109 VoiceEngine* voice_engine() { 111 VoiceEngine* voice_engine() {
110 internal::AudioState* audio_state = 112 internal::AudioState* audio_state =
111 static_cast<internal::AudioState*>(config_.audio_state.get()); 113 static_cast<internal::AudioState*>(config_.audio_state.get());
112 if (audio_state) 114 if (audio_state)
113 return audio_state->voice_engine(); 115 return audio_state->voice_engine();
114 else 116 else
115 return nullptr; 117 return nullptr;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int64_t last_rtp_packet_received_ms_; 165 int64_t last_rtp_packet_received_ms_;
164 int64_t first_packet_sent_ms_; 166 int64_t first_packet_sent_ms_;
165 167
166 // TODO(holmer): Remove this lock once BitrateController no longer calls 168 // TODO(holmer): Remove this lock once BitrateController no longer calls
167 // OnNetworkChanged from multiple threads. 169 // OnNetworkChanged from multiple threads.
168 rtc::CriticalSection bitrate_crit_; 170 rtc::CriticalSection bitrate_crit_;
169 int64_t estimated_send_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); 171 int64_t estimated_send_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_);
170 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); 172 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_);
171 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_); 173 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_);
172 174
175 std::map<std::string, rtc::NetworkRoute> network_routes_;
176
173 VieRemb remb_; 177 VieRemb remb_;
174 const std::unique_ptr<CongestionController> congestion_controller_; 178 const std::unique_ptr<CongestionController> congestion_controller_;
175 179
176 RTC_DISALLOW_COPY_AND_ASSIGN(Call); 180 RTC_DISALLOW_COPY_AND_ASSIGN(Call);
177 }; 181 };
178 } // namespace internal 182 } // namespace internal
179 183
180 Call* Call::Create(const Call::Config& config) { 184 Call* Call::Create(const Call::Config& config) {
181 return new internal::Call(config); 185 return new internal::Call(config);
182 } 186 }
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 ReadLockScoped read_lock(*receive_crit_); 588 ReadLockScoped read_lock(*receive_crit_);
585 for (auto& kv : audio_receive_ssrcs_) { 589 for (auto& kv : audio_receive_ssrcs_) {
586 kv.second->SignalNetworkState(audio_network_state_); 590 kv.second->SignalNetworkState(audio_network_state_);
587 } 591 }
588 for (auto& kv : video_receive_ssrcs_) { 592 for (auto& kv : video_receive_ssrcs_) {
589 kv.second->SignalNetworkState(video_network_state_); 593 kv.second->SignalNetworkState(video_network_state_);
590 } 594 }
591 } 595 }
592 } 596 }
593 597
598 // TODO(honghaiz): Add tests for this method.
599 void Call::OnNetworkRouteChanged(const std::string& transport_name,
600 const rtc::NetworkRoute& network_route) {
601 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
602 // Check if the network route is connected.
603 if (!network_route.connected) {
604 LOG(LS_INFO) << "Transport " << transport_name << " is disconnected";
605 // TODO(honghaiz): Perhaps handle this in SignalChannelNetworkState and
606 // consider merging these two methods.
607 return;
608 }
609
610 // Check whether the network route has changed on each transport.
611 auto result =
612 network_routes_.insert(std::make_pair(transport_name, network_route));
613 auto kv = result.first;
614 bool inserted = result.second;
615 if (inserted) {
616 // No need to reset BWE if this is the first time the network connects.
617 return;
618 }
619 if (kv->second != network_route) {
620 kv->second = network_route;
621 LOG(LS_INFO) << "Network route changed on transport " << transport_name
622 << ": new local network id " << network_route.local_network_id
623 << " new remote network id "
624 << network_route.remote_network_id;
625 // TODO(holmer): Update the BWE bitrates.
626 }
627 }
628
594 void Call::UpdateAggregateNetworkState() { 629 void Call::UpdateAggregateNetworkState() {
595 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 630 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
596 631
597 bool have_audio = false; 632 bool have_audio = false;
598 bool have_video = false; 633 bool have_video = false;
599 { 634 {
600 ReadLockScoped read_lock(*send_crit_); 635 ReadLockScoped read_lock(*send_crit_);
601 if (audio_send_ssrcs_.size() > 0) 636 if (audio_send_ssrcs_.size() > 0)
602 have_audio = true; 637 have_audio = true;
603 if (video_send_ssrcs_.size() > 0) 638 if (video_send_ssrcs_.size() > 0)
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 // thread. Then this check can be enabled. 833 // thread. Then this check can be enabled.
799 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); 834 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread());
800 if (RtpHeaderParser::IsRtcp(packet, length)) 835 if (RtpHeaderParser::IsRtcp(packet, length))
801 return DeliverRtcp(media_type, packet, length); 836 return DeliverRtcp(media_type, packet, length);
802 837
803 return DeliverRtp(media_type, packet, length, packet_time); 838 return DeliverRtp(media_type, packet, length, packet_time);
804 } 839 }
805 840
806 } // namespace internal 841 } // namespace internal
807 } // namespace webrtc 842 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call.h ('k') | webrtc/media/base/fakemediaengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698