From a5845618bd71ab2ce78929f207017d9a7043f3dc Mon Sep 17 00:00:00 2001 From: WangShuo1143368701 <1143368701@qq.com> Date: Fri, 30 Mar 2018 12:33:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=AC=AC=E4=BA=8C=E6=AC=A1?= =?UTF-8?q?=E5=BD=95=E5=88=B6=E6=97=A0=E7=94=BB=E9=9D=A2=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/me/lake/librestreaming/client/RESClient.java | 4 ++++ .../java/me/lake/librestreaming/client/RESVideoClient.java | 3 +++ .../java/me/lake/librestreaming/core/RESHardVideoCore.java | 4 ++++ .../java/me/lake/librestreaming/core/RESSoftVideoCore.java | 3 +++ .../main/java/me/lake/librestreaming/core/RESVideoCore.java | 3 +++ .../java/me/lake/librestreaming/ws/StreamLiveCameraView.java | 3 ++- 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libWSLive/src/main/java/me/lake/librestreaming/client/RESClient.java b/libWSLive/src/main/java/me/lake/librestreaming/client/RESClient.java index b586734..17d4a05 100644 --- a/libWSLive/src/main/java/me/lake/librestreaming/client/RESClient.java +++ b/libWSLive/src/main/java/me/lake/librestreaming/client/RESClient.java @@ -517,6 +517,10 @@ public void setMirror(boolean isEnableMirror,boolean isEnablePreviewMirror,boole videoClient.setMirror(isEnableMirror,isEnablePreviewMirror,isEnableStreamMirror); } + public void setNeedResetEglContext(boolean bol){ + videoClient.setNeedResetEglContext(bol); + } + static { System.loadLibrary("restreaming"); } diff --git a/libWSLive/src/main/java/me/lake/librestreaming/client/RESVideoClient.java b/libWSLive/src/main/java/me/lake/librestreaming/client/RESVideoClient.java index 26b5ac6..1032272 100644 --- a/libWSLive/src/main/java/me/lake/librestreaming/client/RESVideoClient.java +++ b/libWSLive/src/main/java/me/lake/librestreaming/client/RESVideoClient.java @@ -460,4 +460,7 @@ public void setVideoEncoder(final MediaVideoEncoder encoder) { public void setMirror(boolean isEnableMirror,boolean isEnablePreviewMirror,boolean isEnableStreamMirror) { videoCore.setMirror(isEnableMirror,isEnablePreviewMirror,isEnableStreamMirror); } + public void setNeedResetEglContext(boolean bol){ + videoCore.setNeedResetEglContext(bol); + } } diff --git a/libWSLive/src/main/java/me/lake/librestreaming/core/RESHardVideoCore.java b/libWSLive/src/main/java/me/lake/librestreaming/core/RESHardVideoCore.java index f441ec0..857da22 100644 --- a/libWSLive/src/main/java/me/lake/librestreaming/core/RESHardVideoCore.java +++ b/libWSLive/src/main/java/me/lake/librestreaming/core/RESHardVideoCore.java @@ -877,5 +877,9 @@ private void processStMatrix(float[] matrix, boolean needMirror) { return; } + + public void setNeedResetEglContext(boolean bol){ + mNeedResetEglContext = bol; + } //encoder mp4 end } diff --git a/libWSLive/src/main/java/me/lake/librestreaming/core/RESSoftVideoCore.java b/libWSLive/src/main/java/me/lake/librestreaming/core/RESSoftVideoCore.java index 5db68f6..ab4e3b2 100644 --- a/libWSLive/src/main/java/me/lake/librestreaming/core/RESSoftVideoCore.java +++ b/libWSLive/src/main/java/me/lake/librestreaming/core/RESSoftVideoCore.java @@ -548,5 +548,8 @@ public void setVideoEncoder(final MediaVideoEncoder encoder) { @Override public void setMirror(boolean isEnableMirror, boolean isEnablePreviewMirror, boolean isEnableStreamMirror) { + } + public void setNeedResetEglContext(boolean bol){ + } } diff --git a/libWSLive/src/main/java/me/lake/librestreaming/core/RESVideoCore.java b/libWSLive/src/main/java/me/lake/librestreaming/core/RESVideoCore.java index c370136..5e2f0a0 100644 --- a/libWSLive/src/main/java/me/lake/librestreaming/core/RESVideoCore.java +++ b/libWSLive/src/main/java/me/lake/librestreaming/core/RESVideoCore.java @@ -47,4 +47,7 @@ public interface RESVideoCore { void setVideoEncoder(final MediaVideoEncoder encoder); void setMirror(boolean isEnableMirror,boolean isEnablePreviewMirror,boolean isEnableStreamMirror); + void setNeedResetEglContext(boolean bol); + + } diff --git a/libWSLive/src/main/java/me/lake/librestreaming/ws/StreamLiveCameraView.java b/libWSLive/src/main/java/me/lake/librestreaming/ws/StreamLiveCameraView.java index 372a7c6..23b4982 100644 --- a/libWSLive/src/main/java/me/lake/librestreaming/ws/StreamLiveCameraView.java +++ b/libWSLive/src/main/java/me/lake/librestreaming/ws/StreamLiveCameraView.java @@ -152,6 +152,7 @@ public void stopStreaming(){ private boolean isRecord = false; public void startRecord(){ if(resClient != null){ + resClient.setNeedResetEglContext(true); try { mMuxer = new MediaMuxerWrapper(".mp4"); // if you record audio only, ".m4a" is also OK. new MediaVideoEncoder(mMuxer, mMediaEncoderListener, StreamAVOption.recordVideoWidth, StreamAVOption.recordVideoHeight); @@ -385,7 +386,7 @@ public void onSurfaceTextureUpdated(SurfaceTexture surface) { /** * callback methods from encoder */ - private final MediaEncoder.MediaEncoderListener mMediaEncoderListener = new MediaEncoder.MediaEncoderListener() { + MediaEncoder.MediaEncoderListener mMediaEncoderListener = new MediaEncoder.MediaEncoderListener() { @Override public void onPrepared(final MediaEncoder encoder) { if (encoder instanceof MediaVideoEncoder && resClient != null)