blob: 7791da62749348ee34e7765eed94cbfb53af97e3 [file] [log] [blame]
buildbot@webrtc.org5ee0f052014-05-05 20:18:081/*
kjellander65c7f672016-02-12 08:05:012 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
buildbot@webrtc.org5ee0f052014-05-05 20:18:083 *
kjellander65c7f672016-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.
buildbot@webrtc.org5ee0f052014-05-05 20:18:089 */
10
Mirko Bonadei92ea95e2017-09-15 04:47:3111#include "pc/bundlefilter.h"
buildbot@webrtc.org5ee0f052014-05-05 20:18:0812
Mirko Bonadei92ea95e2017-09-15 04:47:3113#include "media/base/rtputils.h"
14#include "rtc_base/logging.h"
buildbot@webrtc.org5ee0f052014-05-05 20:18:0815
16namespace cricket {
17
buildbot@webrtc.org5ee0f052014-05-05 20:18:0818BundleFilter::BundleFilter() {
19}
20
21BundleFilter::~BundleFilter() {
22}
23
pbos482b12e2015-11-16 18:19:5824bool 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:0828 }
29
pbos482b12e2015-11-16 18:19:5830 int payload_type = 0;
31 if (!GetRtpPayloadType(data, len, &payload_type)) {
32 return false;
buildbot@webrtc.org5ee0f052014-05-05 20:18:0833 }
pbos482b12e2015-11-16 18:19:5834 return FindPayloadType(payload_type);
buildbot@webrtc.org5ee0f052014-05-05 20:18:0835}
36
37void BundleFilter::AddPayloadType(int payload_type) {
38 payload_types_.insert(payload_type);
39}
40
buildbot@webrtc.org5ee0f052014-05-05 20:18:0841bool 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