Merge "update SDK to 18" into jb-mr2-dev
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/CtsTestHelper.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/CtsTestHelper.java
index c080729..bca217b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/CtsTestHelper.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/CtsTestHelper.java
@@ -50,7 +50,7 @@
String details = "PhotoSphere FOV test result:\n";
for (int i = 0; i < resolutions.size(); i++) {
SelectableResolution res = resolutions.get(i);
- details += "Resolution:" + res.width + 'x' + res.height
+ details += "Camera:" + res.cameraId + ", Resolution:" + res.width + 'x' + res.height
+ ", Measured FOV = " + res.measuredFOV + '\n';
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/PhotoCaptureActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/PhotoCaptureActivity.java
index c5957c0..943ee3d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/PhotoCaptureActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/PhotoCaptureActivity.java
@@ -22,7 +22,6 @@
import android.graphics.Color;
import android.hardware.Camera;
import android.hardware.Camera.PictureCallback;
-import android.hardware.Camera.Size;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
@@ -52,7 +51,7 @@
* An activity for showing the camera preview and taking a picture.
*/
public class PhotoCaptureActivity extends Activity
-implements PictureCallback, SurfaceHolder.Callback {
+ implements PictureCallback, SurfaceHolder.Callback {
private static final String TAG = PhotoCaptureActivity.class.getSimpleName();
private static final int FOV_REQUEST_CODE = 1006;
private static final String PICTURE_FILENAME = "photo.jpg";
@@ -65,6 +64,7 @@
private ArrayAdapter<SelectableResolution> mAdapter;
private Camera mCamera;
+ private Size mSurfaceSize;
private boolean mCameraInitialized = false;
private boolean mPreviewActive = false;
private int mResolutionSpinnerIndex = -1;
@@ -119,6 +119,7 @@
if (mSupportedResolutions != null) {
SelectableResolution resolution = mSupportedResolutions.get(position);
+ switchToCamera(resolution.cameraId);
Camera.Parameters params = mCamera.getParameters();
params.setPictureSize(resolution.width, resolution.height);
mCamera.setParameters(params);
@@ -131,54 +132,38 @@
});
}
- /**
- * Get the best supported focus mode.
- *
- * @param camera - Android camera object.
- * @return the best supported focus mode.
- */
- protected String getFocusMode(Camera camera) {
- List<String> modes = camera.getParameters().getSupportedFocusModes();
- if (modes != null) {
- if (modes.contains(Camera.Parameters.FOCUS_MODE_INFINITY)) {
- Log.v(TAG, "Using Focus mode infinity");
- return Camera.Parameters.FOCUS_MODE_INFINITY;
- }
- if (modes.contains(Camera.Parameters.FOCUS_MODE_FIXED)) {
- Log.v(TAG, "Using Focus mode fixed");
- return Camera.Parameters.FOCUS_MODE_FIXED;
- }
- }
- Log.v(TAG, "Using Focus mode auto.");
- return Camera.Parameters.FOCUS_MODE_AUTO;
- }
-
@Override
protected void onResume() {
super.onResume();
- mCamera = Camera.open();
-
// Keep the device from going to sleep.
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG);
mWakeLock.acquire();
if (mSupportedResolutions == null) {
- // Get the supported picture sizes and fill the spinner.
- List<Size> supportedSizes =
- mCamera.getParameters().getSupportedPictureSizes();
mSupportedResolutions = new ArrayList<SelectableResolution>();
- for (Size size : supportedSizes) {
- mSupportedResolutions.add(
- new SelectableResolution(size.width, size.height));
+ int numCameras = Camera.getNumberOfCameras();
+ for (int cameraId = 0; cameraId < numCameras; ++cameraId) {
+ Camera camera = Camera.open(cameraId);
+
+ // Get the supported picture sizes and fill the spinner.
+ List<Camera.Size> supportedSizes =
+ camera.getParameters().getSupportedPictureSizes();
+ for (Camera.Size size : supportedSizes) {
+ mSupportedResolutions.add(
+ new SelectableResolution(cameraId, size.width, size.height));
+ }
+ camera.release();
}
}
- // find teh first untested one.
+ // Find the first untested entry.
for (mResolutionSpinnerIndex = 0;
mResolutionSpinnerIndex < mSupportedResolutions.size();
mResolutionSpinnerIndex++) {
- if (!mSupportedResolutions.get(mResolutionSpinnerIndex).tested) break;
+ if (!mSupportedResolutions.get(mResolutionSpinnerIndex).tested) {
+ break;
+ }
}
mAdapter = new ArrayAdapter<SelectableResolution>(
@@ -215,20 +200,23 @@
fos.close();
Log.d(TAG, "File saved to " + pictureFile.getAbsolutePath());
- // Start activity which will use he taken picture to determine the FOV.
+ // Start activity which will use the taken picture to determine the
+ // FOV.
startActivityForResult(new Intent(this, DetermineFovActivity.class),
FOV_REQUEST_CODE + mResolutionSpinnerIndex, null);
} catch (IOException e) {
Log.e(TAG, "Could not save picture file.", e);
Toast.makeText(this, "Could not save picture file: " + e.getMessage(),
- Toast.LENGTH_LONG).show();
+ Toast.LENGTH_LONG).show();
return;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (resultCode != RESULT_OK) return;
+ if (resultCode != RESULT_OK) {
+ return;
+ }
int testIndex = requestCode - FOV_REQUEST_CODE;
SelectableResolution res = mSupportedResolutions.get(testIndex);
res.tested = true;
@@ -260,10 +248,10 @@
}
if (allPassed) {
TestResult.setPassedResult(this, getClass().getName(),
- CtsTestHelper.getTestDetails(mSupportedResolutions));
+ CtsTestHelper.getTestDetails(mSupportedResolutions));
} else {
TestResult.setFailedResult(this, getClass().getName(),
- CtsTestHelper.getTestDetails(mSupportedResolutions));
+ CtsTestHelper.getTestDetails(mSupportedResolutions));
}
finish();
}
@@ -271,32 +259,8 @@
@Override
public void surfaceChanged(
SurfaceHolder holder, int format, int width, int height) {
- if (mCamera == null || mSurfaceHolder.getSurface() == null) {
- return;
- }
-
- try {
- mCamera.setPreviewDisplay(mSurfaceHolder);
- } catch (Throwable t) {
- Log.e("TAG", "Could not set preview display", t);
- Toast.makeText(this, t.getMessage(), Toast.LENGTH_LONG).show();
- return;
- }
-
- // The picture size is taken and set from the spinner selection callback.
- Camera.Parameters params = mCamera.getParameters();
- params.setJpegThumbnailSize(0, 0);
- params.setJpegQuality(100);
- params.setFocusMode(getFocusMode(mCamera));
- params.setZoom(0);
-
- Camera.Size size = getBestPreviewSize(width, height, params);
- if (size != null) {
- params.setPreviewSize(size.width, size.height);
- mCamera.setParameters(params);
- mCameraInitialized = true;
- }
- startPreview();
+ mSurfaceSize = new Size(width, height);
+ initializeCamera();
}
@Override
@@ -309,6 +273,31 @@
// Nothing to do.
}
+ public void initializeCamera() {
+ if (mCamera == null || mSurfaceHolder.getSurface() == null) {
+ return;
+ }
+
+ try {
+ mCamera.setPreviewDisplay(mSurfaceHolder);
+ } catch (Throwable t) {
+ Log.e("TAG", "Could not set preview display", t);
+ Toast.makeText(this, t.getMessage(), Toast.LENGTH_LONG).show();
+ return;
+ }
+
+ Camera.Parameters params = setCameraParams(mCamera);
+
+ Camera.Size selectedPreviewSize =
+ getBestPreviewSize(mSurfaceSize.width, mSurfaceSize.height, params);
+ if (selectedPreviewSize != null) {
+ params.setPreviewSize(selectedPreviewSize.width, selectedPreviewSize.height);
+ mCamera.setParameters(params);
+ mCameraInitialized = true;
+ }
+ startPreview();
+ }
+
private void startPreview() {
if (mCameraInitialized && mCamera != null) {
mCamera.startPreview();
@@ -316,6 +305,52 @@
}
}
+ private void switchToCamera(int cameraId) {
+ if (mCamera != null) {
+ mCamera.stopPreview();
+ mCamera.release();
+ }
+ mCamera = Camera.open(cameraId);
+ initializeCamera();
+ }
+
+ /**
+ * Get the best supported focus mode.
+ *
+ * @param camera - Android camera object.
+ * @return the best supported focus mode.
+ */
+ private static String getFocusMode(Camera camera) {
+ List<String> modes = camera.getParameters().getSupportedFocusModes();
+ if (modes != null) {
+ if (modes.contains(Camera.Parameters.FOCUS_MODE_INFINITY)) {
+ Log.v(TAG, "Using Focus mode infinity");
+ return Camera.Parameters.FOCUS_MODE_INFINITY;
+ }
+ if (modes.contains(Camera.Parameters.FOCUS_MODE_FIXED)) {
+ Log.v(TAG, "Using Focus mode fixed");
+ return Camera.Parameters.FOCUS_MODE_FIXED;
+ }
+ }
+ Log.v(TAG, "Using Focus mode auto.");
+ return Camera.Parameters.FOCUS_MODE_AUTO;
+ }
+
+ /**
+ * Set the common camera parameters on the given camera and returns the
+ * parameter object for further modification, if needed.
+ */
+ private static Camera.Parameters setCameraParams(Camera camera) {
+ // The picture size is taken and set from the spinner selection
+ // callback.
+ Camera.Parameters params = camera.getParameters();
+ params.setJpegThumbnailSize(0, 0);
+ params.setJpegQuality(100);
+ params.setFocusMode(getFocusMode(camera));
+ params.setZoom(0);
+ return params;
+ }
+
private Camera.Size getBestPreviewSize(
int width, int height, Camera.Parameters parameters) {
Camera.Size result = null;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/SelectableResolution.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/SelectableResolution.java
index 5e87eee..9057dbf 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/SelectableResolution.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/SelectableResolution.java
@@ -20,21 +20,24 @@
* A resolution to be used in the adapter that feeds the resolution spinner.
*/
public class SelectableResolution {
+ public final int cameraId;
public final int width;
public final int height;
public boolean passed;
public boolean tested;
public float measuredFOV;
- public SelectableResolution(int width, int height) {
+ public SelectableResolution(int cameraId, int width, int height) {
+ this.cameraId = cameraId;
this.width = width;
this.height = height;
- passed = false;
- tested = false;
+ this.passed = false;
+ this.tested = false;
}
@Override
public String toString() {
- return width + " x " + height + " - " + (!tested ? "untested" : "done");
+ return "Cam " + cameraId + ": " + width + " x " + height + " - "
+ + (!tested ? "untested" : "done");
}
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/Size.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/Size.java
new file mode 100644
index 0000000..709478b
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/Size.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.cts.verifier.camera.fov;
+
+/**
+ * Simple immutable class for keeping a size.
+ */
+public class Size {
+ public final int width;
+ public final int height;
+
+ public Size(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+}
diff --git a/suite/pts/deviceTests/opengl/AndroidManifest.xml b/suite/pts/deviceTests/opengl/AndroidManifest.xml
index 7cfebaa..86e21e2 100644
--- a/suite/pts/deviceTests/opengl/AndroidManifest.xml
+++ b/suite/pts/deviceTests/opengl/AndroidManifest.xml
@@ -20,7 +20,7 @@
<activity
android:name="com.android.pts.opengl.primitive.GLPrimitiveActivity"
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -30,7 +30,7 @@
</activity>
<activity
android:name="com.android.pts.opengl.reference.GLReferenceActivity"
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize" >
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -39,7 +39,7 @@
</activity>
<activity
android:name="com.android.pts.opengl.reference.GLGameActivity"
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
</application>
diff --git a/suite/pts/deviceTests/ui/AndroidManifest.xml b/suite/pts/deviceTests/ui/AndroidManifest.xml
index 639e3d6..839e8aa 100644
--- a/suite/pts/deviceTests/ui/AndroidManifest.xml
+++ b/suite/pts/deviceTests/ui/AndroidManifest.xml
@@ -26,7 +26,7 @@
<activity
android:name=".ScrollingActivity"
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -36,7 +36,7 @@
</activity>
<activity
android:name="android.openglperf.cts.GlPlanetsActivity"
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize" />
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" />
</application>
<instrumentation
diff --git a/suite/pts/hostTests/uihost/appA/AndroidManifest.xml b/suite/pts/hostTests/uihost/appA/AndroidManifest.xml
index 4491210..847487d 100644
--- a/suite/pts/hostTests/uihost/appA/AndroidManifest.xml
+++ b/suite/pts/hostTests/uihost/appA/AndroidManifest.xml
@@ -23,7 +23,7 @@
<application>
<activity
android:name=".AppAActivity"
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/suite/pts/hostTests/uihost/appB/AndroidManifest.xml b/suite/pts/hostTests/uihost/appB/AndroidManifest.xml
index 29bf661..d0c0bb7 100644
--- a/suite/pts/hostTests/uihost/appB/AndroidManifest.xml
+++ b/suite/pts/hostTests/uihost/appB/AndroidManifest.xml
@@ -22,7 +22,7 @@
<application>
<activity
android:name=".AppBActivity"
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:screenOrientation="portrait" >
<intent-filter>
diff --git a/suite/pts/hostTests/uihost/src/com/android/pts/uihost/InstallTimeTest.java b/suite/pts/hostTests/uihost/src/com/android/pts/uihost/InstallTimeTest.java
index 55e9b40..b6f8f40 100644
--- a/suite/pts/hostTests/uihost/src/com/android/pts/uihost/InstallTimeTest.java
+++ b/suite/pts/hostTests/uihost/src/com/android/pts/uihost/InstallTimeTest.java
@@ -17,6 +17,7 @@
package com.android.pts.uihost;
import com.android.cts.tradefed.build.CtsBuildHelper;
+import com.android.ddmlib.Log;
import com.android.pts.util.HostReportLog;
import com.android.pts.util.MeasureRun;
import com.android.pts.util.MeasureTime;
@@ -40,8 +41,10 @@
private CtsBuildHelper mBuild;
private ITestDevice mDevice;
+ private static final String TAG = "InstallTimeTest";
static final String PACKAGE = "com.replica.replicaisland";
static final String APK = "com.replica.replicaisland.apk";
+ private static final double OUTLIER_THRESHOLD = 0.1;
@Override
public void setBuild(IBuildInfo buildInfo) {
@@ -80,7 +83,10 @@
});
report.printArray("install time", result, ResultType.LOWER_BETTER,
ResultUnit.MS);
- StatResult stat = Stat.getStat(result);
+ Stat.StatResult stat = Stat.getStatWithOutlierRejection(result, OUTLIER_THRESHOLD);
+ if (stat.mDataCount != result.length) {
+ Log.w(TAG, "rejecting " + (result.length - stat.mDataCount) + " outliers");
+ }
report.printSummary("install time", stat.mAverage, ResultType.LOWER_BETTER,
ResultUnit.MS);
report.deliverReportToHost();
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 662693e..75ba598 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -959,7 +959,8 @@
<activity android:name="android.opengl.cts.OpenGlEsVersionStubActivity"/>
- <activity android:name="android.opengl.cts.EglConfigStubActivity"/>
+ <activity android:name="android.opengl.cts.EglConfigStubActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize|uiMode" />
<activity android:name="android.opengl.cts.CompressedTextureStubActivity"
android:label="CompressedTextureStubActivity"
diff --git a/tests/tests/media/src/android/media/cts/DecodeEditEncodeTest.java b/tests/tests/media/src/android/media/cts/DecodeEditEncodeTest.java
index 4bbd05d..93b78a2 100644
--- a/tests/tests/media/src/android/media/cts/DecodeEditEncodeTest.java
+++ b/tests/tests/media/src/android/media/cts/DecodeEditEncodeTest.java
@@ -23,7 +23,6 @@
import android.opengl.GLES20;
import android.test.AndroidTestCase;
import android.util.Log;
-import android.view.Surface;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -31,7 +30,6 @@
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import java.util.Arrays;
import javax.microedition.khronos.opengles.GL10;
@@ -59,7 +57,6 @@
// parameters for the encoder
private static final String MIME_TYPE = "video/avc"; // H.264 Advanced Video Coding
- private static final int BIT_RATE = 2000000; // 2Mbps
private static final int FRAME_RATE = 15; // 15fps
private static final int IFRAME_INTERVAL = 10; // 10 seconds between I-frames
@@ -86,21 +83,23 @@
// size of a frame, in pixels
private int mWidth = -1;
private int mHeight = -1;
+ // bit rate, in bits per second
+ private int mBitRate = -1;
// largest color component delta seen (i.e. actual vs. expected)
private int mLargestColorDelta;
public void testVideoEditQCIF() throws Throwable {
- setSize(176, 144);
+ setParameters(176, 144, 1000000);
VideoEditWrapper.runTest(this);
}
public void testVideoEditQVGA() throws Throwable {
- setSize(320, 240);
+ setParameters(320, 240, 2000000);
VideoEditWrapper.runTest(this);
}
public void testVideoEdit720p() throws Throwable {
- setSize(1280, 720);
+ setParameters(1280, 720, 6000000);
VideoEditWrapper.runTest(this);
}
@@ -138,14 +137,15 @@
}
/**
- * Sets the desired frame size.
+ * Sets the desired frame size and bit rate.
*/
- private void setSize(int width, int height) {
+ private void setParameters(int width, int height, int bitRate) {
if ((width % 16) != 0 || (height % 16) != 0) {
Log.w(TAG, "WARNING: width or height not multiple of 16");
}
mWidth = width;
mHeight = height;
+ mBitRate = bitRate;
}
/**
@@ -206,7 +206,7 @@
// configure() call to throw an unhelpful exception.
format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
- format.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE);
+ format.setInteger(MediaFormat.KEY_BIT_RATE, mBitRate);
format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);
format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL);
if (VERBOSE) Log.d(TAG, "format: " + format);
diff --git a/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java b/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java
index 5d1a3ba..849877a 100644
--- a/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java
@@ -16,7 +16,6 @@
package android.media.cts;
-import android.graphics.SurfaceTexture;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaCodecList;
@@ -24,7 +23,6 @@
import android.opengl.GLES20;
import android.test.AndroidTestCase;
import android.util.Log;
-import android.view.Surface;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -54,7 +52,6 @@
// parameters for the encoder
private static final String MIME_TYPE = "video/avc"; // H.264 Advanced Video Coding
- private static final int BIT_RATE = 2000000; // 2Mbps
private static final int FRAME_RATE = 15; // 15fps
private static final int IFRAME_INTERVAL = 10; // 10 seconds between I-frames
@@ -74,6 +71,8 @@
// size of a frame, in pixels
private int mWidth = -1;
private int mHeight = -1;
+ // bit rate, in bits per second
+ private int mBitRate = -1;
// largest color component delta seen (i.e. actual vs. expected)
private int mLargestColorDelta;
@@ -85,15 +84,15 @@
* validity.
*/
public void testEncodeDecodeVideoFromBufferToBufferQCIF() throws Exception {
- setSize(176, 144);
+ setParameters(176, 144, 1000000);
encodeDecodeVideoFromBuffer(false);
}
public void testEncodeDecodeVideoFromBufferToBufferQVGA() throws Exception {
- setSize(320, 240);
+ setParameters(320, 240, 2000000);
encodeDecodeVideoFromBuffer(false);
}
public void testEncodeDecodeVideoFromBufferToBuffer720p() throws Exception {
- setSize(1280, 720);
+ setParameters(1280, 720, 6000000);
encodeDecodeVideoFromBuffer(false);
}
@@ -110,15 +109,15 @@
* the test.
*/
public void testEncodeDecodeVideoFromBufferToSurfaceQCIF() throws Throwable {
- setSize(176, 144);
+ setParameters(176, 144, 1000000);
BufferToSurfaceWrapper.runTest(this);
}
public void testEncodeDecodeVideoFromBufferToSurfaceQVGA() throws Throwable {
- setSize(320, 240);
+ setParameters(320, 240, 2000000);
BufferToSurfaceWrapper.runTest(this);
}
public void testEncodeDecodeVideoFromBufferToSurface720p() throws Throwable {
- setSize(1280, 720);
+ setParameters(1280, 720, 6000000);
BufferToSurfaceWrapper.runTest(this);
}
@@ -158,15 +157,15 @@
* a Surface and decoded onto a Surface. The output is checked for validity.
*/
public void testEncodeDecodeVideoFromSurfaceToSurfaceQCIF() throws Throwable {
- setSize(176, 144);
+ setParameters(176, 144, 1000000);
SurfaceToSurfaceWrapper.runTest(this);
}
public void testEncodeDecodeVideoFromSurfaceToSurfaceQVGA() throws Throwable {
- setSize(320, 240);
+ setParameters(320, 240, 2000000);
SurfaceToSurfaceWrapper.runTest(this);
}
public void testEncodeDecodeVideoFromSurfaceToSurface720p() throws Throwable {
- setSize(1280, 720);
+ setParameters(1280, 720, 6000000);
SurfaceToSurfaceWrapper.runTest(this);
}
@@ -202,14 +201,15 @@
}
/**
- * Sets the desired frame size.
+ * Sets the desired frame size and bit rate.
*/
- private void setSize(int width, int height) {
+ private void setParameters(int width, int height, int bitRate) {
if ((width % 16) != 0 || (height % 16) != 0) {
Log.w(TAG, "WARNING: width or height not multiple of 16");
}
mWidth = width;
mHeight = height;
+ mBitRate = bitRate;
}
/**
@@ -245,7 +245,7 @@
// Set some properties. Failing to specify some of these can cause the MediaCodec
// configure() call to throw an unhelpful exception.
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, colorFormat);
- format.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE);
+ format.setInteger(MediaFormat.KEY_BIT_RATE, mBitRate);
format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);
format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL);
if (VERBOSE) Log.d(TAG, "format: " + format);
@@ -308,7 +308,7 @@
// Set some properties. Failing to specify some of these can cause the MediaCodec
// configure() call to throw an unhelpful exception.
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, colorFormat);
- format.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE);
+ format.setInteger(MediaFormat.KEY_BIT_RATE, mBitRate);
format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);
format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL);
if (VERBOSE) Log.d(TAG, "format: " + format);