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

Side by Side Diff: webrtc/api/androidvideotracksource.cc

Issue 2350933006: Android VideoSource: Add adaptOutputFormat function (Closed)
Patch Set: Remove thread check in OnOutputFormatRequest Created 4 years, 3 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 rtc::CritScope lock(&stats_crit_); 221 rtc::CritScope lock(&stats_crit_);
222 stats_ = rtc::Optional<AndroidVideoTrackSource::Stats>({width, height}); 222 stats_ = rtc::Optional<AndroidVideoTrackSource::Stats>({width, height});
223 } 223 }
224 224
225 broadcaster_.OnFrame(frame); 225 broadcaster_.OnFrame(frame);
226 } 226 }
227 227
228 void AndroidVideoTrackSource::OnOutputFormatRequest(int width, 228 void AndroidVideoTrackSource::OnOutputFormatRequest(int width,
229 int height, 229 int height,
230 int fps) { 230 int fps) {
231 RTC_DCHECK(camera_thread_checker_.CalledOnValidThread());
232
233 cricket::VideoFormat format(width, height, 231 cricket::VideoFormat format(width, height,
234 cricket::VideoFormat::FpsToInterval(fps), 0); 232 cricket::VideoFormat::FpsToInterval(fps), 0);
235 video_adapter_.OnOutputFormatRequest(format); 233 video_adapter_.OnOutputFormatRequest(format);
236 } 234 }
237 235
238 bool AndroidVideoTrackSource::AdaptFrame(int width, 236 bool AndroidVideoTrackSource::AdaptFrame(int width,
239 int height, 237 int height,
240 int64_t camera_time_us, 238 int64_t camera_time_us,
241 int* out_width, 239 int* out_width,
242 int* out_height, 240 int* out_height,
(...skipping 18 matching lines...) Expand all
261 // VideoAdapter dropped the frame. 259 // VideoAdapter dropped the frame.
262 return false; 260 return false;
263 } 261 }
264 *crop_x = (width - *crop_width) / 2; 262 *crop_x = (width - *crop_width) / 2;
265 *crop_y = (height - *crop_height) / 2; 263 *crop_y = (height - *crop_height) / 2;
266 264
267 return true; 265 return true;
268 } 266 }
269 267
270 } // namespace webrtc 268 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698