mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-05 04:49:31 +00:00
Refactor code to use the new InviteManager which in turn
uses the Bandwidth and Camera managers. Improved front camera support.
This commit is contained in:
parent
90a5674b97
commit
74096f25ba
1 changed files with 23 additions and 11 deletions
|
|
@ -184,7 +184,7 @@ public class AndroidCameraRecordManager {
|
|||
}
|
||||
|
||||
// eventually null
|
||||
|
||||
|
||||
return supportedVideoSizes;
|
||||
}
|
||||
|
||||
|
|
@ -203,21 +203,33 @@ public class AndroidCameraRecordManager {
|
|||
parameters = null;
|
||||
}
|
||||
|
||||
public int[] doYouSupportThisVideoSize(int[] askedSize) {
|
||||
final int askedW = askedSize[0];
|
||||
final int askedH = askedSize[1];
|
||||
Log.d(tag, "w"+askedW);
|
||||
Log.d(tag, "h"+askedH);
|
||||
if (useFrontCamera && isPortraitSize(askedW, askedH)) {
|
||||
return new int[] {askedH, askedW}; // only landscape supported
|
||||
/**
|
||||
* Naive simple version.
|
||||
* @param askedSize
|
||||
* @return
|
||||
*/
|
||||
public VideoSize doYouSupportThisVideoSize(VideoSize askedSize) {
|
||||
Log.d(tag, "Asking camera if it supports size "+askedSize);
|
||||
if (useFrontCamera && askedSize.isPortrait()) {
|
||||
return askedSize.createInverted(); // only landscape supported
|
||||
} else {
|
||||
return askedSize;
|
||||
}
|
||||
}
|
||||
private boolean isPortraitSize(int width, int height) {
|
||||
return width < height;
|
||||
}
|
||||
|
||||
|
||||
private VideoSize closestVideoSize(VideoSize vSize, int defaultSizeCode, boolean defaultIsPortrait) {
|
||||
VideoSize testSize = vSize.isPortrait() ? vSize.createInverted() : vSize;
|
||||
|
||||
for (Size s : AndroidCameraRecordManager.getInstance().supportedVideoSizes()) {
|
||||
if (s.height == testSize.getHeight() && s.width == testSize.getWidth()) {
|
||||
return vSize;
|
||||
}
|
||||
}
|
||||
|
||||
return VideoSize.createStandard(defaultSizeCode, defaultIsPortrait);
|
||||
}
|
||||
|
||||
private static final int rearCamId() {return 1;}
|
||||
private static final int frontCamId() {return 2;}
|
||||
private final int cameraId() {return useFrontCamera? frontCamId() : rearCamId(); }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue