Loading core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java +2 −8 Original line number Original line Diff line number Diff line Loading @@ -48,8 +48,6 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession /** Input surface configured by native camera framework based on user-specified configuration */ /** Input surface configured by native camera framework based on user-specified configuration */ private final Surface mInput; private final Surface mInput; /** User-specified set of surfaces used as the configuration outputs */ private final List<Surface> mOutputs; /** /** * User-specified state callback, used for outgoing events; calls to this object will be * User-specified state callback, used for outgoing events; calls to this object will be * automatically {@link Handler#post(Runnable) posted} to {@code mStateHandler}. * automatically {@link Handler#post(Runnable) posted} to {@code mStateHandler}. Loading Loading @@ -87,21 +85,17 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession * There must be no pending actions * There must be no pending actions * (e.g. no pending captures, no repeating requests, no flush).</p> * (e.g. no pending captures, no repeating requests, no flush).</p> */ */ CameraCaptureSessionImpl(int id, Surface input, List<Surface> outputs, CameraCaptureSessionImpl(int id, Surface input, CameraCaptureSession.StateCallback callback, Handler stateHandler, CameraCaptureSession.StateCallback callback, Handler stateHandler, android.hardware.camera2.impl.CameraDeviceImpl deviceImpl, android.hardware.camera2.impl.CameraDeviceImpl deviceImpl, Handler deviceStateHandler, boolean configureSuccess) { Handler deviceStateHandler, boolean configureSuccess) { if (outputs == null || outputs.isEmpty()) { if (callback == null) { throw new IllegalArgumentException("outputs must be a non-null, non-empty list"); } else if (callback == null) { throw new IllegalArgumentException("callback must not be null"); throw new IllegalArgumentException("callback must not be null"); } } mId = id; mId = id; mIdString = String.format("Session %d: ", mId); mIdString = String.format("Session %d: ", mId); // TODO: extra verification of outputs mOutputs = outputs; mInput = input; mInput = input; mStateHandler = checkHandler(stateHandler); mStateHandler = checkHandler(stateHandler); mStateCallback = createUserStateCallbackProxy(mStateHandler, callback); mStateCallback = createUserStateCallbackProxy(mStateHandler, callback); Loading core/java/android/hardware/camera2/impl/CameraConstrainedHighSpeedCaptureSessionImpl.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -58,14 +58,14 @@ public class CameraConstrainedHighSpeedCaptureSessionImpl * There must be no pending actions * There must be no pending actions * (e.g. no pending captures, no repeating requests, no flush).</p> * (e.g. no pending captures, no repeating requests, no flush).</p> */ */ CameraConstrainedHighSpeedCaptureSessionImpl(int id, List<Surface> outputs, CameraConstrainedHighSpeedCaptureSessionImpl(int id, CameraCaptureSession.StateCallback callback, Handler stateHandler, CameraCaptureSession.StateCallback callback, Handler stateHandler, android.hardware.camera2.impl.CameraDeviceImpl deviceImpl, android.hardware.camera2.impl.CameraDeviceImpl deviceImpl, Handler deviceStateHandler, boolean configureSuccess, Handler deviceStateHandler, boolean configureSuccess, CameraCharacteristics characteristics) { CameraCharacteristics characteristics) { mCharacteristics = characteristics; mCharacteristics = characteristics; CameraCaptureSession.StateCallback wrapperCallback = new WrapperCallback(callback); CameraCaptureSession.StateCallback wrapperCallback = new WrapperCallback(callback); mSessionImpl = new CameraCaptureSessionImpl(id, /*input*/null, outputs, wrapperCallback, mSessionImpl = new CameraCaptureSessionImpl(id, /*input*/null, wrapperCallback, stateHandler, deviceImpl, deviceStateHandler, configureSuccess); stateHandler, deviceImpl, deviceStateHandler, configureSuccess); } } Loading core/java/android/hardware/camera2/impl/CameraDeviceImpl.java +32 −26 Original line number Original line Diff line number Diff line Loading @@ -501,7 +501,7 @@ public class CameraDeviceImpl extends CameraDevice CameraCaptureSession.StateCallback callback, Handler handler) CameraCaptureSession.StateCallback callback, Handler handler) throws CameraAccessException { throws CameraAccessException { if (DEBUG) { if (DEBUG) { Log.d(TAG, "createCaptureSessionByOutputConfiguration"); Log.d(TAG, "createCaptureSessionByOutputConfigurations"); } } // OutputConfiguration objects are immutable, but need to have our own array // OutputConfiguration objects are immutable, but need to have our own array Loading Loading @@ -621,19 +621,15 @@ public class CameraDeviceImpl extends CameraDevice } } } } List<Surface> outSurfaces = new ArrayList<>(outputConfigurations.size()); for (OutputConfiguration config : outputConfigurations) { outSurfaces.add(config.getSurface()); } // Fire onConfigured if configureOutputs succeeded, fire onConfigureFailed otherwise. // Fire onConfigured if configureOutputs succeeded, fire onConfigureFailed otherwise. CameraCaptureSessionCore newSession = null; CameraCaptureSessionCore newSession = null; if (isConstrainedHighSpeed) { if (isConstrainedHighSpeed) { newSession = new CameraConstrainedHighSpeedCaptureSessionImpl(mNextSessionId++, newSession = new CameraConstrainedHighSpeedCaptureSessionImpl(mNextSessionId++, outSurfaces, callback, handler, this, mDeviceHandler, configureSuccess, callback, handler, this, mDeviceHandler, configureSuccess, mCharacteristics); mCharacteristics); } else { } else { newSession = new CameraCaptureSessionImpl(mNextSessionId++, input, newSession = new CameraCaptureSessionImpl(mNextSessionId++, input, outSurfaces, callback, handler, this, mDeviceHandler, callback, handler, this, mDeviceHandler, configureSuccess); configureSuccess); } } Loading Loading @@ -1946,11 +1942,17 @@ public class CameraDeviceImpl extends CameraDevice Runnable failureDispatch = null; Runnable failureDispatch = null; if (errorCode == ERROR_CAMERA_BUFFER) { if (errorCode == ERROR_CAMERA_BUFFER) { final Surface outputSurface = // Because 1 stream id could map to multiple surfaces, we need to specify both mConfiguredOutputs.get(resultExtras.getErrorStreamId()).getSurface(); // streamId and surfaceId. List<Surface> surfaces = mConfiguredOutputs.get(resultExtras.getErrorStreamId()).getSurfaces(); for (Surface surface : surfaces) { if (!request.containsTarget(surface)) { continue; } if (DEBUG) { if (DEBUG) { Log.v(TAG, String.format("Lost output buffer reported for frame %d, target %s", Log.v(TAG, String.format("Lost output buffer reported for frame %d, target %s", frameNumber, outputSurface)); frameNumber, surface)); } } failureDispatch = new Runnable() { failureDispatch = new Runnable() { @Override @Override Loading @@ -1959,11 +1961,14 @@ public class CameraDeviceImpl extends CameraDevice holder.getCallback().onCaptureBufferLost( holder.getCallback().onCaptureBufferLost( CameraDeviceImpl.this, CameraDeviceImpl.this, request, request, outputSurface, surface, frameNumber); frameNumber); } } } } }; }; // Dispatch the failure callback holder.getHandler().post(failureDispatch); } } else { } else { boolean mayHaveBuffers = (errorCode == ERROR_CAMERA_RESULT); boolean mayHaveBuffers = (errorCode == ERROR_CAMERA_RESULT); Loading Loading @@ -2000,12 +2005,13 @@ public class CameraDeviceImpl extends CameraDevice } } mFrameNumberTracker.updateTracker(frameNumber, /*error*/true, request.isReprocess()); mFrameNumberTracker.updateTracker(frameNumber, /*error*/true, request.isReprocess()); checkAndFireSequenceComplete(); checkAndFireSequenceComplete(); } // Dispatch the failure callback // Dispatch the failure callback holder.getHandler().post(failureDispatch); holder.getHandler().post(failureDispatch); } } } } // public class CameraDeviceCallbacks } // public class CameraDeviceCallbacks /** /** Loading core/java/android/hardware/camera2/params/OutputConfiguration.java +264 −61 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java +2 −8 Original line number Original line Diff line number Diff line Loading @@ -48,8 +48,6 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession /** Input surface configured by native camera framework based on user-specified configuration */ /** Input surface configured by native camera framework based on user-specified configuration */ private final Surface mInput; private final Surface mInput; /** User-specified set of surfaces used as the configuration outputs */ private final List<Surface> mOutputs; /** /** * User-specified state callback, used for outgoing events; calls to this object will be * User-specified state callback, used for outgoing events; calls to this object will be * automatically {@link Handler#post(Runnable) posted} to {@code mStateHandler}. * automatically {@link Handler#post(Runnable) posted} to {@code mStateHandler}. Loading Loading @@ -87,21 +85,17 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession * There must be no pending actions * There must be no pending actions * (e.g. no pending captures, no repeating requests, no flush).</p> * (e.g. no pending captures, no repeating requests, no flush).</p> */ */ CameraCaptureSessionImpl(int id, Surface input, List<Surface> outputs, CameraCaptureSessionImpl(int id, Surface input, CameraCaptureSession.StateCallback callback, Handler stateHandler, CameraCaptureSession.StateCallback callback, Handler stateHandler, android.hardware.camera2.impl.CameraDeviceImpl deviceImpl, android.hardware.camera2.impl.CameraDeviceImpl deviceImpl, Handler deviceStateHandler, boolean configureSuccess) { Handler deviceStateHandler, boolean configureSuccess) { if (outputs == null || outputs.isEmpty()) { if (callback == null) { throw new IllegalArgumentException("outputs must be a non-null, non-empty list"); } else if (callback == null) { throw new IllegalArgumentException("callback must not be null"); throw new IllegalArgumentException("callback must not be null"); } } mId = id; mId = id; mIdString = String.format("Session %d: ", mId); mIdString = String.format("Session %d: ", mId); // TODO: extra verification of outputs mOutputs = outputs; mInput = input; mInput = input; mStateHandler = checkHandler(stateHandler); mStateHandler = checkHandler(stateHandler); mStateCallback = createUserStateCallbackProxy(mStateHandler, callback); mStateCallback = createUserStateCallbackProxy(mStateHandler, callback); Loading
core/java/android/hardware/camera2/impl/CameraConstrainedHighSpeedCaptureSessionImpl.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -58,14 +58,14 @@ public class CameraConstrainedHighSpeedCaptureSessionImpl * There must be no pending actions * There must be no pending actions * (e.g. no pending captures, no repeating requests, no flush).</p> * (e.g. no pending captures, no repeating requests, no flush).</p> */ */ CameraConstrainedHighSpeedCaptureSessionImpl(int id, List<Surface> outputs, CameraConstrainedHighSpeedCaptureSessionImpl(int id, CameraCaptureSession.StateCallback callback, Handler stateHandler, CameraCaptureSession.StateCallback callback, Handler stateHandler, android.hardware.camera2.impl.CameraDeviceImpl deviceImpl, android.hardware.camera2.impl.CameraDeviceImpl deviceImpl, Handler deviceStateHandler, boolean configureSuccess, Handler deviceStateHandler, boolean configureSuccess, CameraCharacteristics characteristics) { CameraCharacteristics characteristics) { mCharacteristics = characteristics; mCharacteristics = characteristics; CameraCaptureSession.StateCallback wrapperCallback = new WrapperCallback(callback); CameraCaptureSession.StateCallback wrapperCallback = new WrapperCallback(callback); mSessionImpl = new CameraCaptureSessionImpl(id, /*input*/null, outputs, wrapperCallback, mSessionImpl = new CameraCaptureSessionImpl(id, /*input*/null, wrapperCallback, stateHandler, deviceImpl, deviceStateHandler, configureSuccess); stateHandler, deviceImpl, deviceStateHandler, configureSuccess); } } Loading
core/java/android/hardware/camera2/impl/CameraDeviceImpl.java +32 −26 Original line number Original line Diff line number Diff line Loading @@ -501,7 +501,7 @@ public class CameraDeviceImpl extends CameraDevice CameraCaptureSession.StateCallback callback, Handler handler) CameraCaptureSession.StateCallback callback, Handler handler) throws CameraAccessException { throws CameraAccessException { if (DEBUG) { if (DEBUG) { Log.d(TAG, "createCaptureSessionByOutputConfiguration"); Log.d(TAG, "createCaptureSessionByOutputConfigurations"); } } // OutputConfiguration objects are immutable, but need to have our own array // OutputConfiguration objects are immutable, but need to have our own array Loading Loading @@ -621,19 +621,15 @@ public class CameraDeviceImpl extends CameraDevice } } } } List<Surface> outSurfaces = new ArrayList<>(outputConfigurations.size()); for (OutputConfiguration config : outputConfigurations) { outSurfaces.add(config.getSurface()); } // Fire onConfigured if configureOutputs succeeded, fire onConfigureFailed otherwise. // Fire onConfigured if configureOutputs succeeded, fire onConfigureFailed otherwise. CameraCaptureSessionCore newSession = null; CameraCaptureSessionCore newSession = null; if (isConstrainedHighSpeed) { if (isConstrainedHighSpeed) { newSession = new CameraConstrainedHighSpeedCaptureSessionImpl(mNextSessionId++, newSession = new CameraConstrainedHighSpeedCaptureSessionImpl(mNextSessionId++, outSurfaces, callback, handler, this, mDeviceHandler, configureSuccess, callback, handler, this, mDeviceHandler, configureSuccess, mCharacteristics); mCharacteristics); } else { } else { newSession = new CameraCaptureSessionImpl(mNextSessionId++, input, newSession = new CameraCaptureSessionImpl(mNextSessionId++, input, outSurfaces, callback, handler, this, mDeviceHandler, callback, handler, this, mDeviceHandler, configureSuccess); configureSuccess); } } Loading Loading @@ -1946,11 +1942,17 @@ public class CameraDeviceImpl extends CameraDevice Runnable failureDispatch = null; Runnable failureDispatch = null; if (errorCode == ERROR_CAMERA_BUFFER) { if (errorCode == ERROR_CAMERA_BUFFER) { final Surface outputSurface = // Because 1 stream id could map to multiple surfaces, we need to specify both mConfiguredOutputs.get(resultExtras.getErrorStreamId()).getSurface(); // streamId and surfaceId. List<Surface> surfaces = mConfiguredOutputs.get(resultExtras.getErrorStreamId()).getSurfaces(); for (Surface surface : surfaces) { if (!request.containsTarget(surface)) { continue; } if (DEBUG) { if (DEBUG) { Log.v(TAG, String.format("Lost output buffer reported for frame %d, target %s", Log.v(TAG, String.format("Lost output buffer reported for frame %d, target %s", frameNumber, outputSurface)); frameNumber, surface)); } } failureDispatch = new Runnable() { failureDispatch = new Runnable() { @Override @Override Loading @@ -1959,11 +1961,14 @@ public class CameraDeviceImpl extends CameraDevice holder.getCallback().onCaptureBufferLost( holder.getCallback().onCaptureBufferLost( CameraDeviceImpl.this, CameraDeviceImpl.this, request, request, outputSurface, surface, frameNumber); frameNumber); } } } } }; }; // Dispatch the failure callback holder.getHandler().post(failureDispatch); } } else { } else { boolean mayHaveBuffers = (errorCode == ERROR_CAMERA_RESULT); boolean mayHaveBuffers = (errorCode == ERROR_CAMERA_RESULT); Loading Loading @@ -2000,12 +2005,13 @@ public class CameraDeviceImpl extends CameraDevice } } mFrameNumberTracker.updateTracker(frameNumber, /*error*/true, request.isReprocess()); mFrameNumberTracker.updateTracker(frameNumber, /*error*/true, request.isReprocess()); checkAndFireSequenceComplete(); checkAndFireSequenceComplete(); } // Dispatch the failure callback // Dispatch the failure callback holder.getHandler().post(failureDispatch); holder.getHandler().post(failureDispatch); } } } } // public class CameraDeviceCallbacks } // public class CameraDeviceCallbacks /** /** Loading
core/java/android/hardware/camera2/params/OutputConfiguration.java +264 −61 File changed.Preview size limit exceeded, changes collapsed. Show changes