2016-03-17 02:39:30 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_AUDIO_PROCESSING_TEST_DEBUG_DUMP_REPLAYER_H_
|
|
|
|
|
#define MODULES_AUDIO_PROCESSING_TEST_DEBUG_DUMP_REPLAYER_H_
|
2016-03-17 02:39:30 -07:00
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
2022-08-16 14:44:38 +02:00
|
|
|
#include "absl/strings/string_view.h"
|
2024-04-19 15:07:08 +00:00
|
|
|
#include "api/audio/audio_processing.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "common_audio/channel_buffer.h"
|
2016-03-17 02:39:30 -07:00
|
|
|
|
2023-10-31 15:44:50 +01:00
|
|
|
// Generated at build-time by the protobuf compiler.
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/audio_processing/debug.pb.h"
|
2016-09-28 17:42:01 -07:00
|
|
|
|
2016-03-17 02:39:30 -07:00
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
class DebugDumpReplayer {
|
|
|
|
|
public:
|
|
|
|
|
DebugDumpReplayer();
|
|
|
|
|
~DebugDumpReplayer();
|
|
|
|
|
|
|
|
|
|
// Set dump file
|
2022-08-16 14:44:38 +02:00
|
|
|
bool SetDumpFile(absl::string_view filename);
|
2016-03-17 02:39:30 -07:00
|
|
|
|
|
|
|
|
// Return next event.
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<audioproc::Event> GetNextEvent() const;
|
2016-03-17 02:39:30 -07:00
|
|
|
|
|
|
|
|
// Run the next event. Returns true if succeeded.
|
|
|
|
|
bool RunNextEvent();
|
|
|
|
|
|
|
|
|
|
const ChannelBuffer<float>* GetOutput() const;
|
|
|
|
|
StreamConfig GetOutputConfig() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// Following functions are facilities for replaying debug dumps.
|
|
|
|
|
void OnInitEvent(const audioproc::Init& msg);
|
|
|
|
|
void OnStreamEvent(const audioproc::Stream& msg);
|
|
|
|
|
void OnReverseStreamEvent(const audioproc::ReverseStream& msg);
|
|
|
|
|
void OnConfigEvent(const audioproc::Config& msg);
|
2018-09-10 10:18:07 +02:00
|
|
|
void OnRuntimeSettingEvent(const audioproc::RuntimeSetting& msg);
|
2016-03-17 02:39:30 -07:00
|
|
|
|
|
|
|
|
void MaybeRecreateApm(const audioproc::Config& msg);
|
|
|
|
|
void ConfigureApm(const audioproc::Config& msg);
|
|
|
|
|
|
|
|
|
|
void LoadNextMessage();
|
|
|
|
|
|
|
|
|
|
// Buffer for APM input/output.
|
|
|
|
|
std::unique_ptr<ChannelBuffer<float>> input_;
|
|
|
|
|
std::unique_ptr<ChannelBuffer<float>> reverse_;
|
|
|
|
|
std::unique_ptr<ChannelBuffer<float>> output_;
|
|
|
|
|
|
2021-07-02 11:30:54 +02:00
|
|
|
rtc::scoped_refptr<AudioProcessing> apm_;
|
2016-03-17 02:39:30 -07:00
|
|
|
|
|
|
|
|
FILE* debug_file_;
|
|
|
|
|
|
|
|
|
|
StreamConfig input_config_;
|
|
|
|
|
StreamConfig reverse_config_;
|
|
|
|
|
StreamConfig output_config_;
|
|
|
|
|
|
|
|
|
|
bool has_next_event_;
|
|
|
|
|
audioproc::Event next_event_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_AUDIO_PROCESSING_TEST_DEBUG_DUMP_REPLAYER_H_
|