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 vPortraitWidth = 384;
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 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
@ -231,8 +233,8 @@ public class SrsEncoder {
public void setLandscapeResolution(int width, int height) {
vOutWidth = width;
vOutHeight = height;
vPortraitWidth = height;
vPortraitHeight = width;
vLandscapeWidth = width;
vLandscapeHeight = height;
}
public void setVideoHDMode() {
@ -267,8 +269,8 @@ public class SrsEncoder {
vOutWidth = vPortraitWidth;
vOutHeight = vPortraitHeight;
} else if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) {
vOutWidth = vPortraitHeight;
vOutHeight = vPortraitWidth;
vOutWidth = vLandscapeWidth;
vOutHeight = vLandscapeHeight;
}
// 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) {
mEncoder.setPortraitResolution(width, height);
if (width <= height) {
mEncoder.setPortraitResolution(width, height);
} else {
mEncoder.setLandscapeResolution(width, height);
}
}
public void setScreenOrientation(int orientation) {

Loading…
Cancel
Save