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

Side by Side Diff: talk/app/webrtc/java/jni/androidvideocapturer_jni.cc

Issue 1493913007: VideoCapturerAndroid, handle cvo correctly (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 5 years 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 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 uv_stride, 178 uv_stride,
179 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this, 179 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this,
180 timestamp_ns))); 180 timestamp_ns)));
181 AsyncCapturerInvoke("OnIncomingFrame", 181 AsyncCapturerInvoke("OnIncomingFrame",
182 &webrtc::AndroidVideoCapturer::OnIncomingFrame, 182 &webrtc::AndroidVideoCapturer::OnIncomingFrame,
183 buffer, rotation, timestamp_ns); 183 buffer, rotation, timestamp_ns);
184 } 184 }
185 185
186 void AndroidVideoCapturerJni::OnTextureFrame(int width, 186 void AndroidVideoCapturerJni::OnTextureFrame(int width,
187 int height, 187 int height,
188 int rotation,
188 int64_t timestamp_ns, 189 int64_t timestamp_ns,
189 const NativeHandleImpl& handle) { 190 const NativeHandleImpl& handle) {
190 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( 191 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer(
191 new rtc::RefCountedObject<AndroidTextureBuffer>( 192 new rtc::RefCountedObject<AndroidTextureBuffer>(
192 width, height, handle, *j_surface_texture_helper_, 193 width, height, handle, *j_surface_texture_helper_,
193 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this, 194 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this,
194 timestamp_ns))); 195 timestamp_ns)));
195 AsyncCapturerInvoke("OnIncomingFrame", 196 AsyncCapturerInvoke("OnIncomingFrame",
196 &webrtc::AndroidVideoCapturer::OnIncomingFrame, 197 &webrtc::AndroidVideoCapturer::OnIncomingFrame,
197 buffer, 0, timestamp_ns); 198 buffer, rotation, timestamp_ns);
198 } 199 }
199 200
200 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, 201 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width,
201 int height, 202 int height,
202 int fps) { 203 int fps) {
203 AsyncCapturerInvoke("OnOutputFormatRequest", 204 AsyncCapturerInvoke("OnOutputFormatRequest",
204 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, 205 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest,
205 width, height, fps); 206 width, height, fps);
206 } 207 }
207 208
(...skipping 13 matching lines...) Expand all
221 RTC_CHECK(!is_copy) 222 RTC_CHECK(!is_copy)
222 << "NativeObserver_nativeOnFrameCaptured: frame is a copy"; 223 << "NativeObserver_nativeOnFrameCaptured: frame is a copy";
223 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer) 224 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)
224 ->OnMemoryBufferFrame(bytes, length, width, height, rotation, timestamp); 225 ->OnMemoryBufferFrame(bytes, length, width, height, rotation, timestamp);
225 jni->ReleaseByteArrayElements(j_frame, bytes, JNI_ABORT); 226 jni->ReleaseByteArrayElements(j_frame, bytes, JNI_ABORT);
226 } 227 }
227 228
228 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnTextureFrameCaptured) 229 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnTextureFrameCaptured)
229 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, 230 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height,
230 jint j_oes_texture_id, jfloatArray j_transform_matrix, 231 jint j_oes_texture_id, jfloatArray j_transform_matrix,
231 jlong j_timestamp) { 232 jint j_rotation, jlong j_timestamp) {
232 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer) 233 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)
233 ->OnTextureFrame(j_width, j_height, j_timestamp, 234 ->OnTextureFrame(j_width, j_height, j_rotation, j_timestamp,
234 NativeHandleImpl(jni, j_oes_texture_id, 235 NativeHandleImpl(jni, j_oes_texture_id,
235 j_transform_matrix)); 236 j_transform_matrix));
236 } 237 }
237 238
238 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeCapturerStarted) 239 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeCapturerStarted)
239 (JNIEnv* jni, jclass, jlong j_capturer, jboolean j_success) { 240 (JNIEnv* jni, jclass, jlong j_capturer, jboolean j_success) {
240 LOG(LS_INFO) << "NativeObserver_nativeCapturerStarted"; 241 LOG(LS_INFO) << "NativeObserver_nativeCapturerStarted";
241 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnCapturerStarted( 242 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnCapturerStarted(
242 j_success); 243 j_success);
243 } 244 }
(...skipping 12 matching lines...) Expand all
256 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = 257 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate =
257 new rtc::RefCountedObject<AndroidVideoCapturerJni>( 258 new rtc::RefCountedObject<AndroidVideoCapturerJni>(
258 jni, j_video_capturer, j_surface_texture_helper); 259 jni, j_video_capturer, j_surface_texture_helper);
259 rtc::scoped_ptr<cricket::VideoCapturer> capturer( 260 rtc::scoped_ptr<cricket::VideoCapturer> capturer(
260 new webrtc::AndroidVideoCapturer(delegate)); 261 new webrtc::AndroidVideoCapturer(delegate));
261 // Caller takes ownership of the cricket::VideoCapturer* pointer. 262 // Caller takes ownership of the cricket::VideoCapturer* pointer.
262 return jlongFromPointer(capturer.release()); 263 return jlongFromPointer(capturer.release());
263 } 264 }
264 265
265 } // namespace webrtc_jni 266 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/jni/androidvideocapturer_jni.h ('k') | talk/app/webrtc/java/jni/native_handle_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698