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

Unified Diff: webrtc/media/base/videocapturer.cc

Issue 1827023002: Get VideoCapturer stats via VideoTrackSourceInterface in StatsCollector, (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added TODO comments regarding SSRC == 0. 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
Index: webrtc/media/base/videocapturer.cc
diff --git a/webrtc/media/base/videocapturer.cc b/webrtc/media/base/videocapturer.cc
index 6b182b35332db9b1f9141ad0e805ad47a8fb0518..57dc79f7b1148c6366cc43122a875522972d1ca0 100644
--- a/webrtc/media/base/videocapturer.cc
+++ b/webrtc/media/base/videocapturer.cc
@@ -179,9 +179,15 @@ void VideoCapturer::set_frame_factory(VideoFrameFactory* frame_factory) {
}
}
-void VideoCapturer::GetStats(VideoFormat* last_captured_frame_format) {
+bool VideoCapturer::GetInputSize(int* width, int* height) {
rtc::CritScope cs(&frame_stats_crit_);
- *last_captured_frame_format = last_captured_frame_format_;
+ if (!input_size_valid_) {
+ return false;
+ }
+ *width = input_width_;
+ *height = input_height_;
+
+ return true;
}
void VideoCapturer::RemoveSink(
@@ -391,7 +397,7 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
}
OnFrame(this, adapted_frame.get());
- UpdateStats(captured_frame);
+ UpdateInputSize(captured_frame);
}
void VideoCapturer::OnFrame(VideoCapturer* capturer, const VideoFrame* frame) {
@@ -536,15 +542,13 @@ bool VideoCapturer::ShouldFilterFormat(const VideoFormat& format) const {
format.height > max_format_->height;
}
-void VideoCapturer::UpdateStats(const CapturedFrame* captured_frame) {
+void VideoCapturer::UpdateInputSize(const CapturedFrame* captured_frame) {
// Update stats protected from fetches from different thread.
rtc::CritScope cs(&frame_stats_crit_);
- last_captured_frame_format_.width = captured_frame->width;
- last_captured_frame_format_.height = captured_frame->height;
- // TODO(ronghuawu): Useful to report interval as well?
- last_captured_frame_format_.interval = 0;
- last_captured_frame_format_.fourcc = captured_frame->fourcc;
+ input_size_valid_ = true;
+ input_width_ = captured_frame->width;
+ input_height_ = captured_frame->height;
}
} // namespace cricket

Powered by Google App Engine
This is Rietveld 408576698