| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, | 181 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, |
| 182 int height, | 182 int height, |
| 183 int fps) { | 183 int fps) { |
| 184 AsyncCapturerInvoke("OnOutputFormatRequest", | 184 AsyncCapturerInvoke("OnOutputFormatRequest", |
| 185 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, | 185 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, |
| 186 width, height, fps); | 186 width, height, fps); |
| 187 } | 187 } |
| 188 | 188 |
| 189 JNIEnv* AndroidVideoCapturerJni::jni() { return AttachCurrentThreadIfNeeded(); } | 189 JNIEnv* AndroidVideoCapturerJni::jni() { return AttachCurrentThreadIfNeeded(); } |
| 190 | 190 |
| 191 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnFrameCaptured) | 191 JOW(void, |
| 192 VideoCapturerAndroid_00024NativeObserver_nativeOnByteBufferFrameCaptured) |
| 192 (JNIEnv* jni, jclass, jlong j_capturer, jbyteArray j_frame, jint length, | 193 (JNIEnv* jni, jclass, jlong j_capturer, jbyteArray j_frame, jint length, |
| 193 jint width, jint height, jint rotation, jlong ts) { | 194 jint width, jint height, jint rotation, jlong ts) { |
| 194 jboolean is_copy = true; | 195 jboolean is_copy = true; |
| 195 jbyte* bytes = jni->GetByteArrayElements(j_frame, &is_copy); | 196 jbyte* bytes = jni->GetByteArrayElements(j_frame, &is_copy); |
| 196 // If this is a copy of the original frame, it means that the memory | 197 // If this is a copy of the original frame, it means that the memory |
| 197 // is not direct memory and thus VideoCapturerAndroid does not guarantee | 198 // is not direct memory and thus VideoCapturerAndroid does not guarantee |
| 198 // that the memory is valid when we have released |j_frame|. | 199 // that the memory is valid when we have released |j_frame|. |
| 199 // TODO(magjed): Move ReleaseByteArrayElements() into ReturnBuffer() and | 200 // TODO(magjed): Move ReleaseByteArrayElements() into ReturnBuffer() and |
| 200 // remove this check. | 201 // remove this check. |
| 201 RTC_CHECK(!is_copy) | 202 RTC_CHECK(!is_copy) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 224 (JNIEnv* jni, jclass, jobject j_video_capturer) { | 225 (JNIEnv* jni, jclass, jobject j_video_capturer) { |
| 225 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = | 226 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = |
| 226 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); | 227 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); |
| 227 rtc::scoped_ptr<cricket::VideoCapturer> capturer( | 228 rtc::scoped_ptr<cricket::VideoCapturer> capturer( |
| 228 new webrtc::AndroidVideoCapturer(delegate)); | 229 new webrtc::AndroidVideoCapturer(delegate)); |
| 229 // Caller takes ownership of the cricket::VideoCapturer* pointer. | 230 // Caller takes ownership of the cricket::VideoCapturer* pointer. |
| 230 return jlongFromPointer(capturer.release()); | 231 return jlongFromPointer(capturer.release()); |
| 231 } | 232 } |
| 232 | 233 |
| 233 } // namespace webrtc_jni | 234 } // namespace webrtc_jni |
| OLD | NEW |