Chromium Code Reviews| Index: webrtc/api/statscollector.cc |
| diff --git a/webrtc/api/statscollector.cc b/webrtc/api/statscollector.cc |
| index d77953b3bed1d49bb75a3be6a35c5d10f91c382b..cd9e1899ebfc04ff3234dae9eff25c37ca8413a6 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,32 @@ void StatsCollector::ExtractVideoInfo( |
| } |
| } |
| +void StatsCollector::ExtractSenderInfo() { |
| + RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); |
| + |
| + for (const auto &sender : pc_->GetSenders()) { |
|
pthatcher1
2016/03/30 16:48:43
const auto& sender
nisse-webrtc
2016/03/31 06:31:22
Done.
|
| + const rtc::scoped_refptr<MediaStreamTrackInterface> track(sender->track()); |
| + if (!track || track->kind() != MediaStreamTrackInterface::kVideoKind) |
|
Taylor Brandstetter
2016/03/30 17:42:32
nit: {}s
nisse-webrtc
2016/03/31 06:31:22
Done.
|
| + continue; |
| + |
| + VideoTrackSourceInterface *source = |
|
pthatcher1
2016/03/30 16:48:43
VideoTrackSourceInterface* source
nisse-webrtc
2016/03/31 06:31:22
Done.
|
| + static_cast<VideoTrackInterface*>(track.get())->GetSource(); |
|
pthatcher1
2016/03/30 16:48:43
I agree with the decision that you and Tommi made
nisse-webrtc
2016/03/31 06:31:22
Done. We're not using dynamic_cast<>? This must be
|
| + |
| + VideoTrackSourceInterface::Stats stats; |
| + if (source->GetStats(&stats)) { |
|
pthatcher1
2016/03/30 16:48:43
I'd prefer:
if (!source->GetStats(&stats)) {
c
nisse-webrtc
2016/03/31 06:31:22
Done.
|
| + const StatsReport::Id stats_id = |
| + StatsReport::NewIdWithDirection(StatsReport::kStatsReportTypeSsrc, |
| + rtc::ToString<uint32_t>(sender->ssrc()), |
|
Taylor Brandstetter
2016/03/30 17:42:32
It's possible that a sender doesn't have an SSRC (
nisse-webrtc
2016/03/31 06:31:22
I added it as a separate "if"; no need to fiddle w
Taylor Brandstetter
2016/03/31 18:25:03
We should change it to an rtc::Optional in that ca
nisse-webrtc
2016/04/01 06:28:28
If possible, it would be even clearer if ssrc is a
Taylor Brandstetter
2016/04/01 18:28:40
Yes, it is reasonable. Through the API you can use
|
| + 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()); |