| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ | 11 #ifndef WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ |
| 12 #define WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ | 12 #define WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ |
| 13 | 13 |
| 14 #include <jni.h> | 14 #include <jni.h> |
| 15 | 15 |
| 16 #include "webrtc/common_video/include/i420_buffer_pool.h" | 16 #include "webrtc/common_video/include/i420_buffer_pool.h" |
| 17 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 17 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 18 #include "webrtc/media/base/adaptedvideotracksource.h" | 18 #include "webrtc/media/base/adaptedvideotracksource.h" |
| 19 #include "webrtc/rtc_base/asyncinvoker.h" | 19 #include "webrtc/rtc_base/asyncinvoker.h" |
| 20 #include "webrtc/rtc_base/checks.h" | 20 #include "webrtc/rtc_base/checks.h" |
| 21 #include "webrtc/rtc_base/thread_checker.h" | 21 #include "webrtc/rtc_base/thread_checker.h" |
| 22 #include "webrtc/rtc_base/timestampaligner.h" | 22 #include "webrtc/rtc_base/timestampaligner.h" |
| 23 #include "webrtc/sdk/android/src/jni/native_handle_impl.h" | 23 #include "webrtc/sdk/android/src/jni/native_handle_impl.h" |
| 24 #include "webrtc/sdk/android/src/jni/surfacetexturehelper_jni.h" | 24 #include "webrtc/sdk/android/src/jni/surfacetexturehelper_jni.h" |
| 25 | 25 |
| 26 namespace webrtc { | 26 namespace webrtc { |
| 27 namespace jni { |
| 27 | 28 |
| 28 class AndroidVideoTrackSource : public rtc::AdaptedVideoTrackSource { | 29 class AndroidVideoTrackSource : public rtc::AdaptedVideoTrackSource { |
| 29 public: | 30 public: |
| 30 AndroidVideoTrackSource(rtc::Thread* signaling_thread, | 31 AndroidVideoTrackSource(rtc::Thread* signaling_thread, |
| 31 JNIEnv* jni, | 32 JNIEnv* jni, |
| 32 jobject j_surface_texture_helper, | 33 jobject j_surface_texture_helper, |
| 33 bool is_screencast = false); | 34 bool is_screencast = false); |
| 34 | 35 |
| 35 bool is_screencast() const override { return is_screencast_; } | 36 bool is_screencast() const override { return is_screencast_; } |
| 36 | 37 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 52 int length, | 53 int length, |
| 53 int width, | 54 int width, |
| 54 int height, | 55 int height, |
| 55 VideoRotation rotation, | 56 VideoRotation rotation, |
| 56 int64_t timestamp_ns); | 57 int64_t timestamp_ns); |
| 57 | 58 |
| 58 void OnTextureFrameCaptured(int width, | 59 void OnTextureFrameCaptured(int width, |
| 59 int height, | 60 int height, |
| 60 VideoRotation rotation, | 61 VideoRotation rotation, |
| 61 int64_t timestamp_ns, | 62 int64_t timestamp_ns, |
| 62 const webrtc_jni::NativeHandleImpl& handle); | 63 const NativeHandleImpl& handle); |
| 63 | 64 |
| 64 void OnFrameCaptured(JNIEnv* jni, | 65 void OnFrameCaptured(JNIEnv* jni, |
| 65 int width, | 66 int width, |
| 66 int height, | 67 int height, |
| 67 int64_t timestamp_ns, | 68 int64_t timestamp_ns, |
| 68 VideoRotation rotation, | 69 VideoRotation rotation, |
| 69 jobject j_video_frame_buffer); | 70 jobject j_video_frame_buffer); |
| 70 | 71 |
| 71 void OnOutputFormatRequest(int width, int height, int fps); | 72 void OnOutputFormatRequest(int width, int height, int fps); |
| 72 | 73 |
| 73 rtc::scoped_refptr<webrtc_jni::SurfaceTextureHelper> | 74 rtc::scoped_refptr<SurfaceTextureHelper> surface_texture_helper() { |
| 74 surface_texture_helper() { | |
| 75 return surface_texture_helper_; | 75 return surface_texture_helper_; |
| 76 } | 76 } |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 rtc::Thread* signaling_thread_; | 79 rtc::Thread* signaling_thread_; |
| 80 rtc::AsyncInvoker invoker_; | 80 rtc::AsyncInvoker invoker_; |
| 81 rtc::ThreadChecker camera_thread_checker_; | 81 rtc::ThreadChecker camera_thread_checker_; |
| 82 SourceState state_; | 82 SourceState state_; |
| 83 rtc::TimestampAligner timestamp_aligner_; | 83 rtc::TimestampAligner timestamp_aligner_; |
| 84 NV12ToI420Scaler nv12toi420_scaler_; | 84 NV12ToI420Scaler nv12toi420_scaler_; |
| 85 I420BufferPool buffer_pool_; | 85 I420BufferPool buffer_pool_; |
| 86 rtc::scoped_refptr<webrtc_jni::SurfaceTextureHelper> surface_texture_helper_; | 86 rtc::scoped_refptr<SurfaceTextureHelper> surface_texture_helper_; |
| 87 webrtc_jni::AndroidVideoBufferFactory video_buffer_factory_; | 87 AndroidVideoBufferFactory video_buffer_factory_; |
| 88 const bool is_screencast_; | 88 const bool is_screencast_; |
| 89 | 89 |
| 90 jmethodID j_crop_and_scale_id_; | 90 jmethodID j_crop_and_scale_id_; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } // namespace jni |
| 93 } // namespace webrtc | 94 } // namespace webrtc |
| 94 | 95 |
| 95 #endif // WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ | 96 #endif // WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ |
| OLD | NEW |