blob: 3b7dcd69e9d7d105987077996e9b73ac91cd43db [file] [log] [blame]
kjellander@webrtc.org4056bb62016-02-12 05:47:591/*
kjellander96ce6822016-02-12 08:05:012 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
kjellander@webrtc.org4056bb62016-02-12 05:47:593 *
kjellander96ce6822016-02-12 08:05:014 * 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.
kjellander@webrtc.org4056bb62016-02-12 05:47:599 */
10
11#include "webrtc/pc/bundlefilter.h"
12
kjellander@webrtc.org4056bb62016-02-12 05:47:5913#include "webrtc/media/base/rtputils.h"
Edward Lemur76de83e2017-07-06 17:44:3414#include "webrtc/rtc_base/logging.h"
kjellander@webrtc.org4056bb62016-02-12 05:47:5915
16namespace cricket {
17
18BundleFilter::BundleFilter() {
19}
20
21BundleFilter::~BundleFilter() {
22}
23
24bool BundleFilter::DemuxPacket(const uint8_t* data, size_t len) {
25 // For RTP packets, we check whether the payload type can be found.
26 if (!IsRtpPacket(data, len)) {
27 return false;
28 }
29
30 int payload_type = 0;
31 if (!GetRtpPayloadType(data, len, &payload_type)) {
32 return false;
33 }
34 return FindPayloadType(payload_type);
35}
36
37void BundleFilter::AddPayloadType(int payload_type) {
38 payload_types_.insert(payload_type);
39}
40
41bool BundleFilter::FindPayloadType(int pl_type) const {
42 return payload_types_.find(pl_type) != payload_types_.end();
43}
44
45void BundleFilter::ClearAllPayloadTypes() {
46 payload_types_.clear();
47}
48
49} // namespace cricket