OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 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 "webrtc/pc/rtptransport.h" | 11 #include "webrtc/pc/rtptransport.h" |
12 | 12 |
13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
14 #include "webrtc/base/ptr_util.h" | |
14 | 15 |
15 namespace webrtc { | 16 namespace webrtc { |
16 | 17 |
18 RtpTransport::RtpTransport(bool rtcp_mux_required) | |
19 : rtcp_mux_required_(rtcp_mux_required), | |
20 rtp_packet_transport_wrapper_(rtc::MakeUnique<PacketTransportWrapper>()), | |
21 rtcp_packet_transport_wrapper_( | |
22 rtc::MakeUnique<PacketTransportWrapper>()) {} | |
23 | |
24 void RtpTransport::set_rtp_packet_transport(rtc::PacketTransportInternal* rtp) { | |
25 rtp_packet_transport_wrapper_->set_transport(rtp); | |
26 } | |
27 | |
17 void RtpTransport::set_rtcp_packet_transport( | 28 void RtpTransport::set_rtcp_packet_transport( |
18 rtc::PacketTransportInternal* rtcp) { | 29 rtc::PacketTransportInternal* rtcp) { |
19 RTC_DCHECK(!rtcp_mux_required_); | 30 RTC_DCHECK(!rtcp_mux_required_); |
20 rtcp_packet_transport_ = rtcp; | 31 rtcp_packet_transport_wrapper_->set_transport(rtcp); |
32 } | |
33 | |
34 PacketTransportInterface* RtpTransport::GetRtpPacketTransport() const { | |
35 return rtp_packet_transport_wrapper_.get(); | |
36 } | |
37 | |
38 PacketTransportInterface* RtpTransport::GetRtcpPacketTransport() const { | |
39 return rtcp_packet_transport_wrapper_.get(); | |
40 } | |
41 | |
42 RTCError RtpTransport::SetRtcpParameters(const RtcpParameters& parameters) { | |
43 // disabling mux is not allowed | |
44 if (rtcp_parameters_.mux && !parameters.mux) { | |
45 return RTCError(RTCErrorType::INVALID_PARAMETER, | |
46 "disabling mux is not allowed"); | |
Taylor Brandstetter
2017/04/07 04:16:03
Can use the LOG_AND_RETURN_ERROR macro so this get
Zach Stein
2017/04/10 22:37:43
Done.
| |
47 } | |
48 | |
49 RtcpParameters new_parameters = parameters; | |
50 | |
51 if (new_parameters.cname.empty()) { | |
52 new_parameters.cname = rtcp_parameters_.cname; | |
53 } | |
54 | |
55 rtcp_parameters_ = new_parameters; | |
56 return RTCError::OK(); | |
57 } | |
58 | |
59 RtcpParameters RtpTransport::GetRtcpParameters() const { | |
60 return rtcp_parameters_; | |
61 } | |
62 | |
63 RtpTransportAdapter* RtpTransport::GetInternal() { | |
64 return nullptr; | |
21 } | 65 } |
22 | 66 |
23 } // namespace webrtc | 67 } // namespace webrtc |
OLD | NEW |