| 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_ANDROIDVIDEOTRACKSOURCE_H_ | 11 #ifndef WEBRTC_API_ANDROIDVIDEOTRACKSOURCE_H_ |
| 12 #define WEBRTC_API_ANDROIDVIDEOTRACKSOURCE_H_ | 12 #define WEBRTC_API_ANDROIDVIDEOTRACKSOURCE_H_ |
| 13 | 13 |
| 14 #include "webrtc/api/android/jni/native_handle_impl.h" | 14 #include "webrtc/api/android/jni/native_handle_impl.h" |
| 15 #include "webrtc/api/android/jni/surfacetexturehelper_jni.h" | 15 #include "webrtc/api/android/jni/surfacetexturehelper_jni.h" |
| 16 #include "webrtc/api/mediastreaminterface.h" | 16 #include "webrtc/api/mediastreaminterface.h" |
| 17 #include "webrtc/api/notifier.h" | 17 #include "webrtc/api/notifier.h" |
| 18 #include "webrtc/base/asyncinvoker.h" | 18 #include "webrtc/base/asyncinvoker.h" |
| 19 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
| 20 #include "webrtc/base/thread_checker.h" | 20 #include "webrtc/base/thread_checker.h" |
| 21 #include "webrtc/base/timestampaligner.h" | 21 #include "webrtc/base/timestampaligner.h" |
| 22 #include "webrtc/common_video/include/i420_buffer_pool.h" | 22 #include "webrtc/common_video/include/i420_buffer_pool.h" |
| 23 #include "webrtc/media/base/videoadapter.h" | 23 #include "webrtc/media/base/videoadapter.h" |
| 24 #include "webrtc/media/base/videobroadcaster.h" | 24 #include "webrtc/media/base/videobroadcaster.h" |
| 25 #include "webrtc/media/base/videosinkinterface.h" | 25 #include "webrtc/media/base/videosinkinterface.h" |
| 26 #include "third_party/libyuv/include/libyuv/convert.h" |
| 26 | 27 |
| 27 namespace webrtc { | 28 namespace webrtc { |
| 28 | 29 |
| 29 class AndroidVideoTrackSource : public Notifier<VideoTrackSourceInterface> { | 30 class AndroidVideoTrackSource : public Notifier<VideoTrackSourceInterface> { |
| 30 public: | 31 public: |
| 31 AndroidVideoTrackSource(rtc::Thread* signaling_thread, | 32 AndroidVideoTrackSource(rtc::Thread* signaling_thread, |
| 32 JNIEnv* jni, | 33 JNIEnv* jni, |
| 33 jobject j_egl_context, | 34 jobject j_egl_context, |
| 34 bool is_screencast = false); | 35 bool is_screencast = false); |
| 35 | 36 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 rtc::ThreadChecker worker_thread_checker_; | 85 rtc::ThreadChecker worker_thread_checker_; |
| 85 rtc::ThreadChecker camera_thread_checker_; | 86 rtc::ThreadChecker camera_thread_checker_; |
| 86 rtc::CriticalSection stats_crit_; | 87 rtc::CriticalSection stats_crit_; |
| 87 rtc::Optional<Stats> stats_ GUARDED_BY(stats_crit_); | 88 rtc::Optional<Stats> stats_ GUARDED_BY(stats_crit_); |
| 88 SourceState state_; | 89 SourceState state_; |
| 89 rtc::VideoBroadcaster broadcaster_; | 90 rtc::VideoBroadcaster broadcaster_; |
| 90 rtc::TimestampAligner timestamp_aligner_; | 91 rtc::TimestampAligner timestamp_aligner_; |
| 91 cricket::VideoAdapter video_adapter_; | 92 cricket::VideoAdapter video_adapter_; |
| 92 rtc::CriticalSection apply_rotation_crit_; | 93 rtc::CriticalSection apply_rotation_crit_; |
| 93 bool apply_rotation_ GUARDED_BY(apply_rotation_crit_); | 94 bool apply_rotation_ GUARDED_BY(apply_rotation_crit_); |
| 94 std::vector<uint8_t> unscaled_uv_planes_; | 95 webrtc::I420BufferPool pre_scale_pool_; |
| 95 webrtc::I420BufferPool buffer_pool_; | 96 webrtc::I420BufferPool post_scale_pool_; |
| 96 rtc::scoped_refptr<webrtc_jni::SurfaceTextureHelper> surface_texture_helper_; | 97 rtc::scoped_refptr<webrtc_jni::SurfaceTextureHelper> surface_texture_helper_; |
| 97 const bool is_screencast_; | 98 const bool is_screencast_; |
| 98 | 99 |
| 99 void OnFrame(const cricket::VideoFrame& frame, int width, int height); | 100 void OnFrame(const cricket::VideoFrame& frame, int width, int height); |
| 100 | 101 |
| 101 void OnSinkWantsChanged(const rtc::VideoSinkWants& wants); | 102 void OnSinkWantsChanged(const rtc::VideoSinkWants& wants); |
| 102 | 103 |
| 103 bool AdaptFrame(int width, | 104 bool AdaptFrame(int width, |
| 104 int height, | 105 int height, |
| 105 int64_t camera_time_us, | 106 int64_t camera_time_us, |
| 106 int* out_width, | 107 int* out_width, |
| 107 int* out_height, | 108 int* out_height, |
| 108 int* crop_width, | 109 int* crop_width, |
| 109 int* crop_height, | 110 int* crop_height, |
| 110 int* crop_x, | 111 int* crop_x, |
| 111 int* crop_y, | 112 int* crop_y, |
| 112 int64_t* translated_camera_time_us); | 113 int64_t* translated_camera_time_us); |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 } // namespace webrtc | 116 } // namespace webrtc |
| 116 | 117 |
| 117 #endif // WEBRTC_API_ANDROIDVIDEOTRACKSOURCE_H_ | 118 #endif // WEBRTC_API_ANDROIDVIDEOTRACKSOURCE_H_ |
| OLD | NEW |