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

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

Issue 1973873003: Delete AndroidVideoCapturer::FrameFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address nit. Delete left-over include. Created 4 years, 6 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
« no previous file with comments | « webrtc/media/base/videoadapter.h ('k') | webrtc/media/base/videoadapter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 // First timestamp received or timestamp is way outside expected range, so 148 // First timestamp received or timestamp is way outside expected range, so
149 // reset. Set first timestamp target to just half the interval to prefer 149 // reset. Set first timestamp target to just half the interval to prefer
150 // keeping frames in case of jitter. 150 // keeping frames in case of jitter.
151 next_frame_timestamp_ns_ = 151 next_frame_timestamp_ns_ =
152 rtc::Optional<int64_t>(in_timestamp_ns + requested_format_->interval / 2); 152 rtc::Optional<int64_t>(in_timestamp_ns + requested_format_->interval / 2);
153 return true; 153 return true;
154 } 154 }
155 155
156 void VideoAdapter::AdaptFrameResolution(int in_width, 156 bool VideoAdapter::AdaptFrameResolution(int in_width,
157 int in_height, 157 int in_height,
158 int64_t in_timestamp_ns, 158 int64_t in_timestamp_ns,
159 int* cropped_width, 159 int* cropped_width,
160 int* cropped_height, 160 int* cropped_height,
161 int* out_width, 161 int* out_width,
162 int* out_height) { 162 int* out_height) {
163 rtc::CritScope cs(&critical_section_); 163 rtc::CritScope cs(&critical_section_);
164 ++frames_in_; 164 ++frames_in_;
165 165
166 // The max output pixel count is the minimum of the requests from 166 // The max output pixel count is the minimum of the requests from
(...skipping 15 matching lines...) Expand all
182 << " / in " << frames_in_ 182 << " / in " << frames_in_
183 << " Changes: " << adaption_changes_ 183 << " Changes: " << adaption_changes_
184 << " Input: " << in_width 184 << " Input: " << in_width
185 << "x" << in_height 185 << "x" << in_height
186 << " timestamp: " << in_timestamp_ns 186 << " timestamp: " << in_timestamp_ns
187 << " Output: i" 187 << " Output: i"
188 << (requested_format_ ? requested_format_->interval : 0); 188 << (requested_format_ ? requested_format_->interval : 0);
189 } 189 }
190 190
191 // Drop frame. 191 // Drop frame.
192 *cropped_width = 0; 192 return false;
193 *cropped_height = 0;
194 *out_width = 0;
195 *out_height = 0;
196 return;
197 } 193 }
198 194
199 // Calculate how the input should be cropped. 195 // Calculate how the input should be cropped.
200 if (!requested_format_ || 196 if (!requested_format_ ||
201 requested_format_->width == 0 || requested_format_->height == 0) { 197 requested_format_->width == 0 || requested_format_->height == 0) {
202 *cropped_width = in_width; 198 *cropped_width = in_width;
203 *cropped_height = in_height; 199 *cropped_height = in_height;
204 } else { 200 } else {
205 // Adjust |requested_format_| orientation to match input. 201 // Adjust |requested_format_| orientation to match input.
206 if ((in_width > in_height) != 202 if ((in_width > in_height) !=
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 << frames_out_ << " / in " << frames_in_ 239 << frames_out_ << " / in " << frames_in_
244 << " Changes: " << adaption_changes_ << " Input: " << in_width 240 << " Changes: " << adaption_changes_ << " Input: " << in_width
245 << "x" << in_height 241 << "x" << in_height
246 << " Scale: " << scale.numerator << "/" << scale.denominator 242 << " Scale: " << scale.numerator << "/" << scale.denominator
247 << " Output: " << *out_width << "x" << *out_height << " i" 243 << " Output: " << *out_width << "x" << *out_height << " i"
248 << (requested_format_ ? requested_format_->interval : 0); 244 << (requested_format_ ? requested_format_->interval : 0);
249 } 245 }
250 246
251 previous_width_ = *out_width; 247 previous_width_ = *out_width;
252 previous_height_ = *out_height; 248 previous_height_ = *out_height;
249
250 return true;
253 } 251 }
254 252
255 void VideoAdapter::OnOutputFormatRequest(const VideoFormat& format) { 253 void VideoAdapter::OnOutputFormatRequest(const VideoFormat& format) {
256 rtc::CritScope cs(&critical_section_); 254 rtc::CritScope cs(&critical_section_);
257 requested_format_ = rtc::Optional<VideoFormat>(format); 255 requested_format_ = rtc::Optional<VideoFormat>(format);
258 next_frame_timestamp_ns_ = rtc::Optional<int64_t>(); 256 next_frame_timestamp_ns_ = rtc::Optional<int64_t>();
259 } 257 }
260 258
261 void VideoAdapter::OnResolutionRequest( 259 void VideoAdapter::OnResolutionRequest(
262 rtc::Optional<int> max_pixel_count, 260 rtc::Optional<int> max_pixel_count,
263 rtc::Optional<int> max_pixel_count_step_up) { 261 rtc::Optional<int> max_pixel_count_step_up) {
264 rtc::CritScope cs(&critical_section_); 262 rtc::CritScope cs(&critical_section_);
265 resolution_request_max_pixel_count_ = 263 resolution_request_max_pixel_count_ =
266 max_pixel_count.value_or(std::numeric_limits<int>::max()); 264 max_pixel_count.value_or(std::numeric_limits<int>::max());
267 resolution_request_max_pixel_count_step_up_ = 265 resolution_request_max_pixel_count_step_up_ =
268 max_pixel_count_step_up.value_or(0); 266 max_pixel_count_step_up.value_or(0);
269 } 267 }
270 268
271 } // namespace cricket 269 } // namespace cricket
OLDNEW
« 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