blob: 7decbba8a4f2ff5e507e03d253d3b17d44b2f1f6 [file] [log] [blame]
Zhi Huang95e7dbb2018-03-29 00:08:031/*
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef PC_BUNDLEFILTER_H_
12#define PC_BUNDLEFILTER_H_
13
14#include <stdint.h>
15
16#include <set>
17#include <vector>
18
19#include "media/base/streamparams.h"
20#include "rtc_base/basictypes.h"
21
22namespace cricket {
23
24// In case of single RTP session and single transport channel, all session
25// (or media) channels share a common transport channel. Hence they all get
26// SignalReadPacket when packet received on transport channel. This requires
27// cricket::BaseChannel to know all the valid sources, else media channel
28// will decode invalid packets.
29//
30// This class determines whether a packet is destined for cricket::BaseChannel.
31// This is only to be used for RTP packets as RTCP packets are not filtered.
32// For RTP packets, this is decided based on the payload type.
33class BundleFilter {
34 public:
35 BundleFilter();
36 ~BundleFilter();
37
38 // Determines if a RTP packet belongs to valid cricket::BaseChannel.
39 bool DemuxPacket(const uint8_t* data, size_t len);
40
41 // Adds the supported payload type.
42 void AddPayloadType(int payload_type);
43
44 // Public for unittests.
45 bool FindPayloadType(int pl_type) const;
46 void ClearAllPayloadTypes();
47
48 private:
49 std::set<int> payload_types_;
50};
51
52} // namespace cricket
53
54#endif // PC_BUNDLEFILTER_H_