packet_source.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #ifndef MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_SOURCE_H_
  11. #define MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_SOURCE_H_
  12. #include <bitset>
  13. #include <memory>
  14. #include "modules/audio_coding/neteq/tools/packet.h"
  15. #include "rtc_base/constructor_magic.h"
  16. namespace webrtc {
  17. namespace test {
  18. // Interface class for an object delivering RTP packets to test applications.
  19. class PacketSource {
  20. public:
  21. PacketSource();
  22. virtual ~PacketSource();
  23. // Returns next packet. Returns nullptr if the source is depleted, or if an
  24. // error occurred.
  25. virtual std::unique_ptr<Packet> NextPacket() = 0;
  26. virtual void FilterOutPayloadType(uint8_t payload_type);
  27. protected:
  28. std::bitset<128> filter_; // Payload type is 7 bits in the RFC.
  29. private:
  30. RTC_DISALLOW_COPY_AND_ASSIGN(PacketSource);
  31. };
  32. } // namespace test
  33. } // namespace webrtc
  34. #endif // MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_SOURCE_H_