Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: webrtc/sdk/android/src/jni/native_handle_impl.h

Issue 2991633002: Implement AndroidVideoBuffer::ToI420. (Closed)
Patch Set: Rebase on top of remove-matrix. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // a global reference. TODO(nisse): Make this a reference to the C++ 97 // a global reference. TODO(nisse): Make this a reference to the C++
98 // SurfaceTextureHelper instead, but that requires some refactoring 98 // SurfaceTextureHelper instead, but that requires some refactoring
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,
108 jmethodID j_release_id, 107 jmethodID j_release_id,
109 jmethodID j_get_width_id, 108 jmethodID j_get_width_id,
110 jmethodID j_get_height_id, 109 jmethodID j_get_height_id,
111 jobject j_video_frame_buffer); 110 jobject j_video_frame_buffer);
112 ~AndroidVideoBuffer() override; 111 ~AndroidVideoBuffer() override;
113 112
114 jobject video_frame_buffer() const; 113 jobject video_frame_buffer() const;
115 114
116 // Returns an instance of VideoRenderer.I420Frame (deprecated) 115 // Returns an instance of VideoRenderer.I420Frame (deprecated)
117 jobject ToJavaI420Frame(JNIEnv* jni, int rotation); 116 jobject ToJavaI420Frame(JNIEnv* jni, int rotation);
118 117
119 private:
120 Type type() const override; 118 Type type() const override;
121 int width() const override; 119 int width() const override;
122 int height() const override; 120 int height() const override;
123 121
122 protected:
123 // Holds a VideoFrame.Buffer.
124 const ScopedGlobalRef<jobject> j_video_frame_buffer_;
125
126 private:
124 rtc::scoped_refptr<webrtc::I420BufferInterface> ToI420() override; 127 rtc::scoped_refptr<webrtc::I420BufferInterface> ToI420() override;
125 128
126 AndroidType android_type() override { return AndroidType::kJavaBuffer; } 129 AndroidType android_type() override { return AndroidType::kJavaBuffer; }
127 130
128 const jmethodID j_release_id_; 131 const jmethodID j_release_id_;
129 const jmethodID j_get_width_id_; 132 const jmethodID j_get_width_id_;
130 const jmethodID j_get_height_id_; 133 const jmethodID j_get_height_id_;
131 // Holds a VideoFrame.Buffer.
132 ScopedGlobalRef<jobject> j_video_frame_buffer_;
133 }; 134 };
134 135
135 class AndroidVideoBufferFactory { 136 class AndroidVideoBufferFactory {
136 public: 137 public:
137 explicit AndroidVideoBufferFactory(JNIEnv* jni); 138 explicit AndroidVideoBufferFactory(JNIEnv* jni);
138 139
139 webrtc::VideoFrame CreateFrame(JNIEnv* jni, 140 webrtc::VideoFrame CreateFrame(JNIEnv* jni,
140 jobject j_video_frame, 141 jobject j_video_frame,
141 uint32_t timestamp_rtp) const; 142 uint32_t timestamp_rtp) const;
142 143
143 rtc::scoped_refptr<AndroidVideoBuffer> CreateBuffer( 144 rtc::scoped_refptr<AndroidVideoBuffer> CreateBuffer(
144 jobject j_video_frame_buffer) const; 145 jobject j_video_frame_buffer) const;
145 146
146 private: 147 private:
147 ScopedGlobalRef<jclass> j_video_frame_class_; 148 ScopedGlobalRef<jclass> j_video_frame_class_;
148 jmethodID j_get_buffer_id_; 149 jmethodID j_get_buffer_id_;
149 jmethodID j_get_rotation_id_; 150 jmethodID j_get_rotation_id_;
150 jmethodID j_get_timestamp_ns_id_; 151 jmethodID j_get_timestamp_ns_id_;
151 152
152 ScopedGlobalRef<jclass> j_video_frame_buffer_class_; 153 ScopedGlobalRef<jclass> j_video_frame_buffer_class_;
153 jmethodID j_retain_id_; 154 jmethodID j_retain_id_;
154 jmethodID j_release_id_; 155 jmethodID j_release_id_;
155 jmethodID j_get_width_id_; 156 jmethodID j_get_width_id_;
156 jmethodID j_get_height_id_; 157 jmethodID j_get_height_id_;
157 }; 158 };
158 159
159 } // namespace webrtc_jni 160 } // namespace webrtc_jni
160 161
161 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_NATIVE_HANDLE_IMPL_H_ 162 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_NATIVE_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698