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

Decouple camera and encoding


Signed-off-by: default avatarLeo Ma <begeekmyfriend@gmail.com>
parent a3603909
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -218,7 +218,7 @@ public class SrsCameraView extends GLSurfaceView implements GLSurfaceView.Render
return mCamId;
}
 
private void enableEncoding() {
public void enableEncoding() {
worker = new Thread(new Runnable() {
@Override
public void run() {
Loading
Loading
@@ -244,7 +244,7 @@ public class SrsCameraView extends GLSurfaceView implements GLSurfaceView.Render
mIsEncoding = true;
}
 
private void disableEncoding() {
public void disableEncoding() {
mIsEncoding = false;
mGLIntBufferCache.clear();
 
Loading
Loading
@@ -268,8 +268,6 @@ public class SrsCameraView extends GLSurfaceView implements GLSurfaceView.Render
}
}
 
enableEncoding();
Camera.Parameters params = mCamera.getParameters();
 
List<String> supportedFocusModes = params.getSupportedFocusModes();
Loading
Loading
Loading
Loading
@@ -139,6 +139,8 @@ public class SrsPublisher {
return;
}
mCameraView.enableEncoding();
startAudio();
}
Loading
Loading
@@ -248,16 +250,14 @@ public class SrsPublisher {
}
public void switchCameraFace(int id) {
if (mEncoder.isEnabled()) {
mCameraView.stopCamera();
mCameraView.setCameraId(id);
if (id == 0) {
mEncoder.setCameraBackFace();
} else {
mEncoder.setCameraFrontFace();
}
mCameraView.startCamera();
mCameraView.stopCamera();
mCameraView.setCameraId(id);
if (id == 0) {
mEncoder.setCameraBackFace();
} else {
mEncoder.setCameraFrontFace();
}
mCameraView.startCamera();
}
public void setRtmpHandler(RtmpHandler handler) {
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