Remove cricket::BundleFilter.
This code is never built by GN, and the header is never included. Bug: webrtc:9855 Change-Id: I16e6a54cc95629917d454f91d9bcc99fc55d8a00 Reviewed-on: https://webrtc-review.googlesource.com/c/111754 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25753}
This commit is contained in:
parent
eccfc47ffa
commit
94c94205f7
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "pc/bundlefilter.h"
|
||||
|
||||
#include "media/base/rtputils.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
BundleFilter::BundleFilter() {}
|
||||
|
||||
BundleFilter::~BundleFilter() {}
|
||||
|
||||
bool BundleFilter::DemuxPacket(const uint8_t* data, size_t len) {
|
||||
// For RTP packets, we check whether the payload type can be found.
|
||||
if (!IsRtpPacket(data, len)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int payload_type = 0;
|
||||
if (!GetRtpPayloadType(data, len, &payload_type)) {
|
||||
return false;
|
||||
}
|
||||
return FindPayloadType(payload_type);
|
||||
}
|
||||
|
||||
void BundleFilter::AddPayloadType(int payload_type) {
|
||||
payload_types_.insert(payload_type);
|
||||
}
|
||||
|
||||
bool BundleFilter::FindPayloadType(int pl_type) const {
|
||||
return payload_types_.find(pl_type) != payload_types_.end();
|
||||
}
|
||||
|
||||
void BundleFilter::ClearAllPayloadTypes() {
|
||||
payload_types_.clear();
|
||||
}
|
||||
|
||||
} // namespace cricket
|
||||
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef PC_BUNDLEFILTER_H_
|
||||
#define PC_BUNDLEFILTER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "media/base/streamparams.h"
|
||||
#include "rtc_base/basictypes.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
// In case of single RTP session and single transport channel, all session
|
||||
// (or media) channels share a common transport channel. Hence they all get
|
||||
// SignalReadPacket when packet received on transport channel. This requires
|
||||
// cricket::BaseChannel to know all the valid sources, else media channel
|
||||
// will decode invalid packets.
|
||||
//
|
||||
// This class determines whether a packet is destined for cricket::BaseChannel.
|
||||
// This is only to be used for RTP packets as RTCP packets are not filtered.
|
||||
// For RTP packets, this is decided based on the payload type.
|
||||
class BundleFilter {
|
||||
public:
|
||||
BundleFilter();
|
||||
~BundleFilter();
|
||||
|
||||
// Determines if a RTP packet belongs to valid cricket::BaseChannel.
|
||||
bool DemuxPacket(const uint8_t* data, size_t len);
|
||||
|
||||
// Adds the supported payload type.
|
||||
void AddPayloadType(int payload_type);
|
||||
|
||||
// Public for unittests.
|
||||
bool FindPayloadType(int pl_type) const;
|
||||
void ClearAllPayloadTypes();
|
||||
|
||||
private:
|
||||
std::set<int> payload_types_;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
#endif // PC_BUNDLEFILTER_H_
|
||||
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "pc/bundlefilter.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
|
||||
using cricket::StreamParams;
|
||||
|
||||
static const int kPayloadType1 = 0x11;
|
||||
static const int kPayloadType2 = 0x22;
|
||||
static const int kPayloadType3 = 0x33;
|
||||
|
||||
// SSRC = 0x1111, Payload type = 0x11
|
||||
static const unsigned char kRtpPacketPt1Ssrc1[] = {
|
||||
0x80, kPayloadType1, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x11, 0x11,
|
||||
};
|
||||
|
||||
// SSRC = 0x2222, Payload type = 0x22
|
||||
static const unsigned char kRtpPacketPt2Ssrc2[] = {
|
||||
0x80, 0x80 + kPayloadType2,
|
||||
0x00, 0x01,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x22, 0x22,
|
||||
};
|
||||
|
||||
// SSRC = 0x2222, Payload type = 0x33
|
||||
static const unsigned char kRtpPacketPt3Ssrc2[] = {
|
||||
0x80, kPayloadType3, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x22, 0x22,
|
||||
};
|
||||
|
||||
// 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, RtpPacketTest) {
|
||||
cricket::BundleFilter bundle_filter;
|
||||
bundle_filter.AddPayloadType(kPayloadType1);
|
||||
EXPECT_TRUE(bundle_filter.DemuxPacket(kRtpPacketPt1Ssrc1,
|
||||
sizeof(kRtpPacketPt1Ssrc1)));
|
||||
bundle_filter.AddPayloadType(kPayloadType2);
|
||||
EXPECT_TRUE(bundle_filter.DemuxPacket(kRtpPacketPt2Ssrc2,
|
||||
sizeof(kRtpPacketPt2Ssrc2)));
|
||||
|
||||
// Payload type 0x33 is not added.
|
||||
EXPECT_FALSE(bundle_filter.DemuxPacket(kRtpPacketPt3Ssrc2,
|
||||
sizeof(kRtpPacketPt3Ssrc2)));
|
||||
// Size is too small.
|
||||
EXPECT_FALSE(bundle_filter.DemuxPacket(kRtpPacketPt1Ssrc1, 11));
|
||||
|
||||
bundle_filter.ClearAllPayloadTypes();
|
||||
EXPECT_FALSE(bundle_filter.DemuxPacket(kRtpPacketPt1Ssrc1,
|
||||
sizeof(kRtpPacketPt1Ssrc1)));
|
||||
EXPECT_FALSE(bundle_filter.DemuxPacket(kRtpPacketPt2Ssrc2,
|
||||
sizeof(kRtpPacketPt2Ssrc2)));
|
||||
}
|
||||
|
||||
TEST(BundleFilterTest, InvalidRtpPacket) {
|
||||
cricket::BundleFilter bundle_filter;
|
||||
EXPECT_FALSE(bundle_filter.DemuxPacket(kSctpPacket, sizeof(kSctpPacket)));
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user