OLD | NEW |
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( | 173 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( |
174 width, height, y_plane, y_stride, u_plane, uv_stride, v_plane, | 174 width, height, y_plane, y_stride, u_plane, uv_stride, v_plane, |
175 uv_stride, | 175 uv_stride, |
176 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this, | 176 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this, |
177 timestamp_ns))); | 177 timestamp_ns))); |
178 AsyncCapturerInvoke("OnIncomingFrame", | 178 AsyncCapturerInvoke("OnIncomingFrame", |
179 &webrtc::AndroidVideoCapturer::OnIncomingFrame, | 179 &webrtc::AndroidVideoCapturer::OnIncomingFrame, |
180 buffer, rotation, timestamp_ns); | 180 buffer, rotation, timestamp_ns); |
181 } | 181 } |
182 | 182 |
183 void AndroidVideoCapturerJni::OnTextureFrame(int width, | 183 void AndroidVideoCapturerJni::OnTextureFrame( |
184 int height, | 184 int width, |
185 int64_t timestamp_ns, | 185 int height, |
186 const NativeHandleImpl& handle) { | 186 int64_t timestamp_ns, |
| 187 const NativeTextureHandleImpl& handle) { |
| 188 // TODO(magjed): Fix this. See bug webrtc:4993. |
| 189 RTC_NOTREACHED() |
| 190 << "The rest of the stack for Android expects the native " |
| 191 "handle to be a NativeHandleImpl with a SurfaceTexture, not a " |
| 192 "NativeTextureHandleImpl"; |
187 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( | 193 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
188 new rtc::RefCountedObject<AndroidTextureBuffer>( | 194 new rtc::RefCountedObject<AndroidTextureBuffer>( |
189 width, height, handle, | 195 width, height, handle, |
190 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this, | 196 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this, |
191 timestamp_ns))); | 197 timestamp_ns))); |
192 AsyncCapturerInvoke("OnIncomingFrame", | 198 AsyncCapturerInvoke("OnIncomingFrame", |
193 &webrtc::AndroidVideoCapturer::OnIncomingFrame, | 199 &webrtc::AndroidVideoCapturer::OnIncomingFrame, |
194 buffer, 0, timestamp_ns); | 200 buffer, 0, timestamp_ns); |
195 } | 201 } |
196 | 202 |
(...skipping 24 matching lines...) Expand all Loading... |
221 ->OnMemoryBufferFrame(bytes, length, width, height, rotation, timestamp); | 227 ->OnMemoryBufferFrame(bytes, length, width, height, rotation, timestamp); |
222 jni->ReleaseByteArrayElements(j_frame, bytes, JNI_ABORT); | 228 jni->ReleaseByteArrayElements(j_frame, bytes, JNI_ABORT); |
223 } | 229 } |
224 | 230 |
225 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnTextureFrameCaptured) | 231 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnTextureFrameCaptured) |
226 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, | 232 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, |
227 jint j_oes_texture_id, jfloatArray j_transform_matrix, | 233 jint j_oes_texture_id, jfloatArray j_transform_matrix, |
228 jlong j_timestamp) { | 234 jlong j_timestamp) { |
229 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer) | 235 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer) |
230 ->OnTextureFrame(j_width, j_height, j_timestamp, | 236 ->OnTextureFrame(j_width, j_height, j_timestamp, |
231 NativeHandleImpl(jni, j_oes_texture_id, | 237 NativeTextureHandleImpl(jni, j_oes_texture_id, |
232 j_transform_matrix)); | 238 j_transform_matrix)); |
233 } | 239 } |
234 | 240 |
235 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeCapturerStarted) | 241 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeCapturerStarted) |
236 (JNIEnv* jni, jclass, jlong j_capturer, jboolean j_success) { | 242 (JNIEnv* jni, jclass, jlong j_capturer, jboolean j_success) { |
237 LOG(LS_INFO) << "NativeObserver_nativeCapturerStarted"; | 243 LOG(LS_INFO) << "NativeObserver_nativeCapturerStarted"; |
238 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnCapturerStarted( | 244 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnCapturerStarted( |
239 j_success); | 245 j_success); |
240 } | 246 } |
241 | 247 |
242 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnOutputFormatRequest) | 248 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnOutputFormatRequest) |
243 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, | 249 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, |
244 jint j_fps) { | 250 jint j_fps) { |
245 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; | 251 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; |
246 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( | 252 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( |
247 j_width, j_height, j_fps); | 253 j_width, j_height, j_fps); |
248 } | 254 } |
249 | 255 |
250 JOW(jlong, VideoCapturerAndroid_nativeCreateVideoCapturer) | 256 JOW(jlong, VideoCapturerAndroid_nativeCreateVideoCapturer) |
251 (JNIEnv* jni, jclass, jobject j_video_capturer) { | 257 (JNIEnv* jni, jclass, jobject j_video_capturer) { |
252 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = | 258 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = |
253 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); | 259 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); |
254 rtc::scoped_ptr<cricket::VideoCapturer> capturer( | 260 rtc::scoped_ptr<cricket::VideoCapturer> capturer( |
255 new webrtc::AndroidVideoCapturer(delegate)); | 261 new webrtc::AndroidVideoCapturer(delegate)); |
256 // Caller takes ownership of the cricket::VideoCapturer* pointer. | 262 // Caller takes ownership of the cricket::VideoCapturer* pointer. |
257 return jlongFromPointer(capturer.release()); | 263 return jlongFromPointer(capturer.release()); |
258 } | 264 } |
259 | 265 |
260 } // namespace webrtc_jni | 266 } // namespace webrtc_jni |
OLD | NEW |