henrik.lundin@webrtc.org | 810acbc | 2014-04-14 18:42:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame^] | 11 | #ifndef MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_SOURCE_H_ |
| 12 | #define MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_SOURCE_H_ |
henrik.lundin@webrtc.org | 810acbc | 2014-04-14 18:42:23 +0000 | [diff] [blame] | 13 | |
henrik.lundin@webrtc.org | c8e9818 | 2014-06-26 19:07:04 +0000 | [diff] [blame] | 14 | #include <bitset> |
henrik.lundin | 46ba49c | 2016-05-24 22:50:47 -0700 | [diff] [blame] | 15 | #include <memory> |
henrik.lundin@webrtc.org | c8e9818 | 2014-06-26 19:07:04 +0000 | [diff] [blame] | 16 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame^] | 17 | #include "modules/audio_coding/neteq/tools/packet.h" |
| 18 | #include "rtc_base/constructormagic.h" |
| 19 | #include "typedefs.h" |
henrik.lundin@webrtc.org | 810acbc | 2014-04-14 18:42:23 +0000 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | namespace test { |
| 23 | |
henrik.lundin@webrtc.org | 810acbc | 2014-04-14 18:42:23 +0000 | [diff] [blame] | 24 | // Interface class for an object delivering RTP packets to test applications. |
| 25 | class PacketSource { |
| 26 | public: |
kwiberg | b8e56ee | 2016-08-29 06:37:33 -0700 | [diff] [blame] | 27 | PacketSource(); |
| 28 | virtual ~PacketSource(); |
henrik.lundin@webrtc.org | 810acbc | 2014-04-14 18:42:23 +0000 | [diff] [blame] | 29 | |
henrik.lundin | 46ba49c | 2016-05-24 22:50:47 -0700 | [diff] [blame] | 30 | // Returns next packet. Returns nullptr if the source is depleted, or if an |
| 31 | // error occurred. |
| 32 | virtual std::unique_ptr<Packet> NextPacket() = 0; |
henrik.lundin@webrtc.org | 810acbc | 2014-04-14 18:42:23 +0000 | [diff] [blame] | 33 | |
kwiberg | b8e56ee | 2016-08-29 06:37:33 -0700 | [diff] [blame] | 34 | virtual void FilterOutPayloadType(uint8_t payload_type); |
henrik.lundin@webrtc.org | c8e9818 | 2014-06-26 19:07:04 +0000 | [diff] [blame] | 35 | |
kwiberg | b8e56ee | 2016-08-29 06:37:33 -0700 | [diff] [blame] | 36 | virtual void SelectSsrc(uint32_t ssrc); |
henrik.lundin@webrtc.org | 4b133da | 2014-10-02 08:19:38 +0000 | [diff] [blame] | 37 | |
henrik.lundin@webrtc.org | c8e9818 | 2014-06-26 19:07:04 +0000 | [diff] [blame] | 38 | protected: |
| 39 | std::bitset<128> filter_; // Payload type is 7 bits in the RFC. |
henrik.lundin@webrtc.org | 4b133da | 2014-10-02 08:19:38 +0000 | [diff] [blame] | 40 | // If SSRC filtering discards all packet that do not match the SSRC. |
| 41 | bool use_ssrc_filter_; // True when SSRC filtering is active. |
| 42 | uint32_t ssrc_; // The selected SSRC. All other SSRCs will be discarded. |
henrik.lundin@webrtc.org | c8e9818 | 2014-06-26 19:07:04 +0000 | [diff] [blame] | 43 | |
henrik.lundin@webrtc.org | 810acbc | 2014-04-14 18:42:23 +0000 | [diff] [blame] | 44 | private: |
henrikg | 3c089d7 | 2015-09-16 05:37:44 -0700 | [diff] [blame] | 45 | RTC_DISALLOW_COPY_AND_ASSIGN(PacketSource); |
henrik.lundin@webrtc.org | 810acbc | 2014-04-14 18:42:23 +0000 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | } // namespace test |
| 49 | } // namespace webrtc |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame^] | 50 | #endif // MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_SOURCE_H_ |