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

Side by Side Diff: webrtc/api/java/jni/surfacetexturehelper_jni.cc

Issue 1783793002: VideoCapturer: Update interface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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
11 11
12 #include "webrtc/api/java/jni/surfacetexturehelper_jni.h" 12 #include "webrtc/api/java/jni/surfacetexturehelper_jni.h"
13 13
14 #include "webrtc/api/java/jni/classreferenceholder.h" 14 #include "webrtc/api/java/jni/classreferenceholder.h"
15 #include "webrtc/base/bind.h" 15 #include "webrtc/base/bind.h"
16 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
17 17
18 namespace webrtc_jni { 18 namespace webrtc_jni {
19 19
20 SurfaceTextureHelper::SurfaceTextureHelper( 20 SurfaceTextureHelper::SurfaceTextureHelper(
21 JNIEnv* jni, jobject surface_texture_helper) 21 JNIEnv* jni, jobject j_egl_context)
22 : j_surface_texture_helper_(jni, surface_texture_helper), 22 : j_surface_texture_helper_(jni, jni->CallStaticObjectMethod(
23 FindClass(jni, "org/webrtc/SurfaceTextureHelper"),
24 GetStaticMethodID(jni,
25 FindClass(jni, "org/webrtc/SurfaceTextureHelper"),
26 "create",
27 "(Lorg/webrtc/EglBase$Context;)"
28 "Lorg/webrtc/SurfaceTextureHelper;"),
29 j_egl_context)),
23 j_return_texture_method_( 30 j_return_texture_method_(
24 GetMethodID(jni, 31 GetMethodID(jni,
25 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), 32 FindClass(jni, "org/webrtc/SurfaceTextureHelper"),
26 "returnTextureFrame", 33 "returnTextureFrame",
27 "()V")) { 34 "()V")) {
28 CHECK_EXCEPTION(jni) << "error during initialization of SurfaceTextureHelper"; 35 CHECK_EXCEPTION(jni) << "error during initialization of SurfaceTextureHelper";
29 } 36 }
30 37
31 SurfaceTextureHelper::~SurfaceTextureHelper() { 38 SurfaceTextureHelper::~SurfaceTextureHelper() {
32 } 39 }
33 40
41 jobject SurfaceTextureHelper::GetJavaSurfaceTextureHelper() const {
42 return *j_surface_texture_helper_;
43 }
44
34 void SurfaceTextureHelper::ReturnTextureFrame() const { 45 void SurfaceTextureHelper::ReturnTextureFrame() const {
35 JNIEnv* jni = AttachCurrentThreadIfNeeded(); 46 JNIEnv* jni = AttachCurrentThreadIfNeeded();
36 jni->CallVoidMethod(*j_surface_texture_helper_, j_return_texture_method_); 47 jni->CallVoidMethod(*j_surface_texture_helper_, j_return_texture_method_);
37 48
38 CHECK_EXCEPTION( 49 CHECK_EXCEPTION(
39 jni) << "error during SurfaceTextureHelper.returnTextureFrame"; 50 jni) << "error during SurfaceTextureHelper.returnTextureFrame";
40 } 51 }
41 52
42 rtc::scoped_refptr<webrtc::VideoFrameBuffer> 53 rtc::scoped_refptr<webrtc::VideoFrameBuffer>
43 SurfaceTextureHelper::CreateTextureFrame(int width, int height, 54 SurfaceTextureHelper::CreateTextureFrame(int width, int height,
44 const NativeHandleImpl& native_handle) { 55 const NativeHandleImpl& native_handle) {
45 return new rtc::RefCountedObject<AndroidTextureBuffer>( 56 return new rtc::RefCountedObject<AndroidTextureBuffer>(
46 width, height, native_handle, *j_surface_texture_helper_, 57 width, height, native_handle, *j_surface_texture_helper_,
47 rtc::Bind(&SurfaceTextureHelper::ReturnTextureFrame, this)); 58 rtc::Bind(&SurfaceTextureHelper::ReturnTextureFrame, this));
48 } 59 }
49 60
50 } // namespace webrtc_jni 61 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698