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

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

Issue 2328483002: Revert of Setting up an RTP input fuzzer for NetEq (Closed)
Patch Set: Created 4 years, 3 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_ENCODE_NETEQ_INPUT_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_ENCODE_NETEQ_INPUT_H_
13
14 #include <memory>
15
16 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
17 #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
18 #include "webrtc/modules/audio_coding/neteq/tools/neteq_input.h"
19 #include "webrtc/modules/include/module_common_types.h"
20
21 namespace webrtc {
22 namespace test {
23
24 // This class provides a NetEqInput that takes audio from an input file and
25 // encodes it using a given audio encoder.
26 class EncodeNetEqInput : public NetEqInput {
27 public:
28 // The source will end after the given input duration.
29 EncodeNetEqInput(std::unique_ptr<InputAudioFile> input,
30 std::unique_ptr<AudioEncoder> encoder,
31 int64_t input_duration_ms);
32
33 rtc::Optional<int64_t> NextPacketTime() const override;
34
35 rtc::Optional<int64_t> NextOutputEventTime() const override;
36
37 std::unique_ptr<PacketData> PopPacket() override;
38
39 void AdvanceOutputEvent() override;
40
41 bool ended() const override {
42 return next_output_event_ms_ <= input_duration_ms_;
43 }
44
45 rtc::Optional<RTPHeader> NextHeader() const override;
46
47 private:
48 static constexpr int64_t kOutputPeriodMs = 10;
49
50 void CreatePacket();
51
52 std::unique_ptr<InputAudioFile> input_;
53 std::unique_ptr<AudioEncoder> encoder_;
54 std::unique_ptr<PacketData> packet_data_;
55 int32_t rtp_timestamp_ = 0;
56 int16_t sequence_number_ = 0;
57 int64_t next_packet_time_ms_ = 0;
58 int64_t next_output_event_ms_ = 0;
59 const int64_t input_duration_ms_;
60 };
61
62 } // namespace test
63 } // namespace webrtc
64 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_ENCODE_NETEQ_INPUT_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq.gypi ('k') | webrtc/modules/audio_coding/neteq/tools/encode_neteq_input.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698