-
-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) Use 4:3 video aspect ratio to prevent cropping to 16:9 2) Disable EIS 3) Zoom out
- Loading branch information
1 parent
6a0605b
commit 58d1de9
Showing
5 changed files
with
454 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.webrtc; | ||
|
||
import android.content.Context; | ||
import android.hardware.camera2.CameraManager; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class ExtCamera2Capturer extends Camera2Capturer { | ||
|
||
@Nullable private final CameraManager cameraManager; | ||
private final boolean disableEIS, zoomOut; | ||
|
||
public ExtCamera2Capturer(Context context, String cameraName, CameraEventsHandler eventsHandler, | ||
boolean disableEIS, boolean zoomOut) { | ||
super(context, cameraName, eventsHandler); | ||
cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE); | ||
this.disableEIS = disableEIS; | ||
this.zoomOut = zoomOut; | ||
} | ||
|
||
@Override | ||
protected void createCameraSession(CameraSession.CreateSessionCallback createSessionCallback, | ||
CameraSession.Events events, Context applicationContext, | ||
SurfaceTextureHelper surfaceTextureHelper, String cameraName, int width, int height, | ||
int framerate) { | ||
|
||
CameraSession.CreateSessionCallback myCallback = new CameraSession.CreateSessionCallback() { | ||
@Override | ||
public void onDone(CameraSession cameraSession) { | ||
createSessionCallback.onDone(cameraSession); | ||
} | ||
|
||
@Override | ||
public void onFailure(CameraSession.FailureType failureType, String s) { | ||
createSessionCallback.onFailure(failureType, s); | ||
} | ||
}; | ||
|
||
ExtCamera2Session.create(myCallback, events, applicationContext, cameraManager, | ||
surfaceTextureHelper, cameraName, width, height, framerate, disableEIS, zoomOut); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.webrtc; | ||
|
||
import android.content.Context; | ||
import android.hardware.camera2.CameraManager; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class ExtCamera2Enumerator extends Camera2Enumerator { | ||
|
||
final Context context; | ||
@Nullable final CameraManager cameraManager; | ||
private final boolean disableEIS, zoomOut; | ||
|
||
public ExtCamera2Enumerator(Context context, boolean disableEIS, boolean zoomOut) { | ||
super(context); | ||
this.context = context; | ||
this.disableEIS = disableEIS; | ||
this.zoomOut = zoomOut; | ||
this.cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE); | ||
} | ||
|
||
@Override | ||
public CameraVideoCapturer createCapturer(String deviceName, | ||
CameraVideoCapturer.CameraEventsHandler eventsHandler) { | ||
return new ExtCamera2Capturer(context, deviceName, eventsHandler, disableEIS, zoomOut); | ||
} | ||
} |
Oops, something went wrong.