Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: media/base/android/java/src/org/chromium/media/VideoCapture.java

Issue 400933002: Android VideoCapture: catch exception on Android.Camera.SetParameters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.media; 5 package org.chromium.media;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.graphics.ImageFormat; 8 import android.graphics.ImageFormat;
9 import android.graphics.SurfaceTexture; 9 import android.graphics.SurfaceTexture;
10 import android.hardware.Camera; 10 import android.hardware.Camera;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 parameters.setVideoStabilization(true); 170 parameters.setVideoStabilization(true);
171 } else { 171 } else {
172 Log.d(TAG, "Image stabilization not supported."); 172 Log.d(TAG, "Image stabilization not supported.");
173 } 173 }
174 174
175 setCaptureParameters(matchedWidth, matchedHeight, frameRate, parameters) ; 175 setCaptureParameters(matchedWidth, matchedHeight, frameRate, parameters) ;
176 parameters.setPreviewSize(mCaptureFormat.mWidth, 176 parameters.setPreviewSize(mCaptureFormat.mWidth,
177 mCaptureFormat.mHeight); 177 mCaptureFormat.mHeight);
178 parameters.setPreviewFpsRange(fpsMinMax[0], fpsMinMax[1]); 178 parameters.setPreviewFpsRange(fpsMinMax[0], fpsMinMax[1]);
179 parameters.setPreviewFormat(mCaptureFormat.mPixelFormat); 179 parameters.setPreviewFormat(mCaptureFormat.mPixelFormat);
180 mCamera.setParameters(parameters); 180 try {
181 mCamera.setParameters(parameters);
182 } catch (RuntimeException ex) {
183 Log.e(TAG, "setParameters: " + ex);
184 return false;
185 }
181 186
182 // Set SurfaceTexture. Android Capture needs a SurfaceTexture even if 187 // Set SurfaceTexture. Android Capture needs a SurfaceTexture even if
183 // it is not going to be used. 188 // it is not going to be used.
184 mGlTextures = new int[1]; 189 mGlTextures = new int[1];
185 // Generate one texture pointer and bind it as an external texture. 190 // Generate one texture pointer and bind it as an external texture.
186 GLES20.glGenTextures(1, mGlTextures, 0); 191 GLES20.glGenTextures(1, mGlTextures, 0);
187 GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, mGlTextures[0]); 192 GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, mGlTextures[0]);
188 // No mip-mapping with camera source. 193 // No mip-mapping with camera source.
189 GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES, 194 GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES,
190 GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); 195 GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 private Camera.CameraInfo getCameraInfo(int id) { 371 private Camera.CameraInfo getCameraInfo(int id) {
367 Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); 372 Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
368 try { 373 try {
369 Camera.getCameraInfo(id, cameraInfo); 374 Camera.getCameraInfo(id, cameraInfo);
370 } catch (RuntimeException ex) { 375 } catch (RuntimeException ex) {
371 Log.e(TAG, "getCameraInfo: Camera.getCameraInfo: " + ex); 376 Log.e(TAG, "getCameraInfo: Camera.getCameraInfo: " + ex);
372 return null; 377 return null;
373 } 378 }
374 return cameraInfo; 379 return cameraInfo;
375 } 380 }
376 } 381 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698