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

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: rebased 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 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 GetVariableSnapshot(frame_time_data_, frame_time_stats); 313 GetVariableSnapshot(frame_time_data_, frame_time_stats);
314 *last_captured_frame_format = last_captured_frame_format_; 314 *last_captured_frame_format = last_captured_frame_format_;
315 315
316 adapt_frame_drops_data_.Reset(); 316 adapt_frame_drops_data_.Reset();
317 frame_time_data_.Reset(); 317 frame_time_data_.Reset();
318 } 318 }
319 319
320 void VideoCapturer::RemoveSink( 320 void VideoCapturer::RemoveSink(
321 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { 321 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) {
322 broadcaster_.RemoveSink(sink); 322 broadcaster_.RemoveSink(sink);
323 OnSinkWantsChanged(broadcaster_.wants());
323 } 324 }
324 325
325 void VideoCapturer::AddOrUpdateSink( 326 void VideoCapturer::AddOrUpdateSink(
326 rtc::VideoSinkInterface<cricket::VideoFrame>* sink, 327 rtc::VideoSinkInterface<cricket::VideoFrame>* sink,
327 const rtc::VideoSinkWants& wants) { 328 const rtc::VideoSinkWants& wants) {
328 broadcaster_.AddOrUpdateSink(sink, wants); 329 broadcaster_.AddOrUpdateSink(sink, wants);
329 OnSinkWantsChanged(broadcaster_.wants()); 330 OnSinkWantsChanged(broadcaster_.wants());
330 } 331 }
331 332
332 void VideoCapturer::OnSinkWantsChanged(const rtc::VideoSinkWants& wants) { 333 void VideoCapturer::OnSinkWantsChanged(const rtc::VideoSinkWants& wants) {
333 apply_rotation_ = wants.rotation_applied; 334 apply_rotation_ = wants.rotation_applied;
334 if (frame_factory_) { 335 if (frame_factory_) {
335 frame_factory_->SetApplyRotation(apply_rotation_); 336 frame_factory_->SetApplyRotation(apply_rotation_);
336 } 337 }
338
339 // Do not adapt resolution for screen content as this will likely result in
340 // blurry and unreadable text.
341 if (!IsScreencast() && video_adapter()) {
342 video_adapter()->OnCpuResolutionRequest(
343 wants.max_pixel_count, wants.max_pixel_count_step_up);
344 }
337 } 345 }
338 346
339 void VideoCapturer::OnFrameCaptured(VideoCapturer*, 347 void VideoCapturer::OnFrameCaptured(VideoCapturer*,
340 const CapturedFrame* captured_frame) { 348 const CapturedFrame* captured_frame) {
341 if (muted_) { 349 if (muted_) {
342 if (black_frame_count_down_ == 0) { 350 if (black_frame_count_down_ == 0) {
343 thread_->Post(this, MSG_DO_PAUSE, NULL); 351 thread_->Post(this, MSG_DO_PAUSE, NULL);
344 } else { 352 } else {
345 --black_frame_count_down_; 353 --black_frame_count_down_;
346 } 354 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 void VideoCapturer::GetVariableSnapshot( 726 void VideoCapturer::GetVariableSnapshot(
719 const rtc::RollingAccumulator<T>& data, 727 const rtc::RollingAccumulator<T>& data,
720 VariableInfo<T>* stats) { 728 VariableInfo<T>* stats) {
721 stats->max_val = data.ComputeMax(); 729 stats->max_val = data.ComputeMax();
722 stats->mean = data.ComputeMean(); 730 stats->mean = data.ComputeMean();
723 stats->min_val = data.ComputeMin(); 731 stats->min_val = data.ComputeMin();
724 stats->variance = data.ComputeVariance(); 732 stats->variance = data.ComputeVariance();
725 } 733 }
726 734
727 } // namespace cricket 735 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698