Index: webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.cc |
diff --git a/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.cc b/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.cc |
index 3b767d9b597b01d4670b6101350a22b91c055928..6ec92b00fc1781cc82f36399a50297992bcd5f2f 100644 |
--- a/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.cc |
+++ b/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.cc |
@@ -12,8 +12,16 @@ |
#include <utility> |
+#include "webrtc/base/logging.h" |
+ |
namespace webrtc { |
+namespace { |
+constexpr int kEventLogMinBitrateChangeBps = 5000; |
+constexpr float kEventLogMinBitrateChangeFraction = 0.25; |
+constexpr float kEventLogMinPacketLossChangeFraction = 0.5; |
+} // namespace |
+ |
AudioNetworkAdaptorImpl::Config::Config() |
: event_log(nullptr), clock(nullptr){}; |
@@ -25,7 +33,14 @@ AudioNetworkAdaptorImpl::AudioNetworkAdaptorImpl( |
std::unique_ptr<DebugDumpWriter> debug_dump_writer) |
: config_(config), |
controller_manager_(std::move(controller_manager)), |
- debug_dump_writer_(std::move(debug_dump_writer)) { |
+ debug_dump_writer_(std::move(debug_dump_writer)), |
+ event_log_writer_( |
+ config.event_log |
+ ? new EventLogWriter(config.event_log, |
+ kEventLogMinBitrateChangeBps, |
+ kEventLogMinBitrateChangeFraction, |
+ kEventLogMinPacketLossChangeFraction) |
+ : nullptr) { |
RTC_DCHECK(controller_manager_); |
} |
@@ -68,11 +83,13 @@ AudioNetworkAdaptorImpl::GetEncoderRuntimeConfig() { |
controller_manager_->GetSortedControllers(last_metrics_)) |
controller->MakeDecision(last_metrics_, &config); |
- // TODO(minyue): Add debug dumping. |
if (debug_dump_writer_) |
debug_dump_writer_->DumpEncoderRuntimeConfig( |
config, config_.clock->TimeInMilliseconds()); |
+ if (event_log_writer_) |
+ event_log_writer_->MaybeLogEncoderConfig(config); |
+ |
return config; |
} |