Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.cc

Issue 2356763002: Adding debug dump to audio network adaptor. (Closed)
Patch Set: some fixing Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 0303c84920a56b3c2322800139ede1b110b029b3..3d8b2beb8d25217a1e86c2783616c58a4c565f70 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
@@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include <utility>
-
#include "webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.h"
+#include <utility>
+
namespace webrtc {
AudioNetworkAdaptorImpl::Config::Config() = default;
@@ -21,7 +21,15 @@ AudioNetworkAdaptorImpl::Config::~Config() = default;
AudioNetworkAdaptorImpl::AudioNetworkAdaptorImpl(
const Config& config,
std::unique_ptr<ControllerManager> controller_manager)
- : config_(config), controller_manager_(std::move(controller_manager)) {
+ : AudioNetworkAdaptorImpl(config, std::move(controller_manager), nullptr) {}
+
+AudioNetworkAdaptorImpl::AudioNetworkAdaptorImpl(
+ const Config& config,
+ std::unique_ptr<ControllerManager> controller_manager,
+ std::unique_ptr<DebugDumpWriter> debug_dump_writer)
+ : config_(config),
+ controller_manager_(std::move(controller_manager)),
+ debug_dump_writer_(std::move(debug_dump_writer)) {
RTC_DCHECK(controller_manager_);
}
@@ -29,16 +37,19 @@ AudioNetworkAdaptorImpl::~AudioNetworkAdaptorImpl() = default;
void AudioNetworkAdaptorImpl::SetUplinkBandwidth(int uplink_bandwidth_bps) {
last_metrics_.uplink_bandwidth_bps = rtc::Optional<int>(uplink_bandwidth_bps);
-
- // TODO(minyue): Add debug dumping.
+ DumpNetworkMetrics();
}
void AudioNetworkAdaptorImpl::SetUplinkPacketLossFraction(
float uplink_packet_loss_fraction) {
last_metrics_.uplink_packet_loss_fraction =
rtc::Optional<float>(uplink_packet_loss_fraction);
+ DumpNetworkMetrics();
+}
- // TODO(minyue): Add debug dumping.
+void AudioNetworkAdaptorImpl::SetRtt(int rtt_ms) {
+ last_metrics_.rtt_ms = rtc::Optional<int>(rtt_ms);
+ DumpNetworkMetrics();
}
AudioNetworkAdaptor::EncoderRuntimeConfig
@@ -49,6 +60,9 @@ AudioNetworkAdaptorImpl::GetEncoderRuntimeConfig() {
controller->MakeDecision(last_metrics_, &config);
// TODO(minyue): Add debug dumping.
+ if (debug_dump_writer_)
+ debug_dump_writer_->DumpEncoderRuntimeConfig(
+ config, config_.clock->TimeInMilliseconds());
return config;
}
@@ -67,7 +81,17 @@ void AudioNetworkAdaptorImpl::SetReceiverFrameLengthRange(
}
void AudioNetworkAdaptorImpl::StartDebugDump(FILE* file_handle) {
- // TODO(minyue): Implement this method.
+ debug_dump_writer_ = DebugDumpWriter::Create(file_handle);
+}
+
+void AudioNetworkAdaptorImpl::StopDebugDump() {
+ debug_dump_writer_.reset(nullptr);
+}
+
+void AudioNetworkAdaptorImpl::DumpNetworkMetrics() {
+ if (debug_dump_writer_)
+ debug_dump_writer_->DumpNetworkMetrics(last_metrics_,
+ config_.clock->TimeInMilliseconds());
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698