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

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

Issue 2672793002: Change rtc::VideoSinkWants to have target and a max pixel count (Closed)
Patch Set: Addressed comment Created 3 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // wants.rotation_applied == ANY(sink.wants.rotation_applied) 82 // wants.rotation_applied == ANY(sink.wants.rotation_applied)
83 if (sink.wants.rotation_applied) { 83 if (sink.wants.rotation_applied) {
84 wants.rotation_applied = true; 84 wants.rotation_applied = true;
85 } 85 }
86 // wants.max_pixel_count == MIN(sink.wants.max_pixel_count) 86 // wants.max_pixel_count == MIN(sink.wants.max_pixel_count)
87 if (sink.wants.max_pixel_count && 87 if (sink.wants.max_pixel_count &&
88 (!wants.max_pixel_count || 88 (!wants.max_pixel_count ||
89 (*sink.wants.max_pixel_count < *wants.max_pixel_count))) { 89 (*sink.wants.max_pixel_count < *wants.max_pixel_count))) {
90 wants.max_pixel_count = sink.wants.max_pixel_count; 90 wants.max_pixel_count = sink.wants.max_pixel_count;
91 } 91 }
92 // wants.max_pixel_count_step_up == MIN(sink.wants.max_pixel_count_step_up) 92 // Select the minimum requested target_pixel_count, if any, of all sinks so
nisse-webrtc 2017/02/06 08:43:19 Sinks could use max_pixel_count to express a limit
sprang_webrtc 2017/02/06 10:34:02 I wasn't aware of the full context of this behavio
93 if (sink.wants.max_pixel_count_step_up && 93 // that we don't over utilize the resources for any one.
94 (!wants.max_pixel_count_step_up || 94 if (sink.wants.target_pixel_count &&
95 (*sink.wants.max_pixel_count_step_up < 95 (!wants.target_pixel_count ||
96 *wants.max_pixel_count_step_up))) { 96 (*sink.wants.target_pixel_count < *wants.target_pixel_count))) {
97 wants.max_pixel_count_step_up = sink.wants.max_pixel_count_step_up; 97 wants.target_pixel_count = sink.wants.target_pixel_count;
98 } 98 }
99 } 99 }
100 100
101 if (wants.max_pixel_count && wants.max_pixel_count_step_up && 101 if (wants.max_pixel_count && wants.target_pixel_count &&
102 *wants.max_pixel_count_step_up >= *wants.max_pixel_count) { 102 *wants.target_pixel_count >= *wants.max_pixel_count) {
103 wants.max_pixel_count_step_up = Optional<int>(); 103 wants.target_pixel_count = wants.max_pixel_count;
104 } 104 }
105 current_wants_ = wants; 105 current_wants_ = wants;
106 } 106 }
107 107
108 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& 108 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>&
109 VideoBroadcaster::GetBlackFrameBuffer(int width, int height) { 109 VideoBroadcaster::GetBlackFrameBuffer(int width, int height) {
110 if (!black_frame_buffer_ || black_frame_buffer_->width() != width || 110 if (!black_frame_buffer_ || black_frame_buffer_->width() != width ||
111 black_frame_buffer_->height() != height) { 111 black_frame_buffer_->height() != height) {
112 rtc::scoped_refptr<webrtc::I420Buffer> buffer = 112 rtc::scoped_refptr<webrtc::I420Buffer> buffer =
113 webrtc::I420Buffer::Create(width, height); 113 webrtc::I420Buffer::Create(width, height);
114 webrtc::I420Buffer::SetBlack(buffer.get()); 114 webrtc::I420Buffer::SetBlack(buffer.get());
115 black_frame_buffer_ = buffer; 115 black_frame_buffer_ = buffer;
116 } 116 }
117 117
118 return black_frame_buffer_; 118 return black_frame_buffer_;
119 } 119 }
120 120
121 } // namespace rtc 121 } // namespace rtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698