Line data Source code
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_AUDIO_NETWORK_ADAPTOR_AUDIO_NETWORK_ADAPTOR_IMPL_H_
12 : #define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_AUDIO_NETWORK_ADAPTOR_IMPL_H_
13 :
14 : #include <memory>
15 :
16 : #include "webrtc/base/constructormagic.h"
17 : #include "webrtc/modules/audio_coding/audio_network_adaptor/controller.h"
18 : #include "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h"
19 : #include "webrtc/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h"
20 : #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
21 : #include "webrtc/system_wrappers/include/clock.h"
22 :
23 : namespace webrtc {
24 :
25 : class RtcEventLog;
26 :
27 0 : class AudioNetworkAdaptorImpl final : public AudioNetworkAdaptor {
28 : public:
29 0 : struct Config {
30 : Config();
31 : ~Config();
32 : RtcEventLog* event_log;
33 : const Clock* clock;
34 : };
35 :
36 : AudioNetworkAdaptorImpl(
37 : const Config& config,
38 : std::unique_ptr<ControllerManager> controller_manager,
39 : std::unique_ptr<DebugDumpWriter> debug_dump_writer = nullptr);
40 :
41 : ~AudioNetworkAdaptorImpl() override;
42 :
43 : void SetUplinkBandwidth(int uplink_bandwidth_bps) override;
44 :
45 : void SetUplinkPacketLossFraction(float uplink_packet_loss_fraction) override;
46 :
47 : void SetRtt(int rtt_ms) override;
48 :
49 : void SetTargetAudioBitrate(int target_audio_bitrate_bps) override;
50 :
51 : void SetOverhead(size_t overhead_bytes_per_packet) override;
52 :
53 : EncoderRuntimeConfig GetEncoderRuntimeConfig() override;
54 :
55 : void StartDebugDump(FILE* file_handle) override;
56 :
57 : void StopDebugDump() override;
58 :
59 : private:
60 : void DumpNetworkMetrics();
61 :
62 : const Config config_;
63 :
64 : std::unique_ptr<ControllerManager> controller_manager_;
65 :
66 : std::unique_ptr<DebugDumpWriter> debug_dump_writer_;
67 :
68 : Controller::NetworkMetrics last_metrics_;
69 :
70 : RTC_DISALLOW_COPY_AND_ASSIGN(AudioNetworkAdaptorImpl);
71 : };
72 :
73 : } // namespace webrtc
74 :
75 : #endif // WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_AUDIO_NETWORK_ADAPTOR_IMPL_H_
|