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

Side by Side Diff: webrtc/pc/channel.cc

Issue 1803063004: Reset the BWE when the network changes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Removed changes in call dir and leave that in a separate CL. 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/pc/channel.h ('k') | webrtc/pc/channel_unittest.cc » ('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 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 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
11 #include <utility> 11 #include <utility>
12 12
13 #include "webrtc/pc/channel.h" 13 #include "webrtc/pc/channel.h"
14 14
15 #include "webrtc/audio_sink.h" 15 #include "webrtc/audio_sink.h"
16 #include "webrtc/base/bind.h" 16 #include "webrtc/base/bind.h"
17 #include "webrtc/base/byteorder.h" 17 #include "webrtc/base/byteorder.h"
18 #include "webrtc/base/common.h" 18 #include "webrtc/base/common.h"
19 #include "webrtc/base/copyonwritebuffer.h" 19 #include "webrtc/base/copyonwritebuffer.h"
20 #include "webrtc/base/dscp.h" 20 #include "webrtc/base/dscp.h"
21 #include "webrtc/base/logging.h" 21 #include "webrtc/base/logging.h"
22 #include "webrtc/base/networkroute.h"
22 #include "webrtc/base/trace_event.h" 23 #include "webrtc/base/trace_event.h"
23 #include "webrtc/media/base/mediaconstants.h" 24 #include "webrtc/media/base/mediaconstants.h"
24 #include "webrtc/media/base/rtputils.h" 25 #include "webrtc/media/base/rtputils.h"
25 #include "webrtc/p2p/base/transportchannel.h" 26 #include "webrtc/p2p/base/transportchannel.h"
26 #include "webrtc/pc/channelmanager.h" 27 #include "webrtc/pc/channelmanager.h"
27 28
28 namespace cricket { 29 namespace cricket {
29 using rtc::Bind; 30 using rtc::Bind;
30 31
31 namespace { 32 namespace {
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 340 }
340 } 341 }
341 342
342 void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) { 343 void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) {
343 ASSERT(worker_thread_ == rtc::Thread::Current()); 344 ASSERT(worker_thread_ == rtc::Thread::Current());
344 345
345 tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState); 346 tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState);
346 tc->SignalReadPacket.connect(this, &BaseChannel::OnChannelRead); 347 tc->SignalReadPacket.connect(this, &BaseChannel::OnChannelRead);
347 tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend); 348 tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend);
348 tc->SignalDtlsState.connect(this, &BaseChannel::OnDtlsState); 349 tc->SignalDtlsState.connect(this, &BaseChannel::OnDtlsState);
350 tc->SignalSelectedCandidatePairChanged.connect(
351 this, &BaseChannel::OnSelectedCandidatePairChanged);
349 } 352 }
350 353
351 void BaseChannel::DisconnectFromTransportChannel(TransportChannel* tc) { 354 void BaseChannel::DisconnectFromTransportChannel(TransportChannel* tc) {
352 ASSERT(worker_thread_ == rtc::Thread::Current()); 355 ASSERT(worker_thread_ == rtc::Thread::Current());
353 356
354 tc->SignalWritableState.disconnect(this); 357 tc->SignalWritableState.disconnect(this);
355 tc->SignalReadPacket.disconnect(this); 358 tc->SignalReadPacket.disconnect(this);
356 tc->SignalReadyToSend.disconnect(this); 359 tc->SignalReadyToSend.disconnect(this);
357 tc->SignalDtlsState.disconnect(this); 360 tc->SignalDtlsState.disconnect(this);
358 } 361 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Reset the srtp filter if it's not the CONNECTED state. For the CONNECTED 500 // Reset the srtp filter if it's not the CONNECTED state. For the CONNECTED
498 // state, setting up DTLS-SRTP context is deferred to ChannelWritable_w to 501 // state, setting up DTLS-SRTP context is deferred to ChannelWritable_w to
499 // cover other scenarios like the whole channel is writable (not just this 502 // cover other scenarios like the whole channel is writable (not just this
500 // TransportChannel) or when TransportChannel is attached after DTLS is 503 // TransportChannel) or when TransportChannel is attached after DTLS is
501 // negotiated. 504 // negotiated.
502 if (state != DTLS_TRANSPORT_CONNECTED) { 505 if (state != DTLS_TRANSPORT_CONNECTED) {
503 srtp_filter_.ResetParams(); 506 srtp_filter_.ResetParams();
504 } 507 }
505 } 508 }
506 509
510 void BaseChannel::OnSelectedCandidatePairChanged(
511 TransportChannel* channel,
512 CandidatePairInterface* selected_candidate_pair) {
513 ASSERT(channel == transport_channel_ || channel == rtcp_transport_channel_);
514 NetworkRoute network_route;
515 if (selected_candidate_pair) {
516 network_route =
517 NetworkRoute(selected_candidate_pair->local_candidate().network_id(),
518 selected_candidate_pair->remote_candidate().network_id());
519 }
520 media_channel()->OnNetworkRouteChanged(channel->transport_name(),
521 network_route);
522 }
523
507 void BaseChannel::SetReadyToSend(bool rtcp, bool ready) { 524 void BaseChannel::SetReadyToSend(bool rtcp, bool ready) {
508 if (rtcp) { 525 if (rtcp) {
509 rtcp_ready_to_send_ = ready; 526 rtcp_ready_to_send_ = ready;
510 } else { 527 } else {
511 rtp_ready_to_send_ = ready; 528 rtp_ready_to_send_ = ready;
512 } 529 }
513 530
514 if (rtp_ready_to_send_ && 531 if (rtp_ready_to_send_ &&
515 // In the case of rtcp mux |rtcp_transport_channel_| will be null. 532 // In the case of rtcp mux |rtcp_transport_channel_| will be null.
516 (rtcp_ready_to_send_ || !rtcp_transport_channel_)) { 533 (rtcp_ready_to_send_ || !rtcp_transport_channel_)) {
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); 2203 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp();
2187 } 2204 }
2188 2205
2189 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { 2206 void DataChannel::OnStreamClosedRemotely(uint32_t sid) {
2190 rtc::TypedMessageData<uint32_t>* message = 2207 rtc::TypedMessageData<uint32_t>* message =
2191 new rtc::TypedMessageData<uint32_t>(sid); 2208 new rtc::TypedMessageData<uint32_t>(sid);
2192 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); 2209 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message);
2193 } 2210 }
2194 2211
2195 } // namespace cricket 2212 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/pc/channel.h ('k') | webrtc/pc/channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698