blob: 7791da62749348ee34e7765eed94cbfb53af97e3 [file] [log] [blame]
buildbot@webrtc.org5ee0f052014-05-05 20:18:08 +00001/*
kjellander65c7f672016-02-12 00:05:01 -08002 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
buildbot@webrtc.org5ee0f052014-05-05 20:18:08 +00003 *
kjellander65c7f672016-02-12 00:05:01 -08004 * 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.
buildbot@webrtc.org5ee0f052014-05-05 20:18:08 +00009 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "pc/bundlefilter.h"
buildbot@webrtc.org5ee0f052014-05-05 20:18:08 +000012
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020013#include "media/base/rtputils.h"
14#include "rtc_base/logging.h"
buildbot@webrtc.org5ee0f052014-05-05 20:18:08 +000015
16namespace cricket {
17
buildbot@webrtc.org5ee0f052014-05-05 20:18:08 +000018BundleFilter::BundleFilter() {
19}
20
21BundleFilter::~BundleFilter() {
22}
23
pbos482b12e2015-11-16 10:19:58 -080024bool 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;
buildbot@webrtc.org5ee0f052014-05-05 20:18:08 +000028 }
29
pbos482b12e2015-11-16 10:19:58 -080030 int payload_type = 0;
31 if (!GetRtpPayloadType(data, len, &payload_type)) {
32 return false;
buildbot@webrtc.org5ee0f052014-05-05 20:18:08 +000033 }
pbos482b12e2015-11-16 10:19:58 -080034 return FindPayloadType(payload_type);
buildbot@webrtc.org5ee0f052014-05-05 20:18:08 +000035}
36
37void BundleFilter::AddPayloadType(int payload_type) {
38 payload_types_.insert(payload_type);
39}
40
buildbot@webrtc.org5ee0f052014-05-05 20:18:08 +000041bool 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