Merge branch 'master' of belledonne-communications.com:linphone-android
This commit is contained in:
commit
c293804781
5 changed files with 21 additions and 11 deletions
|
@ -47,6 +47,7 @@ public class VideoCallActivity extends Activity {
|
||||||
private WakeLock mWakeLock;
|
private WakeLock mWakeLock;
|
||||||
private static final int capturePreviewLargestDimension = 150;
|
private static final int capturePreviewLargestDimension = 150;
|
||||||
// private static final float similarRatio = 0.1f;
|
// private static final float similarRatio = 0.1f;
|
||||||
|
private static final int version = Integer.parseInt(Build.VERSION.SDK);
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
launched = true;
|
launched = true;
|
||||||
|
@ -70,7 +71,7 @@ public class VideoCallActivity extends Activity {
|
||||||
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,"Linphone");
|
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,"Linphone");
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
|
|
||||||
if (Integer.parseInt(Build.VERSION.SDK) < 8) {
|
if (version < 8) {
|
||||||
// Force to display in portrait orientation for old devices
|
// Force to display in portrait orientation for old devices
|
||||||
// as they do not support surfaceView rotation
|
// as they do not support surfaceView rotation
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
@ -78,7 +79,7 @@ public class VideoCallActivity extends Activity {
|
||||||
|
|
||||||
// Handle the fact that the preferred size may have a ratio /an orientation different from the one
|
// Handle the fact that the preferred size may have a ratio /an orientation different from the one
|
||||||
// in the videocall.xml as the front camera on Samsung captures in landscape.
|
// in the videocall.xml as the front camera on Samsung captures in landscape.
|
||||||
updateSvLayoutParamsFromVideoSize(mVideoCaptureView, lc.getPreferredVideoSize());
|
resizeCapturePreviewForOldPhones(mVideoCaptureView, lc.getPreferredVideoSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +119,13 @@ public class VideoCallActivity extends Activity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSvLayoutParamsFromVideoSize(SurfaceView sv, VideoSize vs) {
|
/**
|
||||||
|
* @param sv capture surface view to resize the layout
|
||||||
|
* @param vs video size from which to calculate the dimensions
|
||||||
|
*/
|
||||||
|
private void resizeCapturePreviewForOldPhones(SurfaceView sv, VideoSize vs) {
|
||||||
|
if (version >= 8) return;
|
||||||
|
|
||||||
LayoutParams lp = sv.getLayoutParams();
|
LayoutParams lp = sv.getLayoutParams();
|
||||||
float newRatio = ratioWidthHeight(vs);
|
float newRatio = ratioWidthHeight(vs);
|
||||||
|
|
||||||
|
@ -151,7 +158,7 @@ public class VideoCallActivity extends Activity {
|
||||||
|
|
||||||
// Resize preview frame
|
// Resize preview frame
|
||||||
VideoSize newVideoSize = LinphoneService.getLc().getPreferredVideoSize();
|
VideoSize newVideoSize = LinphoneService.getLc().getPreferredVideoSize();
|
||||||
updateSvLayoutParamsFromVideoSize(mVideoCaptureView, newVideoSize);
|
resizeCapturePreviewForOldPhones(mVideoCaptureView, newVideoSize);
|
||||||
break;
|
break;
|
||||||
case R.id.videocall_menu_terminate_call:
|
case R.id.videocall_menu_terminate_call:
|
||||||
LinphoneCore lc = LinphoneService.getLc();
|
LinphoneCore lc = LinphoneService.getLc();
|
||||||
|
|
|
@ -167,7 +167,8 @@ public abstract class AndroidCameraRecord {
|
||||||
public void setDisplayOrientation(int rotation) {
|
public void setDisplayOrientation(int rotation) {
|
||||||
displayOrientation = rotation;
|
displayOrientation = rotation;
|
||||||
}
|
}
|
||||||
|
protected int getDisplayOrientation() {return displayOrientation;}
|
||||||
|
|
||||||
protected int rotateCapturedFrame() {
|
protected int rotateCapturedFrame() {
|
||||||
if (params.videoDimensionsInverted) {
|
if (params.videoDimensionsInverted) {
|
||||||
return 1; // always rotate 90°
|
return 1; // always rotate 90°
|
||||||
|
|
|
@ -30,10 +30,10 @@ import android.util.Log;
|
||||||
* @author Guillaume Beraudo
|
* @author Guillaume Beraudo
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5 {
|
public class AndroidCameraRecordAPI8Impl extends AndroidCameraRecordImplAPI5 {
|
||||||
|
|
||||||
|
|
||||||
public AndroidCameraRecordBufferedImpl(RecorderParams parameters) {
|
public AndroidCameraRecordAPI8Impl(RecorderParams parameters) {
|
||||||
super(parameters);
|
super(parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +66,10 @@ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5
|
||||||
protected void onSettingCameraParameters(Parameters parameters) {
|
protected void onSettingCameraParameters(Parameters parameters) {
|
||||||
super.onSettingCameraParameters(parameters);
|
super.onSettingCameraParameters(parameters);
|
||||||
// Only on v8 hardware
|
// Only on v8 hardware
|
||||||
camera.setDisplayOrientation(90 * rotateCapturedFrame());
|
camera.setDisplayOrientation(90 * getPreviewCaptureRotation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getPreviewCaptureRotation() {
|
||||||
|
return (4 + 1 - displayOrientation) % 4;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -155,7 +155,7 @@ public class AndroidCameraRecordManager {
|
||||||
parameters.rotation = rotation;
|
parameters.rotation = rotation;
|
||||||
parameters.surfaceView = surfaceView;
|
parameters.surfaceView = surfaceView;
|
||||||
if (version >= 8) {
|
if (version >= 8) {
|
||||||
recorder = new AndroidCameraRecordBufferedImpl(parameters);
|
recorder = new AndroidCameraRecordAPI8Impl(parameters);
|
||||||
} else if (version >= 5) {
|
} else if (version >= 5) {
|
||||||
recorder = new AndroidCameraRecordImplAPI5(parameters);
|
recorder = new AndroidCameraRecordImplAPI5(parameters);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit de0d399e989d02f42bf70a5ebf7ab19f1762e902
|
Subproject commit 1534f84c60132dcf5c7126417afc0388c15aba2c
|
Loading…
Reference in a new issue