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

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

Issue 2981013002: Introduce RtpTransportInternal and SrtpTransport. (Closed)
Patch Set: Depend on test:test_support for gmock. Created 3 years, 5 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/rtptransport.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 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
(...skipping 13 matching lines...) Expand all
24 #include "webrtc/rtc_base/dscp.h" 24 #include "webrtc/rtc_base/dscp.h"
25 #include "webrtc/rtc_base/logging.h" 25 #include "webrtc/rtc_base/logging.h"
26 #include "webrtc/rtc_base/networkroute.h" 26 #include "webrtc/rtc_base/networkroute.h"
27 #include "webrtc/rtc_base/ptr_util.h" 27 #include "webrtc/rtc_base/ptr_util.h"
28 #include "webrtc/rtc_base/trace_event.h" 28 #include "webrtc/rtc_base/trace_event.h"
29 // Adding 'nogncheck' to disable the gn include headers check to support modular 29 // Adding 'nogncheck' to disable the gn include headers check to support modular
30 // WebRTC build targets. 30 // WebRTC build targets.
31 #include "webrtc/media/engine/webrtcvoiceengine.h" // nogncheck 31 #include "webrtc/media/engine/webrtcvoiceengine.h" // nogncheck
32 #include "webrtc/p2p/base/packettransportinternal.h" 32 #include "webrtc/p2p/base/packettransportinternal.h"
33 #include "webrtc/pc/channelmanager.h" 33 #include "webrtc/pc/channelmanager.h"
34 #include "webrtc/pc/rtptransport.h"
35 #include "webrtc/pc/srtptransport.h"
34 36
35 namespace cricket { 37 namespace cricket {
36 using rtc::Bind; 38 using rtc::Bind;
37 39
38 namespace { 40 namespace {
39 // See comment below for why we need to use a pointer to a unique_ptr. 41 // See comment below for why we need to use a pointer to a unique_ptr.
40 bool SetRawAudioSink_w(VoiceMediaChannel* channel, 42 bool SetRawAudioSink_w(VoiceMediaChannel* channel,
41 uint32_t ssrc, 43 uint32_t ssrc,
42 std::unique_ptr<webrtc::AudioSinkInterface>* sink) { 44 std::unique_ptr<webrtc::AudioSinkInterface>* sink) {
43 channel->SetRawAudioSink(ssrc, std::move(*sink)); 45 channel->SetRawAudioSink(ssrc, std::move(*sink));
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 rtc::Thread* signaling_thread, 151 rtc::Thread* signaling_thread,
150 MediaChannel* media_channel, 152 MediaChannel* media_channel,
151 const std::string& content_name, 153 const std::string& content_name,
152 bool rtcp_mux_required, 154 bool rtcp_mux_required,
153 bool srtp_required) 155 bool srtp_required)
154 : worker_thread_(worker_thread), 156 : worker_thread_(worker_thread),
155 network_thread_(network_thread), 157 network_thread_(network_thread),
156 signaling_thread_(signaling_thread), 158 signaling_thread_(signaling_thread),
157 content_name_(content_name), 159 content_name_(content_name),
158 rtcp_mux_required_(rtcp_mux_required), 160 rtcp_mux_required_(rtcp_mux_required),
159 rtp_transport_(rtc::MakeUnique<webrtc::RtpTransport>(rtcp_mux_required)), 161 rtp_transport_(
162 srtp_required
163 ? rtc::WrapUnique<webrtc::RtpTransportInternal>(
164 new webrtc::SrtpTransport(rtcp_mux_required, content_name))
165 : rtc::MakeUnique<webrtc::RtpTransport>(rtcp_mux_required)),
160 srtp_required_(srtp_required), 166 srtp_required_(srtp_required),
161 media_channel_(media_channel), 167 media_channel_(media_channel),
162 selected_candidate_pair_(nullptr) { 168 selected_candidate_pair_(nullptr) {
163 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); 169 RTC_DCHECK(worker_thread_ == rtc::Thread::Current());
164 #if defined(ENABLE_EXTERNAL_AUTH) 170 #if defined(ENABLE_EXTERNAL_AUTH)
165 srtp_filter_.EnableExternalAuth(); 171 srtp_filter_.EnableExternalAuth();
166 #endif 172 #endif
167 rtp_transport_->SignalReadyToSend.connect( 173 rtp_transport_->SignalReadyToSend.connect(
168 this, &BaseChannel::OnTransportReadyToSend); 174 this, &BaseChannel::OnTransportReadyToSend);
169 // TODO(zstein): RtpTransport::SignalPacketReceived will probably be replaced 175 // TODO(zstein): RtpTransport::SignalPacketReceived will probably be replaced
170 // with a callback interface later so that the demuxer can select which 176 // with a callback interface later so that the demuxer can select which
171 // channel to signal. 177 // channel to signal.
172 rtp_transport_->SignalPacketReceived.connect(this, 178 rtp_transport_->SignalPacketReceived.connect(this,
173 &BaseChannel::OnPacketReceived); 179 &BaseChannel::OnPacketReceived);
174 LOG(LS_INFO) << "Created channel for " << content_name; 180 LOG(LS_INFO) << "Created channel for " << content_name;
175 } 181 }
176 182
177 BaseChannel::~BaseChannel() { 183 BaseChannel::~BaseChannel() {
178 TRACE_EVENT0("webrtc", "BaseChannel::~BaseChannel"); 184 TRACE_EVENT0("webrtc", "BaseChannel::~BaseChannel");
179 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); 185 RTC_DCHECK(worker_thread_ == rtc::Thread::Current());
180 Deinit(); 186 Deinit();
181 StopConnectionMonitor(); 187 StopConnectionMonitor();
182 // Eats any outstanding messages or packets. 188 // Eats any outstanding messages or packets.
183 worker_thread_->Clear(&invoker_); 189 worker_thread_->Clear(&invoker_);
(...skipping 2264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2448 2454
2449 void RtpDataChannel::OnDataChannelReadyToSend(bool writable) { 2455 void RtpDataChannel::OnDataChannelReadyToSend(bool writable) {
2450 // This is usded for congestion control to indicate that the stream is ready 2456 // This is usded for congestion control to indicate that the stream is ready
2451 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates 2457 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates
2452 // that the transport channel is ready. 2458 // that the transport channel is ready.
2453 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, 2459 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA,
2454 new DataChannelReadyToSendMessageData(writable)); 2460 new DataChannelReadyToSendMessageData(writable));
2455 } 2461 }
2456 2462
2457 } // namespace cricket 2463 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/pc/channel.h ('k') | webrtc/pc/rtptransport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698