Skip to content
Snippets Groups Projects
Commit a50396c5 authored by Leo Ma's avatar Leo Ma
Browse files

Clear frame cache before close consumer thread


Signed-off-by: default avatarLeo Ma <begeekmyfriend@gmail.com>
parent 3b5892e8
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -37,6 +37,7 @@ public class SrsCameraView extends GLSurfaceView implements GLSurfaceView.Render
private int mSurfaceHeight;
private int mPreviewWidth;
private int mPreviewHeight;
private boolean mIsEncoding;
private float mInputAspectRatio;
private float mOutputAspectRatio;
private float[] mProjectionMatrix = new float[16];
Loading
Loading
@@ -122,7 +123,7 @@ public class SrsCameraView extends GLSurfaceView implements GLSurfaceView.Render
magicFilter.setTextureTransformMatrix(mTransformMatrix);
magicFilter.onDrawFrame(mOESTextureId);
 
if (worker != null) {
if (mIsEncoding) {
mGLIntBufferCache.add(magicFilter.getGLFboBuffer());
synchronized (writeLock) {
writeLock.notifyAll();
Loading
Loading
@@ -240,9 +241,13 @@ public class SrsCameraView extends GLSurfaceView implements GLSurfaceView.Render
}
});
worker.start();
mIsEncoding = true;
}
 
public void disableEncoding() {
mIsEncoding = false;
mGLIntBufferCache.clear();
if (worker != null) {
worker.interrupt();
try {
Loading
Loading
@@ -251,7 +256,6 @@ public class SrsCameraView extends GLSurfaceView implements GLSurfaceView.Render
e.printStackTrace();
worker.interrupt();
}
mGLIntBufferCache.clear();
worker = null;
}
}
Loading
Loading
Loading
Loading
@@ -200,6 +200,7 @@ public class SrsFlvMuxer {
* stop the muxer, disconnect RTMP connection.
*/
public void stop() {
mFlvTagCache.clear();
if (worker != null) {
worker.interrupt();
try {
Loading
Loading
@@ -208,7 +209,6 @@ public class SrsFlvMuxer {
e.printStackTrace();
worker.interrupt();
}
mFlvTagCache.clear();
worker = null;
}
flv.reset();
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment