OLD | NEW |
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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 LOG(LS_ERROR) << "Dropping incoming " << content_name_ << " " | 778 LOG(LS_ERROR) << "Dropping incoming " << content_name_ << " " |
779 << PacketType(rtcp) | 779 << PacketType(rtcp) |
780 << " packet: wrong size=" << packet->size(); | 780 << " packet: wrong size=" << packet->size(); |
781 return false; | 781 return false; |
782 } | 782 } |
783 if (rtcp) { | 783 if (rtcp) { |
784 // Permit all (seemingly valid) RTCP packets. | 784 // Permit all (seemingly valid) RTCP packets. |
785 return true; | 785 return true; |
786 } | 786 } |
787 // Check whether we handle this payload. | 787 // Check whether we handle this payload. |
788 return bundle_filter_.DemuxPacket(packet->data(), packet->size()); | 788 return rtp_transport_.HandlesPacket(packet->data(), packet->size()); |
| 789 } |
| 790 |
| 791 bool BaseChannel::HandlesPayloadType(int packet_type) { |
| 792 return rtp_transport_.HandlesPayloadType(packet_type); |
789 } | 793 } |
790 | 794 |
791 void BaseChannel::HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet, | 795 void BaseChannel::HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet, |
792 const rtc::PacketTime& packet_time) { | 796 const rtc::PacketTime& packet_time) { |
793 RTC_DCHECK(network_thread_->IsCurrent()); | 797 RTC_DCHECK(network_thread_->IsCurrent()); |
794 if (!WantsPacket(rtcp, packet)) { | 798 if (!WantsPacket(rtcp, packet)) { |
795 return; | 799 return; |
796 } | 800 } |
797 | 801 |
798 // We are only interested in the first rtp packet because that | 802 // We are only interested in the first rtp packet because that |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 delete data; | 1445 delete data; |
1442 break; | 1446 break; |
1443 } | 1447 } |
1444 case MSG_FIRSTPACKETRECEIVED: { | 1448 case MSG_FIRSTPACKETRECEIVED: { |
1445 SignalFirstPacketReceived(this); | 1449 SignalFirstPacketReceived(this); |
1446 break; | 1450 break; |
1447 } | 1451 } |
1448 } | 1452 } |
1449 } | 1453 } |
1450 | 1454 |
| 1455 void BaseChannel::AddHandledPayloadType(int payload_type) { |
| 1456 rtp_transport_.AddHandledPayloadType(payload_type); |
| 1457 } |
| 1458 |
1451 void BaseChannel::FlushRtcpMessages_n() { | 1459 void BaseChannel::FlushRtcpMessages_n() { |
1452 // Flush all remaining RTCP messages. This should only be called in | 1460 // Flush all remaining RTCP messages. This should only be called in |
1453 // destructor. | 1461 // destructor. |
1454 RTC_DCHECK(network_thread_->IsCurrent()); | 1462 RTC_DCHECK(network_thread_->IsCurrent()); |
1455 rtc::MessageList rtcp_messages; | 1463 rtc::MessageList rtcp_messages; |
1456 network_thread_->Clear(this, MSG_SEND_RTCP_PACKET, &rtcp_messages); | 1464 network_thread_->Clear(this, MSG_SEND_RTCP_PACKET, &rtcp_messages); |
1457 for (const auto& message : rtcp_messages) { | 1465 for (const auto& message : rtcp_messages) { |
1458 network_thread_->Send(RTC_FROM_HERE, this, MSG_SEND_RTCP_PACKET, | 1466 network_thread_->Send(RTC_FROM_HERE, this, MSG_SEND_RTCP_PACKET, |
1459 message.pdata); | 1467 message.pdata); |
1460 } | 1468 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 } | 1767 } |
1760 | 1768 |
1761 AudioRecvParameters recv_params = last_recv_params_; | 1769 AudioRecvParameters recv_params = last_recv_params_; |
1762 RtpParametersFromMediaDescription(audio, &recv_params); | 1770 RtpParametersFromMediaDescription(audio, &recv_params); |
1763 if (!media_channel()->SetRecvParameters(recv_params)) { | 1771 if (!media_channel()->SetRecvParameters(recv_params)) { |
1764 SafeSetError("Failed to set local audio description recv parameters.", | 1772 SafeSetError("Failed to set local audio description recv parameters.", |
1765 error_desc); | 1773 error_desc); |
1766 return false; | 1774 return false; |
1767 } | 1775 } |
1768 for (const AudioCodec& codec : audio->codecs()) { | 1776 for (const AudioCodec& codec : audio->codecs()) { |
1769 bundle_filter()->AddPayloadType(codec.id); | 1777 AddHandledPayloadType(codec.id); |
1770 } | 1778 } |
1771 last_recv_params_ = recv_params; | 1779 last_recv_params_ = recv_params; |
1772 | 1780 |
1773 // TODO(pthatcher): Move local streams into AudioSendParameters, and | 1781 // TODO(pthatcher): Move local streams into AudioSendParameters, and |
1774 // only give it to the media channel once we have a remote | 1782 // only give it to the media channel once we have a remote |
1775 // description too (without a remote description, we won't be able | 1783 // description too (without a remote description, we won't be able |
1776 // to send them anyway). | 1784 // to send them anyway). |
1777 if (!UpdateLocalStreams_w(audio->streams(), action, error_desc)) { | 1785 if (!UpdateLocalStreams_w(audio->streams(), action, error_desc)) { |
1778 SafeSetError("Failed to set local audio description streams.", error_desc); | 1786 SafeSetError("Failed to set local audio description streams.", error_desc); |
1779 return false; | 1787 return false; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 } | 2040 } |
2033 | 2041 |
2034 VideoRecvParameters recv_params = last_recv_params_; | 2042 VideoRecvParameters recv_params = last_recv_params_; |
2035 RtpParametersFromMediaDescription(video, &recv_params); | 2043 RtpParametersFromMediaDescription(video, &recv_params); |
2036 if (!media_channel()->SetRecvParameters(recv_params)) { | 2044 if (!media_channel()->SetRecvParameters(recv_params)) { |
2037 SafeSetError("Failed to set local video description recv parameters.", | 2045 SafeSetError("Failed to set local video description recv parameters.", |
2038 error_desc); | 2046 error_desc); |
2039 return false; | 2047 return false; |
2040 } | 2048 } |
2041 for (const VideoCodec& codec : video->codecs()) { | 2049 for (const VideoCodec& codec : video->codecs()) { |
2042 bundle_filter()->AddPayloadType(codec.id); | 2050 AddHandledPayloadType(codec.id); |
2043 } | 2051 } |
2044 last_recv_params_ = recv_params; | 2052 last_recv_params_ = recv_params; |
2045 | 2053 |
2046 // TODO(pthatcher): Move local streams into VideoSendParameters, and | 2054 // TODO(pthatcher): Move local streams into VideoSendParameters, and |
2047 // only give it to the media channel once we have a remote | 2055 // only give it to the media channel once we have a remote |
2048 // description too (without a remote description, we won't be able | 2056 // description too (without a remote description, we won't be able |
2049 // to send them anyway). | 2057 // to send them anyway). |
2050 if (!UpdateLocalStreams_w(video->streams(), action, error_desc)) { | 2058 if (!UpdateLocalStreams_w(video->streams(), action, error_desc)) { |
2051 SafeSetError("Failed to set local video description streams.", error_desc); | 2059 SafeSetError("Failed to set local video description streams.", error_desc); |
2052 return false; | 2060 return false; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 } | 2235 } |
2228 | 2236 |
2229 DataRecvParameters recv_params = last_recv_params_; | 2237 DataRecvParameters recv_params = last_recv_params_; |
2230 RtpParametersFromMediaDescription(data, &recv_params); | 2238 RtpParametersFromMediaDescription(data, &recv_params); |
2231 if (!media_channel()->SetRecvParameters(recv_params)) { | 2239 if (!media_channel()->SetRecvParameters(recv_params)) { |
2232 SafeSetError("Failed to set remote data description recv parameters.", | 2240 SafeSetError("Failed to set remote data description recv parameters.", |
2233 error_desc); | 2241 error_desc); |
2234 return false; | 2242 return false; |
2235 } | 2243 } |
2236 for (const DataCodec& codec : data->codecs()) { | 2244 for (const DataCodec& codec : data->codecs()) { |
2237 bundle_filter()->AddPayloadType(codec.id); | 2245 AddHandledPayloadType(codec.id); |
2238 } | 2246 } |
2239 last_recv_params_ = recv_params; | 2247 last_recv_params_ = recv_params; |
2240 | 2248 |
2241 // TODO(pthatcher): Move local streams into DataSendParameters, and | 2249 // TODO(pthatcher): Move local streams into DataSendParameters, and |
2242 // only give it to the media channel once we have a remote | 2250 // only give it to the media channel once we have a remote |
2243 // description too (without a remote description, we won't be able | 2251 // description too (without a remote description, we won't be able |
2244 // to send them anyway). | 2252 // to send them anyway). |
2245 if (!UpdateLocalStreams_w(data->streams(), action, error_desc)) { | 2253 if (!UpdateLocalStreams_w(data->streams(), action, error_desc)) { |
2246 SafeSetError("Failed to set local data description streams.", error_desc); | 2254 SafeSetError("Failed to set local data description streams.", error_desc); |
2247 return false; | 2255 return false; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2400 | 2408 |
2401 void RtpDataChannel::OnDataChannelReadyToSend(bool writable) { | 2409 void RtpDataChannel::OnDataChannelReadyToSend(bool writable) { |
2402 // This is usded for congestion control to indicate that the stream is ready | 2410 // This is usded for congestion control to indicate that the stream is ready |
2403 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates | 2411 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates |
2404 // that the transport channel is ready. | 2412 // that the transport channel is ready. |
2405 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, | 2413 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, |
2406 new DataChannelReadyToSendMessageData(writable)); | 2414 new DataChannelReadyToSendMessageData(writable)); |
2407 } | 2415 } |
2408 | 2416 |
2409 } // namespace cricket | 2417 } // namespace cricket |
OLD | NEW |