Bug 1312814 - Remove SDK_INT>8. r=sebastian

MozReview-Commit-ID: 5LcClh9REEH

--HG--
extra : rebase_source : 9376494b708a511e68f6589886a74f872e3de84c
This commit is contained in:
Tushar Saini (:shatur) 2016-10-25 23:32:47 +05:30
Родитель 213392281d
Коммит f99a704b53
1 изменённых файлов: 10 добавлений и 28 удалений

Просмотреть файл

@ -85,10 +85,8 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback, AppStateL
this.id = id; this.id = id;
this.native_capturer = native_capturer; this.native_capturer = native_capturer;
this.context = GetContext(); this.context = GetContext();
if(android.os.Build.VERSION.SDK_INT>8) { this.info = new Camera.CameraInfo();
this.info = new Camera.CameraInfo(); Camera.getCameraInfo(id, info);
Camera.getCameraInfo(id, info);
}
mCaptureRotation = GetRotateAmount(); mCaptureRotation = GetRotateAmount();
} }
@ -124,21 +122,13 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback, AppStateL
case Surface.ROTATION_180: degrees = 180; break; case Surface.ROTATION_180: degrees = 180; break;
case Surface.ROTATION_270: degrees = 270; break; case Surface.ROTATION_270: degrees = 270; break;
} }
if(android.os.Build.VERSION.SDK_INT>8) { int result;
int result; if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { result = (info.orientation + degrees) % 360;
result = (info.orientation + degrees) % 360; } else { // back-facing
} else { // back-facing result = (info.orientation - degrees + 360) % 360;
result = (info.orientation - degrees + 360) % 360;
}
return result;
} else {
// Assume 90deg orientation for Froyo devices.
// Only back-facing cameras are supported in Froyo.
int orientation = 90;
int result = (orientation - degrees + 360) % 360;
return result;
} }
return result;
} }
// Return the global application context. // Return the global application context.
@ -194,11 +184,7 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback, AppStateL
} }
Throwable error = null; Throwable error = null;
try { try {
if(android.os.Build.VERSION.SDK_INT>8) { camera = Camera.open(id);
camera = Camera.open(id);
} else {
camera = Camera.open();
}
// No local renderer (we only care about onPreviewFrame() buffers, not a // No local renderer (we only care about onPreviewFrame() buffers, not a
// directly-displayed UI element). Camera won't capture without // directly-displayed UI element). Camera won't capture without
@ -278,11 +264,7 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback, AppStateL
min_mfps *= frameDropRatio; min_mfps *= frameDropRatio;
max_mfps *= frameDropRatio; max_mfps *= frameDropRatio;
Log.d(TAG, "Camera preview mfps range: " + min_mfps + " - " + max_mfps); Log.d(TAG, "Camera preview mfps range: " + min_mfps + " - " + max_mfps);
if (android.os.Build.VERSION.SDK_INT>8) { parameters.setPreviewFpsRange(min_mfps, max_mfps);
parameters.setPreviewFpsRange(min_mfps, max_mfps);
} else {
parameters.setPreviewFrameRate(max_mfps / 1000);
}
int format = ImageFormat.NV21; int format = ImageFormat.NV21;
parameters.setPreviewFormat(format); parameters.setPreviewFormat(format);