OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adapto
r_impl.h" | 11 #include "webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adapto
r_impl.h" |
12 | 12 |
13 #include <utility> | 13 #include <utility> |
14 | 14 |
15 #include "webrtc/base/logging.h" | 15 #include "webrtc/base/logging.h" |
| 16 #include "webrtc/base/timeutils.h" |
16 | 17 |
17 namespace webrtc { | 18 namespace webrtc { |
18 | 19 |
19 namespace { | 20 namespace { |
20 constexpr int kEventLogMinBitrateChangeBps = 5000; | 21 constexpr int kEventLogMinBitrateChangeBps = 5000; |
21 constexpr float kEventLogMinBitrateChangeFraction = 0.25; | 22 constexpr float kEventLogMinBitrateChangeFraction = 0.25; |
22 constexpr float kEventLogMinPacketLossChangeFraction = 0.5; | 23 constexpr float kEventLogMinPacketLossChangeFraction = 0.5; |
23 } // namespace | 24 } // namespace |
24 | 25 |
25 AudioNetworkAdaptorImpl::Config::Config() | 26 AudioNetworkAdaptorImpl::Config::Config() : event_log(nullptr){}; |
26 : event_log(nullptr), clock(nullptr){}; | |
27 | 27 |
28 AudioNetworkAdaptorImpl::Config::~Config() = default; | 28 AudioNetworkAdaptorImpl::Config::~Config() = default; |
29 | 29 |
30 AudioNetworkAdaptorImpl::AudioNetworkAdaptorImpl( | 30 AudioNetworkAdaptorImpl::AudioNetworkAdaptorImpl( |
31 const Config& config, | 31 const Config& config, |
32 std::unique_ptr<ControllerManager> controller_manager, | 32 std::unique_ptr<ControllerManager> controller_manager, |
33 std::unique_ptr<DebugDumpWriter> debug_dump_writer) | 33 std::unique_ptr<DebugDumpWriter> debug_dump_writer) |
34 : config_(config), | 34 : config_(config), |
35 controller_manager_(std::move(controller_manager)), | 35 controller_manager_(std::move(controller_manager)), |
36 debug_dump_writer_(std::move(debug_dump_writer)), | 36 debug_dump_writer_(std::move(debug_dump_writer)), |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 UpdateNetworkMetrics(network_metrics); | 112 UpdateNetworkMetrics(network_metrics); |
113 } | 113 } |
114 | 114 |
115 AudioEncoderRuntimeConfig AudioNetworkAdaptorImpl::GetEncoderRuntimeConfig() { | 115 AudioEncoderRuntimeConfig AudioNetworkAdaptorImpl::GetEncoderRuntimeConfig() { |
116 AudioEncoderRuntimeConfig config; | 116 AudioEncoderRuntimeConfig config; |
117 for (auto& controller : | 117 for (auto& controller : |
118 controller_manager_->GetSortedControllers(last_metrics_)) | 118 controller_manager_->GetSortedControllers(last_metrics_)) |
119 controller->MakeDecision(&config); | 119 controller->MakeDecision(&config); |
120 | 120 |
121 if (debug_dump_writer_) | 121 if (debug_dump_writer_) |
122 debug_dump_writer_->DumpEncoderRuntimeConfig( | 122 debug_dump_writer_->DumpEncoderRuntimeConfig(config, rtc::TimeMillis()); |
123 config, config_.clock->TimeInMilliseconds()); | |
124 | 123 |
125 if (event_log_writer_) | 124 if (event_log_writer_) |
126 event_log_writer_->MaybeLogEncoderConfig(config); | 125 event_log_writer_->MaybeLogEncoderConfig(config); |
127 | 126 |
128 return config; | 127 return config; |
129 } | 128 } |
130 | 129 |
131 void AudioNetworkAdaptorImpl::StartDebugDump(FILE* file_handle) { | 130 void AudioNetworkAdaptorImpl::StartDebugDump(FILE* file_handle) { |
132 debug_dump_writer_ = DebugDumpWriter::Create(file_handle); | 131 debug_dump_writer_ = DebugDumpWriter::Create(file_handle); |
133 } | 132 } |
134 | 133 |
135 void AudioNetworkAdaptorImpl::StopDebugDump() { | 134 void AudioNetworkAdaptorImpl::StopDebugDump() { |
136 debug_dump_writer_.reset(nullptr); | 135 debug_dump_writer_.reset(nullptr); |
137 } | 136 } |
138 | 137 |
139 void AudioNetworkAdaptorImpl::DumpNetworkMetrics() { | 138 void AudioNetworkAdaptorImpl::DumpNetworkMetrics() { |
140 if (debug_dump_writer_) | 139 if (debug_dump_writer_) |
141 debug_dump_writer_->DumpNetworkMetrics(last_metrics_, | 140 debug_dump_writer_->DumpNetworkMetrics(last_metrics_, rtc::TimeMillis()); |
142 config_.clock->TimeInMilliseconds()); | |
143 } | 141 } |
144 | 142 |
145 void AudioNetworkAdaptorImpl::UpdateNetworkMetrics( | 143 void AudioNetworkAdaptorImpl::UpdateNetworkMetrics( |
146 const Controller::NetworkMetrics& network_metrics) { | 144 const Controller::NetworkMetrics& network_metrics) { |
147 for (auto& controller : controller_manager_->GetControllers()) | 145 for (auto& controller : controller_manager_->GetControllers()) |
148 controller->UpdateNetworkMetrics(network_metrics); | 146 controller->UpdateNetworkMetrics(network_metrics); |
149 } | 147 } |
150 | 148 |
151 } // namespace webrtc | 149 } // namespace webrtc |
OLD | NEW |