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

Side by Side Diff: webrtc/media/base/videocapturer.cc

Issue 1695263002: Move direct use of VideoCapturer::VideoAdapter to VideoSinkWants. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 const rtc::VideoSinkWants& wants) { 327 const rtc::VideoSinkWants& wants) {
328 broadcaster_.AddOrUpdateSink(sink, wants); 328 broadcaster_.AddOrUpdateSink(sink, wants);
329 OnSinkWantsChanged(broadcaster_.wants()); 329 OnSinkWantsChanged(broadcaster_.wants());
330 } 330 }
331 331
332 void VideoCapturer::OnSinkWantsChanged(const rtc::VideoSinkWants& wants) { 332 void VideoCapturer::OnSinkWantsChanged(const rtc::VideoSinkWants& wants) {
333 apply_rotation_ = wants.rotation_applied; 333 apply_rotation_ = wants.rotation_applied;
334 if (frame_factory_) { 334 if (frame_factory_) {
335 frame_factory_->SetApplyRotation(apply_rotation_); 335 frame_factory_->SetApplyRotation(apply_rotation_);
336 } 336 }
337
338 // Do not adapt resolution for screen content as this will likely result in
339 // blurry and unreadable text.
340 if (wants.resolution != rtc::VideoSinkWants::Resolution::KEEP &&
341 !IsScreencast() && video_adapter()) {
342 video_adapter()->OnCpuResolutionRequest(
343 wants.resolution == rtc::VideoSinkWants::Resolution::DOWN ?
344 CoordinatedVideoAdapter::DOWNGRADE : CoordinatedVideoAdapter::UPGRADE);
345 }
337 } 346 }
338 347
339 void VideoCapturer::OnFrameCaptured(VideoCapturer*, 348 void VideoCapturer::OnFrameCaptured(VideoCapturer*,
340 const CapturedFrame* captured_frame) { 349 const CapturedFrame* captured_frame) {
341 if (muted_) { 350 if (muted_) {
342 if (black_frame_count_down_ == 0) { 351 if (black_frame_count_down_ == 0) {
343 thread_->Post(this, MSG_DO_PAUSE, NULL); 352 thread_->Post(this, MSG_DO_PAUSE, NULL);
344 } else { 353 } else {
345 --black_frame_count_down_; 354 --black_frame_count_down_;
346 } 355 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 void VideoCapturer::GetVariableSnapshot( 727 void VideoCapturer::GetVariableSnapshot(
719 const rtc::RollingAccumulator<T>& data, 728 const rtc::RollingAccumulator<T>& data,
720 VariableInfo<T>* stats) { 729 VariableInfo<T>* stats) {
721 stats->max_val = data.ComputeMax(); 730 stats->max_val = data.ComputeMax();
722 stats->mean = data.ComputeMean(); 731 stats->mean = data.ComputeMean();
723 stats->min_val = data.ComputeMin(); 732 stats->min_val = data.ComputeMin();
724 stats->variance = data.ComputeVariance(); 733 stats->variance = data.ComputeVariance();
725 } 734 }
726 735
727 } // namespace cricket 736 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698