Portrait and landscape resolution setting

Signed-off-by: Leo Ma <begeekmyfriend@gmail.com>
camera2
Leo Ma 9 years ago
parent 23953cb2c4
commit b7af586963

@ -27,6 +27,8 @@ public class SrsEncoder {
public static int vPrevHeight = 720; public static int vPrevHeight = 720;
public static int vPortraitWidth = 384; public static int vPortraitWidth = 384;
public static int vPortraitHeight = 640; public static int vPortraitHeight = 640;
public static int vLandscapeWidth = 640;
public static int vLandscapeHeight = 384;
public static int vOutWidth = 384; // Note: the stride of resolution must be set as 16x for hard encoding with some chip like MTK public static int vOutWidth = 384; // Note: the stride of resolution must be set as 16x for hard encoding with some chip like MTK
public static int vOutHeight = 640; // Since Y component is quadruple size as U and V component, the stride must be set as 32x public static int vOutHeight = 640; // Since Y component is quadruple size as U and V component, the stride must be set as 32x
public static int vBitrate = 500 * 1000; // 500kbps public static int vBitrate = 500 * 1000; // 500kbps
@ -231,8 +233,8 @@ public class SrsEncoder {
public void setLandscapeResolution(int width, int height) { public void setLandscapeResolution(int width, int height) {
vOutWidth = width; vOutWidth = width;
vOutHeight = height; vOutHeight = height;
vPortraitWidth = height; vLandscapeWidth = width;
vPortraitHeight = width; vLandscapeHeight = height;
} }
public void setVideoHDMode() { public void setVideoHDMode() {
@ -267,8 +269,8 @@ public class SrsEncoder {
vOutWidth = vPortraitWidth; vOutWidth = vPortraitWidth;
vOutHeight = vPortraitHeight; vOutHeight = vPortraitHeight;
} else if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) { } else if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) {
vOutWidth = vPortraitHeight; vOutWidth = vLandscapeWidth;
vOutHeight = vPortraitWidth; vOutHeight = vLandscapeHeight;
} }
// Note: the stride of resolution must be set as 16x for hard encoding with some chip like MTK // Note: the stride of resolution must be set as 16x for hard encoding with some chip like MTK

@ -179,7 +179,11 @@ public class SrsPublisher {
} }
public void setOutputResolution(int width, int height) { public void setOutputResolution(int width, int height) {
if (width <= height) {
mEncoder.setPortraitResolution(width, height); mEncoder.setPortraitResolution(width, height);
} else {
mEncoder.setLandscapeResolution(width, height);
}
} }
public void setScreenOrientation(int orientation) { public void setScreenOrientation(int orientation) {

Loading…
Cancel
Save