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

Side by Side Diff: talk/app/webrtc/java/jni/surfacetexturehelper_jni.cc

Issue 1395543004: Android SurfaceTextureHelper: Replace API 21 with API 11 version of setOnFrameAvailableListener() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Construct the SurfaceTexture on the handler thread instead Created 5 years, 2 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
« no previous file with comments | « talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 private: 57 private:
58 NativeHandleImpl native_handle_; 58 NativeHandleImpl native_handle_;
59 const rtc::scoped_refptr<SurfaceTextureHelper> pool_; 59 const rtc::scoped_refptr<SurfaceTextureHelper> pool_;
60 }; 60 };
61 61
62 SurfaceTextureHelper::SurfaceTextureHelper(JNIEnv* jni, 62 SurfaceTextureHelper::SurfaceTextureHelper(JNIEnv* jni,
63 jobject egl_shared_context) 63 jobject egl_shared_context)
64 : j_surface_texture_helper_class_( 64 : j_surface_texture_helper_class_(
65 jni, 65 jni,
66 FindClass(jni, "org/webrtc/SurfaceTextureHelper")), 66 FindClass(jni, "org/webrtc/SurfaceTextureHelper")),
67 j_surface_texture_helper_( 67 j_surface_texture_helper_(jni, jni->CallStaticObjectMethod(
68 jni, 68 *j_surface_texture_helper_class_,
69 jni->NewObject(*j_surface_texture_helper_class_, 69 GetStaticMethodID(
70 GetMethodID(jni, 70 jni,
71 *j_surface_texture_helper_class_, 71 *j_surface_texture_helper_class_,
72 "<init>", 72 "create",
73 "(Landroid/opengl/EGLContext;)V"), 73 "(Landroid/opengl/EGLContext;)Lorg/webrtc/SurfaceTextureHelper;"),
74 egl_shared_context)), 74 egl_shared_context)),
75 j_return_texture_method_( 75 j_return_texture_method_(GetMethodID(jni,
76 GetMethodID(jni, 76 *j_surface_texture_helper_class_,
77 *j_surface_texture_helper_class_, 77 "returnTextureFrame",
78 "returnTextureFrame", 78 "()V")) {
79 "()V")) {
80 CHECK_EXCEPTION(jni) << "error during initialization of SurfaceTextureHelper"; 79 CHECK_EXCEPTION(jni) << "error during initialization of SurfaceTextureHelper";
81 } 80 }
82 81
83 SurfaceTextureHelper::~SurfaceTextureHelper() { 82 SurfaceTextureHelper::~SurfaceTextureHelper() {
84 } 83 }
85 84
86 void SurfaceTextureHelper::ReturnTextureFrame() const { 85 void SurfaceTextureHelper::ReturnTextureFrame() const {
87 JNIEnv* jni = AttachCurrentThreadIfNeeded(); 86 JNIEnv* jni = AttachCurrentThreadIfNeeded();
88 jni->CallVoidMethod(*j_surface_texture_helper_, j_return_texture_method_); 87 jni->CallVoidMethod(*j_surface_texture_helper_, j_return_texture_method_);
89 88
90 CHECK_EXCEPTION( 89 CHECK_EXCEPTION(
91 jni) << "error during SurfaceTextureHelper.returnTextureFrame"; 90 jni) << "error during SurfaceTextureHelper.returnTextureFrame";
92 } 91 }
93 92
94 rtc::scoped_refptr<webrtc::VideoFrameBuffer> 93 rtc::scoped_refptr<webrtc::VideoFrameBuffer>
95 SurfaceTextureHelper::CreateTextureFrame(int width, int height, 94 SurfaceTextureHelper::CreateTextureFrame(int width, int height,
96 const NativeHandleImpl& native_handle) { 95 const NativeHandleImpl& native_handle) {
97 return new rtc::RefCountedObject<TextureBuffer>( 96 return new rtc::RefCountedObject<TextureBuffer>(
98 width, height, this, native_handle); 97 width, height, this, native_handle);
99 } 98 }
100 99
101 } // namespace webrtc_jni 100 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698