blob: 233ddec0182b043f721b3662a9053b0004d403dc [file] [log] [blame]
henrik.lundin@webrtc.org810acbc2014-04-14 18:42:23 +00001/*
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
henrik.lundin@webrtc.org9c55f0f2014-06-09 08:10:28 +000011#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_SOURCE_H_
12#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_SOURCE_H_
henrik.lundin@webrtc.org810acbc2014-04-14 18:42:23 +000013
henrik.lundin@webrtc.orgc8e98182014-06-26 19:07:04 +000014#include <bitset>
henrik.lundin46ba49c2016-05-24 22:50:47 -070015#include <memory>
henrik.lundin@webrtc.orgc8e98182014-06-26 19:07:04 +000016
henrik.lundin@webrtc.org966a7082014-11-17 09:08:38 +000017#include "webrtc/modules/audio_coding/neteq/tools/packet.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020018#include "webrtc/rtc_base/constructormagic.h"
henrik.lundin@webrtc.orgc8e98182014-06-26 19:07:04 +000019#include "webrtc/typedefs.h"
henrik.lundin@webrtc.org810acbc2014-04-14 18:42:23 +000020
21namespace webrtc {
22namespace test {
23
henrik.lundin@webrtc.org810acbc2014-04-14 18:42:23 +000024// Interface class for an object delivering RTP packets to test applications.
25class PacketSource {
26 public:
kwibergb8e56ee2016-08-29 06:37:33 -070027 PacketSource();
28 virtual ~PacketSource();
henrik.lundin@webrtc.org810acbc2014-04-14 18:42:23 +000029
henrik.lundin46ba49c2016-05-24 22:50:47 -070030 // 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.org810acbc2014-04-14 18:42:23 +000033
kwibergb8e56ee2016-08-29 06:37:33 -070034 virtual void FilterOutPayloadType(uint8_t payload_type);
henrik.lundin@webrtc.orgc8e98182014-06-26 19:07:04 +000035
kwibergb8e56ee2016-08-29 06:37:33 -070036 virtual void SelectSsrc(uint32_t ssrc);
henrik.lundin@webrtc.org4b133da2014-10-02 08:19:38 +000037
henrik.lundin@webrtc.orgc8e98182014-06-26 19:07:04 +000038 protected:
39 std::bitset<128> filter_; // Payload type is 7 bits in the RFC.
henrik.lundin@webrtc.org4b133da2014-10-02 08:19:38 +000040 // 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.orgc8e98182014-06-26 19:07:04 +000043
henrik.lundin@webrtc.org810acbc2014-04-14 18:42:23 +000044 private:
henrikg3c089d72015-09-16 05:37:44 -070045 RTC_DISALLOW_COPY_AND_ASSIGN(PacketSource);
henrik.lundin@webrtc.org810acbc2014-04-14 18:42:23 +000046};
47
48} // namespace test
49} // namespace webrtc
henrik.lundin@webrtc.org9c55f0f2014-06-09 08:10:28 +000050#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_SOURCE_H_