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 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( | 187 const NativeTextureHandleImpl& handle) { |
188 new rtc::RefCountedObject<AndroidTextureBuffer>( | 188 RTC_NOTREACHED() |
189 width, height, handle, | 189 << "The rest of the stack for Android expects the native " |
190 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this, | 190 "handle to be a NativeHandleImpl with a SurfaceTexture, not a " |
191 timestamp_ns))); | 191 "NativeTextureHandleImpl"; |
192 AsyncCapturerInvoke("OnIncomingFrame", | 192 // rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
perkj_webrtc
2015/10/15 11:31:11
Keep the code. Add Todo and add the bug number we
| |
193 &webrtc::AndroidVideoCapturer::OnIncomingFrame, | 193 // new rtc::RefCountedObject<AndroidTextureBuffer>( |
194 buffer, 0, timestamp_ns); | 194 // width, height, handle, |
195 // rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this, | |
196 // timestamp_ns))); | |
197 // AsyncCapturerInvoke("OnIncomingFrame", | |
198 // &webrtc::AndroidVideoCapturer::OnIncomingFrame, | |
199 // buffer, 0, timestamp_ns); | |
195 } | 200 } |
196 | 201 |
197 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, | 202 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, |
198 int height, | 203 int height, |
199 int fps) { | 204 int fps) { |
200 AsyncCapturerInvoke("OnOutputFormatRequest", | 205 AsyncCapturerInvoke("OnOutputFormatRequest", |
201 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, | 206 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, |
202 width, height, fps); | 207 width, height, fps); |
203 } | 208 } |
204 | 209 |
(...skipping 16 matching lines...) Expand all Loading... | |
221 ->OnMemoryBufferFrame(bytes, length, width, height, rotation, timestamp); | 226 ->OnMemoryBufferFrame(bytes, length, width, height, rotation, timestamp); |
222 jni->ReleaseByteArrayElements(j_frame, bytes, JNI_ABORT); | 227 jni->ReleaseByteArrayElements(j_frame, bytes, JNI_ABORT); |
223 } | 228 } |
224 | 229 |
225 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnTextureFrameCaptured) | 230 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnTextureFrameCaptured) |
226 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, | 231 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, |
227 jint j_oes_texture_id, jfloatArray j_transform_matrix, | 232 jint j_oes_texture_id, jfloatArray j_transform_matrix, |
228 jlong j_timestamp) { | 233 jlong j_timestamp) { |
229 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer) | 234 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer) |
230 ->OnTextureFrame(j_width, j_height, j_timestamp, | 235 ->OnTextureFrame(j_width, j_height, j_timestamp, |
231 NativeHandleImpl(jni, j_oes_texture_id, | 236 NativeTextureHandleImpl(jni, j_oes_texture_id, |
232 j_transform_matrix)); | 237 j_transform_matrix)); |
233 } | 238 } |
234 | 239 |
235 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeCapturerStarted) | 240 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeCapturerStarted) |
236 (JNIEnv* jni, jclass, jlong j_capturer, jboolean j_success) { | 241 (JNIEnv* jni, jclass, jlong j_capturer, jboolean j_success) { |
237 LOG(LS_INFO) << "NativeObserver_nativeCapturerStarted"; | 242 LOG(LS_INFO) << "NativeObserver_nativeCapturerStarted"; |
238 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnCapturerStarted( | 243 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnCapturerStarted( |
239 j_success); | 244 j_success); |
240 } | 245 } |
241 | 246 |
242 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnOutputFormatRequest) | 247 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnOutputFormatRequest) |
243 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, | 248 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, |
244 jint j_fps) { | 249 jint j_fps) { |
245 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; | 250 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; |
246 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( | 251 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( |
247 j_width, j_height, j_fps); | 252 j_width, j_height, j_fps); |
248 } | 253 } |
249 | 254 |
250 JOW(jlong, VideoCapturerAndroid_nativeCreateVideoCapturer) | 255 JOW(jlong, VideoCapturerAndroid_nativeCreateVideoCapturer) |
251 (JNIEnv* jni, jclass, jobject j_video_capturer) { | 256 (JNIEnv* jni, jclass, jobject j_video_capturer) { |
252 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = | 257 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = |
253 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); | 258 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); |
254 rtc::scoped_ptr<cricket::VideoCapturer> capturer( | 259 rtc::scoped_ptr<cricket::VideoCapturer> capturer( |
255 new webrtc::AndroidVideoCapturer(delegate)); | 260 new webrtc::AndroidVideoCapturer(delegate)); |
256 // Caller takes ownership of the cricket::VideoCapturer* pointer. | 261 // Caller takes ownership of the cricket::VideoCapturer* pointer. |
257 return jlongFromPointer(capturer.release()); | 262 return jlongFromPointer(capturer.release()); |
258 } | 263 } |
259 | 264 |
260 } // namespace webrtc_jni | 265 } // namespace webrtc_jni |
OLD | NEW |