(Auto)update libjingle 69568113-> 69587333

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6500 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
buildbot@webrtc.org 2014-06-19 23:54:12 +00:00
parent 594aefa807
commit 1ef789d455
5 changed files with 34 additions and 11 deletions

View File

@ -223,4 +223,15 @@ bool SetRtpHeader(void* data, size_t len, const RtpHeader& header) {
SetRtpSsrc(data, len, header.ssrc));
}
bool IsRtpPacket(const void* data, size_t len) {
if (len < kMinRtpPacketLen)
return false;
int version = 0;
if (!GetRtpVersion(data, len, &version))
return false;
return version == kRtpVersion;
}
} // namespace cricket

View File

@ -74,6 +74,7 @@ bool SetRtpSsrc(void* data, size_t len, uint32 value);
// Assumes version 2, no padding, no extensions, no csrcs.
bool SetRtpHeader(void* data, size_t len, const RtpHeader& header);
bool IsRtpPacket(const void* data, size_t len);
} // namespace cricket
#endif // TALK_MEDIA_BASE_RTPUTILS_H_

View File

@ -47,6 +47,10 @@ bool BundleFilter::DemuxPacket(const char* data, size_t len, bool rtcp) {
// |streams_| is empty, we will allow all rtcp packets pass through provided
// that they are valid rtcp packets in case that they are for early media.
if (!rtcp) {
// It may not be a RTP packet (e.g. SCTP).
if (!IsRtpPacket(data, len))
return false;
int payload_type = 0;
if (!GetRtpPayloadType(data, len, &payload_type)) {
return false;

View File

@ -105,6 +105,15 @@ static const unsigned char kRtcpPacketNonCompoundRtcpPliFeedback[] = {
0x81, 0xCE, 0x00, 0x0C, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x11, 0x11,
};
// An SCTP packet.
static const unsigned char kSctpPacket[] = {
0x00, 0x01, 0x00, 0x01,
0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00,
};
TEST(BundleFilterTest, AddRemoveStreamTest) {
cricket::BundleFilter bundle_filter;
EXPECT_FALSE(bundle_filter.HasStreams());
@ -194,3 +203,11 @@ TEST(BundleFilterTest, RtcpPacketTest) {
reinterpret_cast<const char*>(kRtcpPacketSrSsrc2),
sizeof(kRtcpPacketSrSsrc2), true));
}
TEST(BundleFilterTest, InvalidRtpPacket) {
cricket::BundleFilter bundle_filter;
EXPECT_TRUE(bundle_filter.AddStream(StreamParams::CreateLegacy(kSsrc1)));
EXPECT_FALSE(bundle_filter.DemuxPacket(
reinterpret_cast<const char*>(kSctpPacket),
sizeof(kSctpPacket), false));
}

View File

@ -2168,21 +2168,11 @@ const ContentInfo* DataChannel::GetFirstContent(
return GetFirstDataContent(sdesc);
}
static bool IsRtpPacket(const talk_base::Buffer* packet) {
int version;
if (!GetRtpVersion(packet->data(), packet->length(), &version)) {
return false;
}
return version == 2;
}
bool DataChannel::WantsPacket(bool rtcp, talk_base::Buffer* packet) {
if (data_channel_type_ == DCT_SCTP) {
// TODO(pthatcher): Do this in a more robust way by checking for
// SCTP or DTLS.
return !IsRtpPacket(packet);
return !IsRtpPacket(packet->data(), packet->length());
} else if (data_channel_type_ == DCT_RTP) {
return BaseChannel::WantsPacket(rtcp, packet);
}