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/p2p/base/packettransportinterface.h" | 14 #include "webrtc/p2p/base/packettransportinterface.h" |
15 | 15 |
16 namespace webrtc { | 16 namespace webrtc { |
17 | 17 |
18 void RtpTransport::set_rtp_packet_transport(rtc::PacketTransportInternal* rtp) { | 18 void RtpTransport::set_rtp_packet_transport(rtc::PacketTransportInternal* rtp) { |
19 rtp_packet_transport_ = rtp; | 19 rtp_packet_transport_ = rtp; |
20 } | 20 } |
21 | 21 |
22 void RtpTransport::set_rtcp_packet_transport( | 22 void RtpTransport::set_rtcp_packet_transport( |
23 rtc::PacketTransportInternal* rtcp) { | 23 rtc::PacketTransportInternal* rtcp) { |
24 RTC_DCHECK(!rtcp_mux_required_); | 24 RTC_DCHECK(!rtcp_mux_required_); |
25 rtcp_packet_transport_ = rtcp; | 25 rtcp_packet_transport_ = rtcp; |
26 } | 26 } |
27 | 27 |
| 28 void RtpTransport::Connect(bool rtcp) { |
| 29 rtc::PacketTransportInternal* transport = |
| 30 rtcp ? rtcp_packet_transport_ : rtp_packet_transport_; |
| 31 RTC_DCHECK(transport); |
| 32 transport->SignalReadyToSend.connect(this, &RtpTransport::OnReadyToSend); |
| 33 } |
| 34 |
| 35 void RtpTransport::Disconnect(bool rtcp) { |
| 36 rtc::PacketTransportInternal* transport = |
| 37 rtcp ? rtcp_packet_transport_ : rtp_packet_transport_; |
| 38 RTC_DCHECK(transport); |
| 39 transport->SignalReadyToSend.disconnect(this); |
| 40 } |
| 41 |
| 42 void RtpTransport::OnReadyToSend(rtc::PacketTransportInternal* transport) { |
| 43 SetReadyToSend(transport == rtcp_packet_transport_, true); |
| 44 } |
| 45 |
| 46 void RtpTransport::SetReadyToSend(bool rtcp, bool ready) { |
| 47 if (rtcp) { |
| 48 rtcp_ready_to_send_ = ready; |
| 49 } else { |
| 50 rtp_ready_to_send_ = ready; |
| 51 } |
| 52 |
| 53 // In the case of rtcp mux |rtcp_packet_transport_| will be null. |
| 54 // TODO(zstein): A better way to verify that rtcp mux is enabled. |
| 55 bool ready_to_send = |
| 56 rtp_ready_to_send_ && (rtcp_ready_to_send_ || !rtcp_packet_transport_); |
| 57 SignalReadyToSend(ready_to_send); |
| 58 } |
| 59 |
28 PacketTransportInterface* RtpTransport::GetRtpPacketTransport() const { | 60 PacketTransportInterface* RtpTransport::GetRtpPacketTransport() const { |
29 return rtp_packet_transport_; | 61 return rtp_packet_transport_; |
30 } | 62 } |
31 | 63 |
32 PacketTransportInterface* RtpTransport::GetRtcpPacketTransport() const { | 64 PacketTransportInterface* RtpTransport::GetRtcpPacketTransport() const { |
33 return rtcp_packet_transport_; | 65 return rtcp_packet_transport_; |
34 } | 66 } |
35 | 67 |
36 RTCError RtpTransport::SetRtcpParameters(const RtcpParameters& parameters) { | 68 RTCError RtpTransport::SetRtcpParameters(const RtcpParameters& parameters) { |
37 if (rtcp_parameters_.mux && !parameters.mux) { | 69 if (rtcp_parameters_.mux && !parameters.mux) { |
(...skipping 13 matching lines...) Expand all Loading... |
51 | 83 |
52 RtcpParameters RtpTransport::GetRtcpParameters() const { | 84 RtcpParameters RtpTransport::GetRtcpParameters() const { |
53 return rtcp_parameters_; | 85 return rtcp_parameters_; |
54 } | 86 } |
55 | 87 |
56 RtpTransportAdapter* RtpTransport::GetInternal() { | 88 RtpTransportAdapter* RtpTransport::GetInternal() { |
57 return nullptr; | 89 return nullptr; |
58 } | 90 } |
59 | 91 |
60 } // namespace webrtc | 92 } // namespace webrtc |
OLD | NEW |