2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-12 00:05:01 -08:00
|
|
|
* Copyright 2004 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-12 00:05:01 -08:00
|
|
|
* 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.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef PC_BUNDLEFILTER_H_
|
|
|
|
|
#define PC_BUNDLEFILTER_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-11-16 10:19:58 -08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2014-05-05 20:18:08 +00:00
|
|
|
#include <set>
|
2013-07-10 00:45:36 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "media/base/streamparams.h"
|
|
|
|
|
#include "rtc_base/basictypes.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace cricket {
|
|
|
|
|
|
|
|
|
|
// In case of single RTP session and single transport channel, all session
|
2015-11-16 10:19:58 -08:00
|
|
|
// (or media) channels share a common transport channel. Hence they all get
|
2013-07-10 00:45:36 +00:00
|
|
|
// SignalReadPacket when packet received on transport channel. This requires
|
|
|
|
|
// cricket::BaseChannel to know all the valid sources, else media channel
|
|
|
|
|
// will decode invalid packets.
|
2014-05-05 20:18:08 +00:00
|
|
|
//
|
|
|
|
|
// This class determines whether a packet is destined for cricket::BaseChannel.
|
2015-11-16 10:19:58 -08:00
|
|
|
// 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.
|
2014-05-05 20:18:08 +00:00
|
|
|
class BundleFilter {
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
2014-05-05 20:18:08 +00:00
|
|
|
BundleFilter();
|
|
|
|
|
~BundleFilter();
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-11-16 10:19:58 -08:00
|
|
|
// Determines if a RTP packet belongs to valid cricket::BaseChannel.
|
|
|
|
|
bool DemuxPacket(const uint8_t* data, size_t len);
|
2014-05-05 20:18:08 +00:00
|
|
|
|
|
|
|
|
// Adds the supported payload type.
|
|
|
|
|
void AddPayloadType(int payload_type);
|
|
|
|
|
|
2015-11-16 10:19:58 -08:00
|
|
|
// Public for unittests.
|
2014-05-05 20:18:08 +00:00
|
|
|
bool FindPayloadType(int pl_type) const;
|
|
|
|
|
void ClearAllPayloadTypes();
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
private:
|
2014-05-05 20:18:08 +00:00
|
|
|
std::set<int> payload_types_;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace cricket
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // PC_BUNDLEFILTER_H_
|