OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 } | 621 } |
622 | 622 |
623 bool BaseChannel::WantsPacket(bool rtcp, rtc::Buffer* packet) { | 623 bool BaseChannel::WantsPacket(bool rtcp, rtc::Buffer* packet) { |
624 // Protect ourselves against crazy data. | 624 // Protect ourselves against crazy data. |
625 if (!ValidPacket(rtcp, packet)) { | 625 if (!ValidPacket(rtcp, packet)) { |
626 LOG(LS_ERROR) << "Dropping incoming " << content_name_ << " " | 626 LOG(LS_ERROR) << "Dropping incoming " << content_name_ << " " |
627 << PacketType(rtcp) | 627 << PacketType(rtcp) |
628 << " packet: wrong size=" << packet->size(); | 628 << " packet: wrong size=" << packet->size(); |
629 return false; | 629 return false; |
630 } | 630 } |
631 | 631 if (rtcp) { |
632 // Bundle filter handles both rtp and rtcp packets. | 632 // Permit all (seemingly valid) RTCP packets. |
633 return bundle_filter_.DemuxPacket(packet->data<char>(), packet->size(), rtcp); | 633 return true; |
| 634 } |
| 635 // Check whether we handle this payload. |
| 636 return bundle_filter_.DemuxPacket(packet->data<uint8_t>(), packet->size()); |
634 } | 637 } |
635 | 638 |
636 void BaseChannel::HandlePacket(bool rtcp, rtc::Buffer* packet, | 639 void BaseChannel::HandlePacket(bool rtcp, rtc::Buffer* packet, |
637 const rtc::PacketTime& packet_time) { | 640 const rtc::PacketTime& packet_time) { |
638 if (!WantsPacket(rtcp, packet)) { | 641 if (!WantsPacket(rtcp, packet)) { |
639 return; | 642 return; |
640 } | 643 } |
641 | 644 |
642 // We are only interested in the first rtp packet because that | 645 // We are only interested in the first rtp packet because that |
643 // indicates the media has started flowing. | 646 // indicates the media has started flowing. |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 if (transport_channel_->writable()) { | 1071 if (transport_channel_->writable()) { |
1069 ChannelWritable_w(); | 1072 ChannelWritable_w(); |
1070 } | 1073 } |
1071 } | 1074 } |
1072 | 1075 |
1073 return true; | 1076 return true; |
1074 } | 1077 } |
1075 | 1078 |
1076 bool BaseChannel::AddRecvStream_w(const StreamParams& sp) { | 1079 bool BaseChannel::AddRecvStream_w(const StreamParams& sp) { |
1077 ASSERT(worker_thread() == rtc::Thread::Current()); | 1080 ASSERT(worker_thread() == rtc::Thread::Current()); |
1078 if (!media_channel()->AddRecvStream(sp)) | 1081 return media_channel()->AddRecvStream(sp); |
1079 return false; | |
1080 | |
1081 return bundle_filter_.AddStream(sp); | |
1082 } | 1082 } |
1083 | 1083 |
1084 bool BaseChannel::RemoveRecvStream_w(uint32_t ssrc) { | 1084 bool BaseChannel::RemoveRecvStream_w(uint32_t ssrc) { |
1085 ASSERT(worker_thread() == rtc::Thread::Current()); | 1085 ASSERT(worker_thread() == rtc::Thread::Current()); |
1086 bundle_filter_.RemoveStream(ssrc); | |
1087 return media_channel()->RemoveRecvStream(ssrc); | 1086 return media_channel()->RemoveRecvStream(ssrc); |
1088 } | 1087 } |
1089 | 1088 |
1090 bool BaseChannel::UpdateLocalStreams_w(const std::vector<StreamParams>& streams, | 1089 bool BaseChannel::UpdateLocalStreams_w(const std::vector<StreamParams>& streams, |
1091 ContentAction action, | 1090 ContentAction action, |
1092 std::string* error_desc) { | 1091 std::string* error_desc) { |
1093 if (!VERIFY(action == CA_OFFER || action == CA_ANSWER || | 1092 if (!VERIFY(action == CA_OFFER || action == CA_ANSWER || |
1094 action == CA_PRANSWER || action == CA_UPDATE)) | 1093 action == CA_PRANSWER || action == CA_UPDATE)) |
1095 return false; | 1094 return false; |
1096 | 1095 |
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 return (data_channel_type_ == DCT_RTP); | 2287 return (data_channel_type_ == DCT_RTP); |
2289 } | 2288 } |
2290 | 2289 |
2291 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2290 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
2292 rtc::TypedMessageData<uint32_t>* message = | 2291 rtc::TypedMessageData<uint32_t>* message = |
2293 new rtc::TypedMessageData<uint32_t>(sid); | 2292 new rtc::TypedMessageData<uint32_t>(sid); |
2294 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2293 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2295 } | 2294 } |
2296 | 2295 |
2297 } // namespace cricket | 2296 } // namespace cricket |
OLD | NEW |