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

Unified Diff: webrtc/api/statscollector.cc

Issue 1827023002: Get VideoCapturer stats via VideoTrackSourceInterface in StatsCollector, (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 9 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
« no previous file with comments | « webrtc/api/statscollector.h ('k') | webrtc/api/videocapturertracksource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/statscollector.cc
diff --git a/webrtc/api/statscollector.cc b/webrtc/api/statscollector.cc
index d77953b3bed1d49bb75a3be6a35c5d10f91c382b..4a3bae026b61a0d791b184e50365640c3c271f1c 100644
--- a/webrtc/api/statscollector.cc
+++ b/webrtc/api/statscollector.cc
@@ -236,11 +236,9 @@ void ExtractStats(const cricket::VideoSenderInfo& info, StatsReport* report) {
{ StatsReport::kStatsValueNameEncodeUsagePercent,
info.encode_usage_percent },
{ StatsReport::kStatsValueNameFirsReceived, info.firs_rcvd },
- { StatsReport::kStatsValueNameFrameHeightInput, info.input_frame_height },
{ StatsReport::kStatsValueNameFrameHeightSent, info.send_frame_height },
{ StatsReport::kStatsValueNameFrameRateInput, info.framerate_input },
{ StatsReport::kStatsValueNameFrameRateSent, info.framerate_sent },
- { StatsReport::kStatsValueNameFrameWidthInput, info.input_frame_width },
{ StatsReport::kStatsValueNameFrameWidthSent, info.send_frame_width },
{ StatsReport::kStatsValueNameNacksReceived, info.nacks_rcvd },
{ StatsReport::kStatsValueNamePacketsLost, info.packets_lost },
@@ -474,6 +472,7 @@ StatsCollector::UpdateStats(PeerConnectionInterface::StatsOutputLevel level) {
ExtractSessionInfo();
ExtractVoiceInfo();
ExtractVideoInfo(level);
+ ExtractSenderInfo();
ExtractDataInfo();
UpdateTrackReports();
}
@@ -828,6 +827,37 @@ void StatsCollector::ExtractVideoInfo(
}
}
+void StatsCollector::ExtractSenderInfo() {
+ RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent());
+
+ for (const auto& sender : pc_->GetSenders()) {
+ if (!sender->ssrc()) {
pbos-webrtc 2016/03/31 14:35:22 Since ssrc == 0 is technically valid, make a TODO
+ continue;
+ }
+ const rtc::scoped_refptr<MediaStreamTrackInterface> track(sender->track());
+ if (!track || track->kind() != MediaStreamTrackInterface::kVideoKind) {
+ continue;
+ }
+ // Safe, because kind() == kVideoKind implies a subclass of
+ // VideoTrackInterface; see mediastreaminterface.h.
+ VideoTrackSourceInterface* source =
+ static_cast<VideoTrackInterface*>(track.get())->GetSource();
+
+ VideoTrackSourceInterface::Stats stats;
+ if (!source->GetStats(&stats)) {
+ continue;
+ }
+ const StatsReport::Id stats_id = StatsReport::NewIdWithDirection(
+ StatsReport::kStatsReportTypeSsrc,
+ rtc::ToString<uint32_t>(sender->ssrc()), StatsReport::kSend);
+ StatsReport* report = reports_.FindOrAddNew(stats_id);
+ report->AddInt(StatsReport::kStatsValueNameFrameWidthInput,
+ stats.input_width);
+ report->AddInt(StatsReport::kStatsValueNameFrameHeightInput,
+ stats.input_height);
+ }
+}
+
void StatsCollector::ExtractDataInfo() {
RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent());
« no previous file with comments | « webrtc/api/statscollector.h ('k') | webrtc/api/videocapturertracksource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698