Skip to content

Commit 3ccd2fc

Browse files
authored
Merge pull request #83 from ChillingVan/dev
Dev
2 parents 1cc5ca2 + 4b185c6 commit 3ccd2fc

File tree

14 files changed

+326
-17
lines changed

14 files changed

+326
-17
lines changed

README-en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ allprojects {
4343
4444
// module build.gradle
4545
dependencies {
46-
implementation 'com.github.ChillingVan:android-openGL-canvas:v1.5.0.0'
46+
implementation 'com.github.ChillingVan:android-openGL-canvas:v1.5.1.0'
4747
}
4848
```
4949

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ allprojects {
4848
4949
// module build.gradle
5050
dependencies {
51-
implementation 'com.github.ChillingVan:android-openGL-canvas:v1.5.0.0'
51+
implementation 'com.github.ChillingVan:android-openGL-canvas:v1.5.1.0'
5252
}
5353
```
5454

canvasgl/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
apply plugin: 'com.android.library'
2222
apply plugin: 'com.github.dcendents.android-maven'
2323
group='com.github.ChillingVan'
24-
def VERSION_NAME="1.5.0.0"
24+
def VERSION_NAME="1.5.1.0"
2525

2626
android {
2727
compileSdkVersion 28

canvasgl/src/main/java/com/chillingvan/canvasgl/glview/texture/BaseGLTextureView.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ abstract class BaseGLTextureView extends TextureView implements TextureView.Surf
5858
private SurfaceTextureListener surfaceTextureListener;
5959
private GLThread.OnCreateGLContextListener onCreateGLContextListener;
6060

61-
private boolean hasCreateGLThreadCalledOnce = false;
6261
private boolean surfaceAvailable = false;
6362
private GLViewRenderer renderer;
6463

@@ -136,7 +135,6 @@ protected void surfaceDestroyed() {
136135
mGLThread.surfaceDestroyed();
137136
mGLThread.requestExitAndWait();
138137
}
139-
hasCreateGLThreadCalledOnce = false;
140138
surfaceAvailable = false;
141139
mGLThread = null;
142140
}
@@ -215,9 +213,7 @@ public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int hei
215213
glThreadBuilder.setRenderMode(getRenderMode())
216214
.setSurface(surface)
217215
.setRenderer(renderer);
218-
if (hasCreateGLThreadCalledOnce) {
219-
createGLThread();
220-
}
216+
createGLThread();
221217

222218
} else {
223219
mGLThread.setSurface(surface);
@@ -230,7 +226,6 @@ public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int hei
230226

231227
protected void createGLThread() {
232228
Loggers.d(TAG, "createGLThread: ");
233-
hasCreateGLThreadCalledOnce = true;
234229
if (!surfaceAvailable) {
235230
return;
236231
}

canvasgl/src/main/java/com/chillingvan/canvasgl/glview/texture/GLMultiTexConsumerView.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@
3232

3333
/**
3434
* This class is used to accept eglContext and textures from outside. Then it can use them to draw.
35+
* The {@link #setSharedEglContext} must be called as the precondition to consume outside texture.
3536
*/
3637
public abstract class GLMultiTexConsumerView extends BaseGLCanvasTextureView {
3738

3839
protected List<GLTexture> consumedTextures = new ArrayList<>();
3940

41+
protected EglContextWrapper mSharedEglContext;
42+
4043
public GLMultiTexConsumerView(Context context) {
4144
super(context);
4245
}
@@ -53,13 +56,20 @@ public GLMultiTexConsumerView(Context context, AttributeSet attrs, int defStyleA
5356
* @param sharedEglContext The openGL context from other or {@link EglContextWrapper#EGL_NO_CONTEXT_WRAPPER}
5457
*/
5558
public void setSharedEglContext(EglContextWrapper sharedEglContext) {
59+
mSharedEglContext = sharedEglContext;
5660
glThreadBuilder.setSharedEglContext(sharedEglContext);
5761
createGLThread();
5862
}
5963

64+
@Override
65+
protected void createGLThread() {
66+
if (mSharedEglContext != null) {
67+
super.createGLThread();
68+
}
69+
}
6070

6171
/**
62-
*
72+
* This must be called for a GLMultiTexConsumerView.
6373
* @param glTexture texture from outSide.
6474
*/
6575
public void addConsumeGLTexture(GLTexture glTexture) {

canvasgl/src/main/java/com/chillingvan/canvasgl/glview/texture/GLMultiTexProducerView.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
* This will not create {@link GLThread} automatically. You need to call {@link #setSharedEglContext(EglContextWrapper)} to trigger it.
4242
* Support providing multiple textures to Camera or Media. <br>
4343
* This can also consume textures from other GL zone( Should be in same GL context) <br>
44+
* And since this inherits {@link GLMultiTexConsumerView}, the {@link #setSharedEglContext} must be called
4445
*/
4546
public abstract class GLMultiTexProducerView extends GLMultiTexConsumerView {
4647
private static final String TAG = "GLMultiTexProducerView";

canvasgl/src/main/java/com/chillingvan/canvasgl/glview/texture/GLSurfaceTextureProducerView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected final int getInitialTexCount() {
6262
@Override
6363
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
6464
super.onSurfaceTextureAvailable(surface, width, height);
65-
if (mGLThread == null) {
65+
if (mSharedEglContext == null) {
6666
setSharedEglContext(EglContextWrapper.EGL_NO_CONTEXT_WRAPPER);
6767
}
6868
}

canvasglsample/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ android {
2828
applicationId "com.chillingvan.canvasglsample"
2929
minSdkVersion 15
3030
targetSdkVersion 28
31-
versionCode 9
32-
versionName "1.5.0.0"
31+
versionCode 10
32+
versionName "1.5.1.0"
3333

3434
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3535

canvasglsample/src/main/AndroidManifest.xml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
<manifest package="com.chillingvan.canvasglsample"
33
xmlns:android="http://schemas.android.com/apk/res/android">
44

5+
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7+
<uses-permission android:name="android.permission.CAMERA" />
8+
59
<application
610
android:name=".MainApplication"
711
android:allowBackup="true"
@@ -162,9 +166,15 @@
162166
<category android:name="com.chillingvan.canvasglsample" />
163167
</intent-filter>
164168
</activity>
165-
</application>
166-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
169+
<activity android:name=".screenRecord.ScreenRecordActivity"
170+
android:label="ScreenRecordActivity"
171+
>
172+
<intent-filter>
173+
<action android:name="android.intent.action.MAIN" />
167174

168-
<uses-permission android:name="android.permission.CAMERA" />
175+
<category android:name="com.chillingvan.canvasglsample" />
176+
</intent-filter>
177+
</activity>
178+
</application>
169179

170180
</manifest>

canvasglsample/src/main/java/com/chillingvan/canvasglsample/multi/MultiVideoTexture.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public MultiVideoTexture(Context context, AttributeSet attrs, int defStyleAttr)
3737
@Override
3838
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
3939
super.onSurfaceTextureAvailable(surface, width, height);
40-
if (mGLThread == null) {
40+
if (mSharedEglContext == null) {
4141
setSharedEglContext(EglContextWrapper.EGL_NO_CONTEXT_WRAPPER);
4242
}
4343
}

0 commit comments

Comments
 (0)