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

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

Issue 2991633002: Implement AndroidVideoBuffer::ToI420. (Closed)
Patch Set: Cache values. 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 int width, 108 int width,
110 int height, 109 int height,
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 private:
124 rtc::scoped_refptr<webrtc::I420BufferInterface> ToI420() override; 123 rtc::scoped_refptr<webrtc::I420BufferInterface> ToI420() override;
125 124
126 AndroidType android_type() override { return AndroidType::kJavaBuffer; } 125 AndroidType android_type() override { return AndroidType::kJavaBuffer; }
127 126
128 const jmethodID j_release_id_; 127 const jmethodID j_release_id_;
129 const int width_; 128 const int width_;
130 const int height_; 129 const int height_;
131 // Holds a VideoFrame.Buffer. 130 const ScopedGlobalRef<jobject> j_video_frame_buffer_;
magjed_webrtc 2017/07/28 09:45:05 Keep this comment.
sakal 2017/07/28 11:08:49 Done.
132 ScopedGlobalRef<jobject> j_video_frame_buffer_;
133 }; 131 };
134 132
135 class AndroidVideoBufferFactory { 133 class AndroidVideoBufferFactory {
136 public: 134 public:
137 explicit AndroidVideoBufferFactory(JNIEnv* jni); 135 explicit AndroidVideoBufferFactory(JNIEnv* jni);
138 136
139 webrtc::VideoFrame CreateFrame(JNIEnv* jni, 137 webrtc::VideoFrame CreateFrame(JNIEnv* jni,
140 jobject j_video_frame, 138 jobject j_video_frame,
141 uint32_t timestamp_rtp) const; 139 uint32_t timestamp_rtp) const;
142 140
143 rtc::scoped_refptr<AndroidVideoBuffer> CreateBuffer( 141 rtc::scoped_refptr<AndroidVideoBuffer> CreateBuffer(
144 jobject j_video_frame_buffer) const; 142 jobject j_video_frame_buffer) const;
145 143
146 private: 144 private:
147 ScopedGlobalRef<jclass> j_video_frame_class_; 145 ScopedGlobalRef<jclass> j_video_frame_class_;
148 jmethodID j_get_buffer_id_; 146 jmethodID j_get_buffer_id_;
149 jmethodID j_get_rotation_id_; 147 jmethodID j_get_rotation_id_;
150 jmethodID j_get_timestamp_ns_id_; 148 jmethodID j_get_timestamp_ns_id_;
151 149
152 ScopedGlobalRef<jclass> j_video_frame_buffer_class_; 150 ScopedGlobalRef<jclass> j_video_frame_buffer_class_;
153 jmethodID j_retain_id_; 151 jmethodID j_retain_id_;
154 jmethodID j_release_id_; 152 jmethodID j_release_id_;
155 jmethodID j_get_width_id_; 153 jmethodID j_get_width_id_;
156 jmethodID j_get_height_id_; 154 jmethodID j_get_height_id_;
157 }; 155 };
158 156
159 } // namespace webrtc_jni 157 } // namespace webrtc_jni
160 158
161 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_NATIVE_HANDLE_IMPL_H_ 159 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_NATIVE_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698