Add RTCAudioPlayoutStats to GetStats().
This is done by allowing implementations of AudioDeviceModule to
implement the GetStats() method. The default implementation returns
nullopt, in which case RTCAudioPlayoutStats will not be visible in the
stats.
Bug: webrtc:14653
Change-Id: I8e4aa6f1b8fcfa47a30f633d28a4013191752e20
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290563
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Fredrik Hernqvist <fhernqvist@google.com>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Olga Sharonova <olka@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39115}
diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc
index 622870c..5633be3 100644
--- a/pc/peer_connection.cc
+++ b/pc/peer_connection.cc
@@ -22,6 +22,7 @@
#include "absl/algorithm/container.h"
#include "absl/strings/match.h"
#include "absl/strings/string_view.h"
+#include "absl/types/optional.h"
#include "api/jsep_ice_candidate.h"
#include "api/rtp_parameters.h"
#include "api/rtp_transceiver_direction.h"
@@ -2500,6 +2501,13 @@
}
}
+absl::optional<AudioDeviceModule::Stats> PeerConnection::GetAudioDeviceStats() {
+ if (context_->media_engine()) {
+ return context_->media_engine()->voice().GetAudioDeviceStats();
+ }
+ return absl::nullopt;
+}
+
bool PeerConnection::SetupDataChannelTransport_n(const std::string& mid) {
DataChannelTransportInterface* transport =
transport_controller_->GetDataChannelTransport(mid);