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

Side by Side Diff: webrtc/api/android/jni/androidvideocapturer_jni.cc

Issue 2088953002: Add cricket::VideoFrame::frame_id() and set it to RTP timestamp. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: . Created 4 years, 4 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 | « no previous file | webrtc/api/androidvideotracksource.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 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 buffer->MutableDataU(), buffer->StrideU(), 227 buffer->MutableDataU(), buffer->StrideU(),
228 crop_width, crop_height, static_cast<libyuv::RotationMode>( 228 crop_width, crop_height, static_cast<libyuv::RotationMode>(
229 capturer_->apply_rotation() ? rotation : 0)); 229 capturer_->apply_rotation() ? rotation : 0));
230 230
231 if (adapted_width != buffer->width() || adapted_height != buffer->height()) { 231 if (adapted_width != buffer->width() || adapted_height != buffer->height()) {
232 rtc::scoped_refptr<webrtc::I420Buffer> scaled_buffer( 232 rtc::scoped_refptr<webrtc::I420Buffer> scaled_buffer(
233 post_scale_pool_.CreateBuffer(adapted_width, adapted_height)); 233 post_scale_pool_.CreateBuffer(adapted_width, adapted_height));
234 scaled_buffer->ScaleFrom(buffer); 234 scaled_buffer->ScaleFrom(buffer);
235 buffer = scaled_buffer; 235 buffer = scaled_buffer;
236 } 236 }
237 capturer_->OnFrame(cricket::WebRtcVideoFrame( 237 capturer_->OnFrame(
238 buffer, 238 cricket::WebRtcVideoFrame(
239 capturer_->apply_rotation() 239 buffer, capturer_->apply_rotation()
240 ? webrtc::kVideoRotation_0 240 ? webrtc::kVideoRotation_0
241 : static_cast<webrtc::VideoRotation>(rotation), 241 : static_cast<webrtc::VideoRotation>(rotation),
242 translated_camera_time_us), 242 translated_camera_time_us, 0),
243 width, height); 243 width, height);
244 } 244 }
245 245
246 void AndroidVideoCapturerJni::OnTextureFrame(int width, 246 void AndroidVideoCapturerJni::OnTextureFrame(int width,
247 int height, 247 int height,
248 int rotation, 248 int rotation,
249 int64_t timestamp_ns, 249 int64_t timestamp_ns,
250 const NativeHandleImpl& handle) { 250 const NativeHandleImpl& handle) {
251 RTC_DCHECK(rotation == 0 || rotation == 90 || rotation == 180 || 251 RTC_DCHECK(rotation == 0 || rotation == 90 || rotation == 180 ||
252 rotation == 270); 252 rotation == 270);
253 rtc::CritScope cs(&capturer_lock_); 253 rtc::CritScope cs(&capturer_lock_);
(...skipping 28 matching lines...) Expand all
282 crop_y / static_cast<float>(height)); 282 crop_y / static_cast<float>(height));
283 283
284 if (capturer_->apply_rotation()) { 284 if (capturer_->apply_rotation()) {
285 if (rotation == webrtc::kVideoRotation_90 || 285 if (rotation == webrtc::kVideoRotation_90 ||
286 rotation == webrtc::kVideoRotation_270) { 286 rotation == webrtc::kVideoRotation_270) {
287 std::swap(adapted_width, adapted_height); 287 std::swap(adapted_width, adapted_height);
288 } 288 }
289 matrix.Rotate(static_cast<webrtc::VideoRotation>(rotation)); 289 matrix.Rotate(static_cast<webrtc::VideoRotation>(rotation));
290 } 290 }
291 291
292 capturer_->OnFrame( 292 capturer_->OnFrame(cricket::WebRtcVideoFrame(
293 cricket::WebRtcVideoFrame( 293 surface_texture_helper_->CreateTextureFrame(
294 surface_texture_helper_->CreateTextureFrame( 294 adapted_width, adapted_height,
295 adapted_width, adapted_height, 295 NativeHandleImpl(handle.oes_texture_id, matrix)),
296 NativeHandleImpl(handle.oes_texture_id, matrix)), 296 capturer_->apply_rotation()
297 capturer_->apply_rotation() 297 ? webrtc::kVideoRotation_0
298 ? webrtc::kVideoRotation_0 298 : static_cast<webrtc::VideoRotation>(rotation),
299 : static_cast<webrtc::VideoRotation>(rotation), 299 translated_camera_time_us, 0),
300 translated_camera_time_us), 300 width, height);
301 width, height);
302 } 301 }
303 302
304 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, 303 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width,
305 int height, 304 int height,
306 int fps) { 305 int fps) {
307 AsyncCapturerInvoke(RTC_FROM_HERE, 306 AsyncCapturerInvoke(RTC_FROM_HERE,
308 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, 307 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest,
309 width, height, fps); 308 width, height, fps);
310 } 309 }
311 310
(...skipping 29 matching lines...) Expand all
341 340
342 JOW(void, VideoCapturer_00024NativeObserver_nativeOnOutputFormatRequest) 341 JOW(void, VideoCapturer_00024NativeObserver_nativeOnOutputFormatRequest)
343 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, 342 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height,
344 jint j_fps) { 343 jint j_fps) {
345 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; 344 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest";
346 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( 345 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest(
347 j_width, j_height, j_fps); 346 j_width, j_height, j_fps);
348 } 347 }
349 348
350 } // namespace webrtc_jni 349 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/androidvideotracksource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698