buildbot@webrtc.org | 5ee0f05 | 2014-05-05 20:18:08 | [diff] [blame] | 1 | /* |
kjellander | 65c7f67 | 2016-02-12 08:05:01 | [diff] [blame] | 2 | * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
buildbot@webrtc.org | 5ee0f05 | 2014-05-05 20:18:08 | [diff] [blame] | 3 | * |
kjellander | 65c7f67 | 2016-02-12 08:05:01 | [diff] [blame] | 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. |
buildbot@webrtc.org | 5ee0f05 | 2014-05-05 20:18:08 | [diff] [blame] | 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #include "pc/bundlefilter.h" |
buildbot@webrtc.org | 5ee0f05 | 2014-05-05 20:18:08 | [diff] [blame] | 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 13 | #include "media/base/rtputils.h" |
| 14 | #include "rtc_base/logging.h" |
buildbot@webrtc.org | 5ee0f05 | 2014-05-05 20:18:08 | [diff] [blame] | 15 | |
| 16 | namespace cricket { |
| 17 | |
buildbot@webrtc.org | 5ee0f05 | 2014-05-05 20:18:08 | [diff] [blame] | 18 | BundleFilter::BundleFilter() { |
| 19 | } |
| 20 | |
| 21 | BundleFilter::~BundleFilter() { |
| 22 | } |
| 23 | |
pbos | 482b12e | 2015-11-16 18:19:58 | [diff] [blame] | 24 | bool 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.org | 5ee0f05 | 2014-05-05 20:18:08 | [diff] [blame] | 28 | } |
| 29 | |
pbos | 482b12e | 2015-11-16 18:19:58 | [diff] [blame] | 30 | int payload_type = 0; |
| 31 | if (!GetRtpPayloadType(data, len, &payload_type)) { |
| 32 | return false; |
buildbot@webrtc.org | 5ee0f05 | 2014-05-05 20:18:08 | [diff] [blame] | 33 | } |
pbos | 482b12e | 2015-11-16 18:19:58 | [diff] [blame] | 34 | return FindPayloadType(payload_type); |
buildbot@webrtc.org | 5ee0f05 | 2014-05-05 20:18:08 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | void BundleFilter::AddPayloadType(int payload_type) { |
| 38 | payload_types_.insert(payload_type); |
| 39 | } |
| 40 | |
buildbot@webrtc.org | 5ee0f05 | 2014-05-05 20:18:08 | [diff] [blame] | 41 | bool BundleFilter::FindPayloadType(int pl_type) const { |
| 42 | return payload_types_.find(pl_type) != payload_types_.end(); |
| 43 | } |
| 44 | |
| 45 | void BundleFilter::ClearAllPayloadTypes() { |
| 46 | payload_types_.clear(); |
| 47 | } |
| 48 | |
| 49 | } // namespace cricket |