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

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: Fixing win compilation and gyp dependencies 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 class RtpFileSource;
22 class RtcEventLogSource;
23
24 // An adapter class to dress up a PacketSource object as a NetEqInput.
25 class NetEqPacketSourceInput : public NetEqInput {
26 public:
27 NetEqPacketSourceInput();
28 rtc::Optional<int64_t> NextPacketTime() const override;
29 std::unique_ptr<PacketData> PopPacket() override;
30 rtc::Optional<RTPHeader> NextHeader() const override;
31 bool ended() const override { return !next_output_event_ms_; }
32
33 protected:
34 virtual PacketSource* source() = 0;
35 void LoadNextPacket();
36
37 rtc::Optional<int64_t> next_output_event_ms_;
38
39 private:
40 std::unique_ptr<Packet> packet_;
41 };
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 // Implementation of NetEqPacketSourceInput to be used with an
61 // RtcEventLogSource.
62 class NetEqEventLogInput final : public NetEqPacketSourceInput {
63 public:
64 explicit NetEqEventLogInput(const std::string& file_name);
65
66 rtc::Optional<int64_t> NextOutputEventTime() const override;
67 void AdvanceOutputEvent() override;
68
69 protected:
70 PacketSource* source() override;
71
72 private:
73 std::unique_ptr<RtcEventLogSource> source_;
74 };
75
76 } // namespace test
77 } // namespace webrtc
78 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_PACKET_SOURCE_INPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698