tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

neteq_simulator_factory.h (2678B)


      1 /*
      2 *  Copyright (c) 2018 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 API_TEST_NETEQ_SIMULATOR_FACTORY_H_
     12 #define API_TEST_NETEQ_SIMULATOR_FACTORY_H_
     13 
     14 #include <cstdint>
     15 #include <memory>
     16 #include <optional>
     17 #include <string>
     18 
     19 #include "absl/strings/string_view.h"
     20 #include "api/neteq/neteq_factory.h"
     21 #include "api/test/neteq_simulator.h"
     22 
     23 namespace webrtc {
     24 namespace test {
     25 
     26 class NetEqTestFactory;
     27 
     28 class NetEqSimulatorFactory {
     29 public:
     30  NetEqSimulatorFactory();
     31  ~NetEqSimulatorFactory();
     32  struct Config {
     33    // The maximum allowed number of packets in the jitter buffer.
     34    int max_nr_packets_in_buffer = 0;
     35    // The number of audio packets to insert at the start of the simulation.
     36    // Since the simulation is done with a replacement audio file, these
     37    // artificial packets will take a small piece of that replacement audio.
     38    int initial_dummy_packets = 0;
     39    // The number of simulation steps to skip at the start of the simulation.
     40    // This removes incoming packets and GetAudio events from the start of the
     41    // simulation, until the requested number of GetAudio events has been
     42    // removed.
     43    int skip_get_audio_events = 0;
     44    // A WebRTC field trial string to be used during the simulation.
     45    std::string field_trial_string;
     46    // A filename for the generated output audio file.
     47    std::optional<std::string> output_audio_filename;
     48    // A filename for the python plot.
     49    std::optional<std::string> python_plot_filename;
     50    // A filename for the text log.
     51    std::optional<std::string> text_log_filename;
     52    // A custom NetEqFactory can be used.
     53    NetEqFactory* neteq_factory = nullptr;
     54    // The SSRC to use for the simulation.
     55    std::optional<uint32_t> ssrc_filter;
     56  };
     57  std::unique_ptr<NetEqSimulator> CreateSimulatorFromFile(
     58      absl::string_view event_log_filename,
     59      absl::string_view replacement_audio_filename,
     60      Config simulation_config);
     61  // The same as above, but pass the file contents as a string.
     62  std::unique_ptr<NetEqSimulator> CreateSimulatorFromString(
     63      absl::string_view event_log_file_contents,
     64      absl::string_view replacement_audio_file,
     65      Config simulation_config);
     66 
     67 private:
     68  std::unique_ptr<NetEqTestFactory> factory_;
     69 };
     70 
     71 }  // namespace test
     72 }  // namespace webrtc
     73 
     74 #endif  // API_TEST_NETEQ_SIMULATOR_FACTORY_H_