| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #ifndef WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ | |
| 12 #define WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ | |
| 13 | |
| 14 #include "webrtc/api/android/jni/native_handle_impl.h" | |
| 15 #include "webrtc/api/android/jni/surfacetexturehelper_jni.h" | |
| 16 #include "webrtc/base/asyncinvoker.h" | |
| 17 #include "webrtc/base/checks.h" | |
| 18 #include "webrtc/base/thread_checker.h" | |
| 19 #include "webrtc/base/timestampaligner.h" | |
| 20 #include "webrtc/common_video/include/i420_buffer_pool.h" | |
| 21 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | |
| 22 #include "webrtc/media/base/adaptedvideotracksource.h" | |
| 23 | |
| 24 namespace webrtc { | |
| 25 | |
| 26 class AndroidVideoTrackSource : public rtc::AdaptedVideoTrackSource { | |
| 27 public: | |
| 28 AndroidVideoTrackSource(rtc::Thread* signaling_thread, | |
| 29 JNIEnv* jni, | |
| 30 jobject j_egl_context, | |
| 31 bool is_screencast = false); | |
| 32 | |
| 33 bool is_screencast() const override { return is_screencast_; } | |
| 34 | |
| 35 // Indicates that the encoder should denoise video before encoding it. | |
| 36 // If it is not set, the default configuration is used which is different | |
| 37 // depending on video codec. | |
| 38 rtc::Optional<bool> needs_denoising() const override { | |
| 39 return rtc::Optional<bool>(false); | |
| 40 } | |
| 41 | |
| 42 // Called by the native capture observer | |
| 43 void SetState(SourceState state); | |
| 44 | |
| 45 SourceState state() const override { return state_; } | |
| 46 | |
| 47 bool remote() const override { return false; } | |
| 48 | |
| 49 void OnByteBufferFrameCaptured(const void* frame_data, | |
| 50 int length, | |
| 51 int width, | |
| 52 int height, | |
| 53 int rotation, | |
| 54 int64_t timestamp_ns); | |
| 55 | |
| 56 void OnTextureFrameCaptured(int width, | |
| 57 int height, | |
| 58 int rotation, | |
| 59 int64_t timestamp_ns, | |
| 60 const webrtc_jni::NativeHandleImpl& handle); | |
| 61 | |
| 62 void OnOutputFormatRequest(int width, int height, int fps); | |
| 63 | |
| 64 rtc::scoped_refptr<webrtc_jni::SurfaceTextureHelper> | |
| 65 surface_texture_helper() { | |
| 66 return surface_texture_helper_; | |
| 67 } | |
| 68 | |
| 69 private: | |
| 70 rtc::Thread* signaling_thread_; | |
| 71 rtc::AsyncInvoker invoker_; | |
| 72 rtc::ThreadChecker camera_thread_checker_; | |
| 73 SourceState state_; | |
| 74 rtc::VideoBroadcaster broadcaster_; | |
| 75 rtc::TimestampAligner timestamp_aligner_; | |
| 76 webrtc::NV12ToI420Scaler nv12toi420_scaler_; | |
| 77 webrtc::I420BufferPool buffer_pool_; | |
| 78 rtc::scoped_refptr<webrtc_jni::SurfaceTextureHelper> surface_texture_helper_; | |
| 79 const bool is_screencast_; | |
| 80 }; | |
| 81 | |
| 82 } // namespace webrtc | |
| 83 | |
| 84 #endif // WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ | |
| OLD | NEW |