1 /* 2 * Copyright (c) 2019 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 11 #ifndef MODULES_AUDIO_CODING_NETEQ_TOOLS_INITIAL_PACKET_INSERTER_NETEQ_INPUT_H_ 12 #define MODULES_AUDIO_CODING_NETEQ_TOOLS_INITIAL_PACKET_INSERTER_NETEQ_INPUT_H_ 13 14 #include <map> 15 #include <memory> 16 #include <string> 17 18 #include "modules/audio_coding/neteq/tools/neteq_input.h" 19 20 namespace webrtc { 21 namespace test { 22 23 // Wrapper class that can insert a number of packets at the start of the 24 // simulation. 25 class InitialPacketInserterNetEqInput final : public NetEqInput { 26 public: 27 InitialPacketInserterNetEqInput(std::unique_ptr<NetEqInput> source, 28 int number_of_initial_packets, 29 int sample_rate_hz); 30 absl::optional<int64_t> NextPacketTime() const override; 31 absl::optional<int64_t> NextOutputEventTime() const override; 32 std::unique_ptr<PacketData> PopPacket() override; 33 void AdvanceOutputEvent() override; 34 bool ended() const override; 35 absl::optional<RTPHeader> NextHeader() const override; 36 37 private: 38 const std::unique_ptr<NetEqInput> source_; 39 int packets_to_insert_; 40 const int sample_rate_hz_; 41 std::unique_ptr<PacketData> first_packet_; 42 }; 43 44 } // namespace test 45 } // namespace webrtc 46 #endif // MODULES_AUDIO_CODING_NETEQ_TOOLS_INITIAL_PACKET_INSERTER_NETEQ_INPUT_H_ 47