summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorwjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-17 18:08:34 +0000
committerwjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-17 18:08:34 +0000
commitc3da25020001e7b0ece441ab5fe403949d6789b1 (patch)
tree10d2a600c9180e504522cdb94e8f2adfab128737 /media
parent78dfe3845c9e872bd8b517a7b3bf17a79d001858 (diff)
downloadchromium_src-c3da25020001e7b0ece441ab5fe403949d6789b1.zip
chromium_src-c3da25020001e7b0ece441ab5fe403949d6789b1.tar.gz
chromium_src-c3da25020001e7b0ece441ab5fe403949d6789b1.tar.bz2
Fall back to default frame rate when the requested one is not supported for camera capture on Android.
Video capture can return a different frame rate than the requested. In case that the requested one is not supported, video capture can fall back to a default fps. BUG=260894 R=qinmin@chromium.org Review URL: https://codereview.chromium.org/19483002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/android/java/src/org/chromium/media/VideoCapture.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/media/base/android/java/src/org/chromium/media/VideoCapture.java b/media/base/android/java/src/org/chromium/media/VideoCapture.java
index 284f742..8d67f5e 100644
--- a/media/base/android/java/src/org/chromium/media/VideoCapture.java
+++ b/media/base/android/java/src/org/chromium/media/VideoCapture.java
@@ -87,26 +87,29 @@ public class VideoCapture implements PreviewCallback, OnFrameAvailableListener {
// Calculate fps.
List<int[]> listFpsRange = parameters.getSupportedPreviewFpsRange();
+ if (listFpsRange.size() == 0) {
+ Log.e(TAG, "allocate: no fps range found");
+ return false;
+ }
int frameRateInMs = frameRate * 1000;
- boolean fpsIsSupported = false;
- int fpsMin = 0;
- int fpsMax = 0;
Iterator itFpsRange = listFpsRange.iterator();
+ int[] fpsRange = (int[])itFpsRange.next();
+ // Use the first range as default.
+ int fpsMin = fpsRange[0];
+ int fpsMax = fpsRange[1];
+ int newFrameRate = (fpsMin + 999) / 1000;
while (itFpsRange.hasNext()) {
- int[] fpsRange = (int[])itFpsRange.next();
+ fpsRange = (int[])itFpsRange.next();
if (fpsRange[0] <= frameRateInMs &&
frameRateInMs <= fpsRange[1]) {
- fpsIsSupported = true;
fpsMin = fpsRange[0];
fpsMax = fpsRange[1];
+ newFrameRate = frameRate;
break;
}
}
-
- if (!fpsIsSupported) {
- Log.e(TAG, "allocate: fps " + frameRate + " is not supported");
- return false;
- }
+ frameRate = newFrameRate;
+ Log.d(TAG, "allocate: fps set to " + frameRate);
mCurrentCapability = new CaptureCapability();
mCurrentCapability.mDesiredFps = frameRate;