Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: webrtc/modules/audio_coding/neteq/tools/neteq_packet_source_input.h

Issue 2020363003: Refactor neteq_rtpplay (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 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 WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_PACKET_SOURCE_INPUT_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_PACKET_SOURCE_INPUT_H_
13
14 #include <string>
15
16 #include "webrtc/modules/audio_coding/neteq/tools/neteq_input.h"
17
18 namespace webrtc {
19 namespace test {
20
21 // An adapter class to dress up a PacketSource object as a NetEqInput.
22 class NetEqPacketSourceInput : public NetEqInput {
23 public:
24 NetEqPacketSourceInput();
25 rtc::Optional<int64_t> NextPacketTime() const override;
26 std::unique_ptr<PacketData> GetPacket() override;
27 rtc::Optional<RTPHeader> NextHeader() const override;
28 void SelectSsrc(uint32_t ssrc) override { source()->SelectSsrc(ssrc); }
29 bool ended() const override { return !next_output_event_ms_; }
30
31 protected:
32 virtual PacketSource* source() = 0;
33 void LoadNextPacket();
34
35 rtc::Optional<int64_t> next_output_event_ms_;
36
37 private:
38 std::unique_ptr<Packet> packet_;
39 };
40
41 class RtpFileSource;
42
43 // Implementation of NetEqPacketSourceInput to be used with an RtpFileSource.
44 class NetEqRtpDumpInput final : public NetEqPacketSourceInput {
45 public:
46 explicit NetEqRtpDumpInput(const std::string& file_name);
47
48 rtc::Optional<int64_t> NextOutputEventTime() const override;
49 void AdvanceOutputEvent() override;
50
51 protected:
52 PacketSource* source() override;
53
54 private:
55 static constexpr int64_t kOutputPeriodMs = 10;
56
57 std::unique_ptr<RtpFileSource> source_;
58 };
59
60 class RtcEventLogSource;
61
62 // Implementation of NetEqPacketSourceInput to be used with an
63 // RtcEventLogSource.
64 class NetEqEventLogInput final : public NetEqPacketSourceInput {
65 public:
66 explicit NetEqEventLogInput(const std::string& file_name);
67
68 rtc::Optional<int64_t> NextOutputEventTime() const override;
69 void AdvanceOutputEvent() override;
70
71 protected:
72 PacketSource* source() override;
73
74 private:
75 std::unique_ptr<RtcEventLogSource> source_;
76 };
77
78 } // namespace test
79 } // namespace webrtc
80 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_PACKET_SOURCE_INPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698