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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(int width, |
184 int height, | 184 int height, |
| 185 int rotation, |
185 int64_t timestamp_ns, | 186 int64_t timestamp_ns, |
186 const NativeHandleImpl& handle) { | 187 const NativeHandleImpl& handle) { |
187 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( | 188 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
188 new rtc::RefCountedObject<AndroidTextureBuffer>( | 189 new rtc::RefCountedObject<AndroidTextureBuffer>( |
189 width, height, handle, | 190 width, height, handle, |
190 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this, | 191 rtc::Bind(&AndroidVideoCapturerJni::ReturnBuffer, this, |
191 timestamp_ns))); | 192 timestamp_ns))); |
192 AsyncCapturerInvoke("OnIncomingFrame", | 193 AsyncCapturerInvoke("OnIncomingFrame", |
193 &webrtc::AndroidVideoCapturer::OnIncomingFrame, | 194 &webrtc::AndroidVideoCapturer::OnIncomingFrame, |
194 buffer, 0, timestamp_ns); | 195 buffer, rotation, timestamp_ns); |
195 } | 196 } |
196 | 197 |
197 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, | 198 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, |
198 int height, | 199 int height, |
199 int fps) { | 200 int fps) { |
200 AsyncCapturerInvoke("OnOutputFormatRequest", | 201 AsyncCapturerInvoke("OnOutputFormatRequest", |
201 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, | 202 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, |
202 width, height, fps); | 203 width, height, fps); |
203 } | 204 } |
204 | 205 |
(...skipping 13 matching lines...) Expand all Loading... |
218 RTC_CHECK(!is_copy) | 219 RTC_CHECK(!is_copy) |
219 << "NativeObserver_nativeOnFrameCaptured: frame is a copy"; | 220 << "NativeObserver_nativeOnFrameCaptured: frame is a copy"; |
220 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer) | 221 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer) |
221 ->OnMemoryBufferFrame(bytes, length, width, height, rotation, timestamp); | 222 ->OnMemoryBufferFrame(bytes, length, width, height, rotation, timestamp); |
222 jni->ReleaseByteArrayElements(j_frame, bytes, JNI_ABORT); | 223 jni->ReleaseByteArrayElements(j_frame, bytes, JNI_ABORT); |
223 } | 224 } |
224 | 225 |
225 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnTextureFrameCaptured) | 226 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnTextureFrameCaptured) |
226 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, | 227 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, |
227 jint j_oes_texture_id, jfloatArray j_transform_matrix, | 228 jint j_oes_texture_id, jfloatArray j_transform_matrix, |
228 jlong j_timestamp) { | 229 jint j_rotation, jlong j_timestamp) { |
229 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer) | 230 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer) |
230 ->OnTextureFrame(j_width, j_height, j_timestamp, | 231 ->OnTextureFrame(j_width, j_height, j_rotation, j_timestamp, |
231 NativeHandleImpl(jni, j_oes_texture_id, | 232 NativeHandleImpl(jni, j_oes_texture_id, |
232 j_transform_matrix)); | 233 j_transform_matrix)); |
233 } | 234 } |
234 | 235 |
235 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeCapturerStarted) | 236 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeCapturerStarted) |
236 (JNIEnv* jni, jclass, jlong j_capturer, jboolean j_success) { | 237 (JNIEnv* jni, jclass, jlong j_capturer, jboolean j_success) { |
237 LOG(LS_INFO) << "NativeObserver_nativeCapturerStarted"; | 238 LOG(LS_INFO) << "NativeObserver_nativeCapturerStarted"; |
238 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnCapturerStarted( | 239 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnCapturerStarted( |
239 j_success); | 240 j_success); |
240 } | 241 } |
(...skipping 10 matching lines...) Expand all Loading... |
251 (JNIEnv* jni, jclass, jobject j_video_capturer) { | 252 (JNIEnv* jni, jclass, jobject j_video_capturer) { |
252 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = | 253 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = |
253 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); | 254 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); |
254 rtc::scoped_ptr<cricket::VideoCapturer> capturer( | 255 rtc::scoped_ptr<cricket::VideoCapturer> capturer( |
255 new webrtc::AndroidVideoCapturer(delegate)); | 256 new webrtc::AndroidVideoCapturer(delegate)); |
256 // Caller takes ownership of the cricket::VideoCapturer* pointer. | 257 // Caller takes ownership of the cricket::VideoCapturer* pointer. |
257 return jlongFromPointer(capturer.release()); | 258 return jlongFromPointer(capturer.release()); |
258 } | 259 } |
259 | 260 |
260 } // namespace webrtc_jni | 261 } // namespace webrtc_jni |
OLD | NEW |