OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // of AndroidVideoCapturerJni. | 99 // of AndroidVideoCapturerJni. |
100 jobject surface_texture_helper_; | 100 jobject surface_texture_helper_; |
101 rtc::Callback0<void> no_longer_used_cb_; | 101 rtc::Callback0<void> no_longer_used_cb_; |
102 }; | 102 }; |
103 | 103 |
104 class AndroidVideoBuffer : public AndroidVideoFrameBuffer { | 104 class AndroidVideoBuffer : public AndroidVideoFrameBuffer { |
105 public: | 105 public: |
106 AndroidVideoBuffer(JNIEnv* jni, | 106 AndroidVideoBuffer(JNIEnv* jni, |
107 jmethodID j_retain_id, | 107 jmethodID j_retain_id, |
108 jmethodID j_release_id, | 108 jmethodID j_release_id, |
109 int width, | 109 jmethodID j_get_width_id, |
110 int height, | 110 jmethodID j_get_height_id, |
111 const Matrix& matrix, | |
112 jobject j_video_frame_buffer); | 111 jobject j_video_frame_buffer); |
113 ~AndroidVideoBuffer() override; | 112 ~AndroidVideoBuffer() override; |
114 | 113 |
115 jobject video_frame_buffer() const; | 114 jobject video_frame_buffer() const; |
116 | 115 |
117 // Returns an instance of VideoRenderer.I420Frame (deprecated) | 116 // Returns an instance of VideoRenderer.I420Frame (deprecated) |
118 jobject ToJavaI420Frame(JNIEnv* jni, int width, int height, int rotation); | 117 jobject ToJavaI420Frame(JNIEnv* jni, int rotation); |
119 | 118 |
120 private: | 119 private: |
121 Type type() const override; | 120 Type type() const override; |
122 int width() const override; | 121 int width() const override; |
123 int height() const override; | 122 int height() const override; |
124 | 123 |
125 rtc::scoped_refptr<webrtc::I420BufferInterface> ToI420() override; | 124 rtc::scoped_refptr<webrtc::I420BufferInterface> ToI420() override; |
126 | 125 |
127 AndroidType android_type() override { return AndroidType::kJavaBuffer; } | 126 AndroidType android_type() override { return AndroidType::kJavaBuffer; } |
128 | 127 |
129 const jmethodID j_release_id_; | 128 const jmethodID j_release_id_; |
130 const int width_; | 129 const jmethodID j_get_width_id_; |
131 const int height_; | 130 const jmethodID j_get_height_id_; |
132 const Matrix matrix_; | |
133 // Holds a VideoFrame.Buffer. | 131 // Holds a VideoFrame.Buffer. |
134 ScopedGlobalRef<jobject> j_video_frame_buffer_; | 132 ScopedGlobalRef<jobject> j_video_frame_buffer_; |
135 }; | 133 }; |
136 | 134 |
137 class AndroidVideoBufferFactory { | 135 class AndroidVideoBufferFactory { |
138 public: | 136 public: |
139 explicit AndroidVideoBufferFactory(JNIEnv* jni); | 137 explicit AndroidVideoBufferFactory(JNIEnv* jni); |
140 | 138 |
141 webrtc::VideoFrame CreateFrame(JNIEnv* jni, | 139 webrtc::VideoFrame CreateFrame(JNIEnv* jni, |
142 jobject j_video_frame, | 140 jobject j_video_frame, |
143 uint32_t timestamp_rtp) const; | 141 uint32_t timestamp_rtp) const; |
144 | 142 |
145 rtc::scoped_refptr<AndroidVideoBuffer> CreateBuffer( | 143 rtc::scoped_refptr<AndroidVideoBuffer> CreateBuffer( |
146 int width, | |
147 int height, | |
148 const Matrix& matrix, | |
149 jobject j_video_frame_buffer) const; | 144 jobject j_video_frame_buffer) const; |
150 | 145 |
151 private: | 146 private: |
152 ScopedGlobalRef<jclass> j_video_frame_class_; | 147 ScopedGlobalRef<jclass> j_video_frame_class_; |
153 jmethodID j_get_buffer_id_; | 148 jmethodID j_get_buffer_id_; |
154 jmethodID j_get_width_id_; | |
155 jmethodID j_get_height_id_; | |
156 jmethodID j_get_rotation_id_; | 149 jmethodID j_get_rotation_id_; |
157 jmethodID j_get_transform_matrix_id_; | |
158 jmethodID j_get_timestamp_ns_id_; | 150 jmethodID j_get_timestamp_ns_id_; |
159 | 151 |
160 ScopedGlobalRef<jclass> j_video_frame_buffer_class_; | 152 ScopedGlobalRef<jclass> j_video_frame_buffer_class_; |
161 jmethodID j_retain_id_; | 153 jmethodID j_retain_id_; |
162 jmethodID j_release_id_; | 154 jmethodID j_release_id_; |
| 155 jmethodID j_get_width_id_; |
| 156 jmethodID j_get_height_id_; |
163 }; | 157 }; |
164 | 158 |
165 } // namespace webrtc_jni | 159 } // namespace webrtc_jni |
166 | 160 |
167 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_NATIVE_HANDLE_IMPL_H_ | 161 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_NATIVE_HANDLE_IMPL_H_ |
OLD | NEW |