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

Side by Side Diff: webrtc/pc/srtptransport.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/srtptransport.h ('k') | webrtc/pc/srtptransport_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
(Empty)
1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/pc/srtptransport.h"
12
13 #include <string>
14
15 #include "webrtc/media/base/rtputils.h"
16 #include "webrtc/pc/rtptransport.h"
17 #include "webrtc/pc/srtpsession.h"
18 #include "webrtc/rtc_base/asyncpacketsocket.h"
19 #include "webrtc/rtc_base/copyonwritebuffer.h"
20 #include "webrtc/rtc_base/ptr_util.h"
21 #include "webrtc/rtc_base/trace_event.h"
22
23 namespace webrtc {
24
25 SrtpTransport::SrtpTransport(bool rtcp_mux_enabled,
26 const std::string& content_name)
27 : content_name_(content_name),
28 rtp_transport_(rtc::MakeUnique<RtpTransport>(rtcp_mux_enabled)) {
29 ConnectToRtpTransport();
30 }
31
32 SrtpTransport::SrtpTransport(std::unique_ptr<RtpTransportInternal> transport,
33 const std::string& content_name)
34 : content_name_(content_name), rtp_transport_(std::move(transport)) {
35 ConnectToRtpTransport();
36 }
37
38 void SrtpTransport::ConnectToRtpTransport() {
39 rtp_transport_->SignalPacketReceived.connect(
40 this, &SrtpTransport::OnPacketReceived);
41 rtp_transport_->SignalReadyToSend.connect(this,
42 &SrtpTransport::OnReadyToSend);
43 }
44
45 bool SrtpTransport::SendPacket(bool rtcp,
46 rtc::CopyOnWriteBuffer* packet,
47 const rtc::PacketOptions& options,
48 int flags) {
49 // TODO(zstein): Protect packet.
50
51 return rtp_transport_->SendPacket(rtcp, packet, options, flags);
52 }
53
54 void SrtpTransport::OnPacketReceived(bool rtcp,
55 rtc::CopyOnWriteBuffer* packet,
56 const rtc::PacketTime& packet_time) {
57 // TODO(zstein): Unprotect packet.
58
59 SignalPacketReceived(rtcp, packet, packet_time);
60 }
61
62 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/srtptransport.h ('k') | webrtc/pc/srtptransport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698