zstein | d48dbda | 2017-04-04 19:45:57 -0700 | [diff] [blame] | 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/rtptransport.h" |
| 12 | |
| 13 | #include "webrtc/base/checks.h" |
zstein | d9ce764 | 2017-04-10 16:17:57 -0700 | [diff] [blame^] | 14 | #include "webrtc/p2p/base/packettransportinterface.h" |
zstein | d48dbda | 2017-04-04 19:45:57 -0700 | [diff] [blame] | 15 | |
| 16 | namespace webrtc { |
| 17 | |
zstein | d9ce764 | 2017-04-10 16:17:57 -0700 | [diff] [blame^] | 18 | void RtpTransport::set_rtp_packet_transport(rtc::PacketTransportInternal* rtp) { |
| 19 | rtp_packet_transport_ = rtp; |
| 20 | } |
| 21 | |
zstein | d48dbda | 2017-04-04 19:45:57 -0700 | [diff] [blame] | 22 | void RtpTransport::set_rtcp_packet_transport( |
| 23 | rtc::PacketTransportInternal* rtcp) { |
| 24 | RTC_DCHECK(!rtcp_mux_required_); |
| 25 | rtcp_packet_transport_ = rtcp; |
| 26 | } |
| 27 | |
zstein | d9ce764 | 2017-04-10 16:17:57 -0700 | [diff] [blame^] | 28 | PacketTransportInterface* RtpTransport::GetRtpPacketTransport() const { |
| 29 | return rtp_packet_transport_; |
| 30 | } |
| 31 | |
| 32 | PacketTransportInterface* RtpTransport::GetRtcpPacketTransport() const { |
| 33 | return rtcp_packet_transport_; |
| 34 | } |
| 35 | |
| 36 | RTCError RtpTransport::SetRtcpParameters(const RtcpParameters& parameters) { |
| 37 | if (rtcp_parameters_.mux && !parameters.mux) { |
| 38 | LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_STATE, |
| 39 | "Disabling RTCP muxing is not allowed."); |
| 40 | } |
| 41 | |
| 42 | RtcpParameters new_parameters = parameters; |
| 43 | |
| 44 | if (new_parameters.cname.empty()) { |
| 45 | new_parameters.cname = rtcp_parameters_.cname; |
| 46 | } |
| 47 | |
| 48 | rtcp_parameters_ = new_parameters; |
| 49 | return RTCError::OK(); |
| 50 | } |
| 51 | |
| 52 | RtcpParameters RtpTransport::GetRtcpParameters() const { |
| 53 | return rtcp_parameters_; |
| 54 | } |
| 55 | |
| 56 | RtpTransportAdapter* RtpTransport::GetInternal() { |
| 57 | return nullptr; |
| 58 | } |
| 59 | |
zstein | d48dbda | 2017-04-04 19:45:57 -0700 | [diff] [blame] | 60 | } // namespace webrtc |