2018-09-03 11:49:27 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef API_TEST_NETEQ_SIMULATOR_FACTORY_H_
|
|
|
|
|
#define API_TEST_NETEQ_SIMULATOR_FACTORY_H_
|
|
|
|
|
|
2024-04-02 11:58:19 +02:00
|
|
|
#include <cstdint>
|
2018-09-03 11:49:27 +02:00
|
|
|
#include <memory>
|
2024-08-29 13:00:40 +00:00
|
|
|
#include <optional>
|
2019-03-20 10:52:18 +01:00
|
|
|
#include <string>
|
2018-09-03 11:49:27 +02:00
|
|
|
|
2019-03-20 10:52:18 +01:00
|
|
|
#include "absl/strings/string_view.h"
|
2020-01-16 17:17:09 +01:00
|
|
|
#include "api/neteq/neteq_factory.h"
|
2018-09-03 11:49:27 +02:00
|
|
|
#include "api/test/neteq_simulator.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
class NetEqTestFactory;
|
|
|
|
|
|
|
|
|
|
class NetEqSimulatorFactory {
|
|
|
|
|
public:
|
|
|
|
|
NetEqSimulatorFactory();
|
|
|
|
|
~NetEqSimulatorFactory();
|
2019-03-20 10:52:18 +01:00
|
|
|
struct Config {
|
2019-10-07 13:18:18 +02:00
|
|
|
// The maximum allowed number of packets in the jitter buffer.
|
2019-03-20 10:52:18 +01:00
|
|
|
int max_nr_packets_in_buffer = 0;
|
2019-10-07 13:18:18 +02:00
|
|
|
// The number of audio packets to insert at the start of the simulation.
|
|
|
|
|
// Since the simulation is done with a replacement audio file, these
|
|
|
|
|
// artificial packets will take a small piece of that replacement audio.
|
|
|
|
|
int initial_dummy_packets = 0;
|
|
|
|
|
// The number of simulation steps to skip at the start of the simulation.
|
|
|
|
|
// This removes incoming packets and GetAudio events from the start of the
|
|
|
|
|
// simulation, until the requested number of GetAudio events has been
|
|
|
|
|
// removed.
|
|
|
|
|
int skip_get_audio_events = 0;
|
|
|
|
|
// A WebRTC field trial string to be used during the simulation.
|
|
|
|
|
std::string field_trial_string;
|
2020-03-24 15:59:26 +01:00
|
|
|
// A filename for the generated output audio file.
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<std::string> output_audio_filename;
|
2020-10-13 15:17:32 +02:00
|
|
|
// A filename for the python plot.
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<std::string> python_plot_filename;
|
2020-10-13 15:17:32 +02:00
|
|
|
// A filename for the text log.
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<std::string> text_log_filename;
|
2020-01-16 17:17:09 +01:00
|
|
|
// A custom NetEqFactory can be used.
|
|
|
|
|
NetEqFactory* neteq_factory = nullptr;
|
2024-04-02 11:58:19 +02:00
|
|
|
// The SSRC to use for the simulation.
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<uint32_t> ssrc_filter;
|
2019-03-20 10:52:18 +01:00
|
|
|
};
|
|
|
|
|
std::unique_ptr<NetEqSimulator> CreateSimulatorFromFile(
|
|
|
|
|
absl::string_view event_log_filename,
|
|
|
|
|
absl::string_view replacement_audio_filename,
|
|
|
|
|
Config simulation_config);
|
|
|
|
|
// The same as above, but pass the file contents as a string.
|
|
|
|
|
std::unique_ptr<NetEqSimulator> CreateSimulatorFromString(
|
|
|
|
|
absl::string_view event_log_file_contents,
|
|
|
|
|
absl::string_view replacement_audio_file,
|
|
|
|
|
Config simulation_config);
|
2018-09-03 11:49:27 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::unique_ptr<NetEqTestFactory> factory_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
#endif // API_TEST_NETEQ_SIMULATOR_FACTORY_H_
|