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

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

Issue 2764133002: Revert of Add framerate to VideoSinkWants and ability to signal on overuse (Closed)
Patch Set: Created 3 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/media/base/videoadapter.h ('k') | webrtc/media/base/videoadapter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/base/videoadapter.cc
diff --git a/webrtc/media/base/videoadapter.cc b/webrtc/media/base/videoadapter.cc
index bee2a5730161e4e926006f8a8b89aa1e1ce90518..522d175426bad752dc94134183c2c2de9af0c84b 100644
--- a/webrtc/media/base/videoadapter.cc
+++ b/webrtc/media/base/videoadapter.cc
@@ -106,8 +106,7 @@
previous_height_(0),
required_resolution_alignment_(required_resolution_alignment),
resolution_request_target_pixel_count_(std::numeric_limits<int>::max()),
- resolution_request_max_pixel_count_(std::numeric_limits<int>::max()),
- max_framerate_request_(std::numeric_limits<int>::max()) {}
+ resolution_request_max_pixel_count_(std::numeric_limits<int>::max()) {}
VideoAdapter::VideoAdapter() : VideoAdapter(1) {}
@@ -115,34 +114,21 @@
bool VideoAdapter::KeepFrame(int64_t in_timestamp_ns) {
rtc::CritScope cs(&critical_section_);
- if (max_framerate_request_ <= 0)
- return false;
-
- int64_t frame_interval_ns =
- requested_format_ ? requested_format_->interval : 0;
-
- // If |max_framerate_request_| is not set, it will default to maxint, which
- // will lead to a frame_interval_ns rounded to 0.
- frame_interval_ns = std::max<int64_t>(
- frame_interval_ns, rtc::kNumNanosecsPerSec / max_framerate_request_);
-
- if (frame_interval_ns <= 0) {
- // Frame rate throttling not enabled.
+ if (!requested_format_ || requested_format_->interval == 0)
return true;
- }
if (next_frame_timestamp_ns_) {
// Time until next frame should be outputted.
const int64_t time_until_next_frame_ns =
(*next_frame_timestamp_ns_ - in_timestamp_ns);
- // Continue if timestamp is within expected range.
- if (std::abs(time_until_next_frame_ns) < 2 * frame_interval_ns) {
+ // Continue if timestamp is withing expected range.
+ if (std::abs(time_until_next_frame_ns) < 2 * requested_format_->interval) {
// Drop if a frame shouldn't be outputted yet.
if (time_until_next_frame_ns > 0)
return false;
// Time to output new frame.
- *next_frame_timestamp_ns_ += frame_interval_ns;
+ *next_frame_timestamp_ns_ += requested_format_->interval;
return true;
}
}
@@ -151,7 +137,7 @@
// reset. Set first timestamp target to just half the interval to prefer
// keeping frames in case of jitter.
next_frame_timestamp_ns_ =
- rtc::Optional<int64_t>(in_timestamp_ns + frame_interval_ns / 2);
+ rtc::Optional<int64_t>(in_timestamp_ns + requested_format_->interval / 2);
return true;
}
@@ -263,15 +249,14 @@
next_frame_timestamp_ns_ = rtc::Optional<int64_t>();
}
-void VideoAdapter::OnResolutionFramerateRequest(
+void VideoAdapter::OnResolutionRequest(
const rtc::Optional<int>& target_pixel_count,
- int max_pixel_count,
- int max_framerate_fps) {
- rtc::CritScope cs(&critical_section_);
- resolution_request_max_pixel_count_ = max_pixel_count;
+ const rtc::Optional<int>& max_pixel_count) {
+ rtc::CritScope cs(&critical_section_);
+ resolution_request_max_pixel_count_ =
+ max_pixel_count.value_or(std::numeric_limits<int>::max());
resolution_request_target_pixel_count_ =
target_pixel_count.value_or(resolution_request_max_pixel_count_);
- max_framerate_request_ = max_framerate_fps;
}
} // namespace cricket
« no previous file with comments | « webrtc/media/base/videoadapter.h ('k') | webrtc/media/base/videoadapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698