xref: /aosp_15_r20/external/webrtc/modules/audio_coding/neteq/tools/neteq_event_log_input.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2018 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_NETEQ_EVENT_LOG_INPUT_H_
12 #define MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_EVENT_LOG_INPUT_H_
13 
14 #include <map>
15 #include <memory>
16 #include <string>
17 
18 #include "absl/strings/string_view.h"
19 #include "modules/audio_coding/neteq/tools/neteq_packet_source_input.h"
20 #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
21 
22 namespace webrtc {
23 namespace test {
24 
25 class RtcEventLogSource;
26 
27 // Implementation of NetEqPacketSourceInput to be used with an
28 // RtcEventLogSource.
29 class NetEqEventLogInput final : public NetEqPacketSourceInput {
30  public:
31   static NetEqEventLogInput* CreateFromFile(
32       absl::string_view file_name,
33       absl::optional<uint32_t> ssrc_filter);
34   static NetEqEventLogInput* CreateFromString(
35       absl::string_view file_contents,
36       absl::optional<uint32_t> ssrc_filter);
37 
38   absl::optional<int64_t> NextOutputEventTime() const override;
39   void AdvanceOutputEvent() override;
40 
41  protected:
42   PacketSource* source() override;
43 
44  private:
45   NetEqEventLogInput(std::unique_ptr<RtcEventLogSource> source);
46   std::unique_ptr<RtcEventLogSource> source_;
47 };
48 
49 }  // namespace test
50 }  // namespace webrtc
51 #endif  // MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_EVENT_LOG_INPUT_H_
52