Loading services/camera/libcameraservice/api1/client2/CallbackProcessor.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -121,18 +121,17 @@ status_t CallbackProcessor::updateStream(const Parameters ¶ms) { if (mCallbackStreamId != NO_STREAM) { // Check if stream parameters have to change uint32_t currentWidth, currentHeight, currentFormat; res = device->getStreamInfo(mCallbackStreamId, ¤tWidth, ¤tHeight, ¤tFormat, 0); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mCallbackStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying callback output stream info: " "%s (%d)", __FUNCTION__, mId, strerror(-res), res); return res; } if (currentWidth != (uint32_t)params.previewWidth || currentHeight != (uint32_t)params.previewHeight || currentFormat != (uint32_t)callbackFormat) { if (streamInfo.width != (uint32_t)params.previewWidth || streamInfo.height != (uint32_t)params.previewHeight || !streamInfo.matchFormat((uint32_t)callbackFormat)) { // Since size should only change while preview is not running, // assuming that all existing use of old callback stream is // completed. Loading services/camera/libcameraservice/api1/client2/JpegProcessor.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -136,17 +136,16 @@ status_t JpegProcessor::updateStream(const Parameters ¶ms) { if (mCaptureStreamId != NO_STREAM) { // Check if stream parameters have to change uint32_t currentWidth, currentHeight; res = device->getStreamInfo(mCaptureStreamId, ¤tWidth, ¤tHeight, 0, 0); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mCaptureStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying capture output stream info: " "%s (%d)", __FUNCTION__, mId, strerror(-res), res); return res; } if (currentWidth != (uint32_t)params.pictureWidth || currentHeight != (uint32_t)params.pictureHeight) { if (streamInfo.width != (uint32_t)params.pictureWidth || streamInfo.height != (uint32_t)params.pictureHeight) { ALOGV("%s: Camera %d: Deleting stream %d since the buffer dimensions changed", __FUNCTION__, mId, mCaptureStreamId); res = device->deleteStream(mCaptureStreamId); Loading services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp +17 −24 Original line number Diff line number Diff line Loading @@ -161,18 +161,17 @@ status_t StreamingProcessor::updatePreviewStream(const Parameters ¶ms) { if (mPreviewStreamId != NO_STREAM) { // Check if stream parameters have to change uint32_t currentWidth, currentHeight; res = device->getStreamInfo(mPreviewStreamId, ¤tWidth, ¤tHeight, 0, 0); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mPreviewStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying preview stream info: " "%s (%d)", __FUNCTION__, mId, strerror(-res), res); return res; } if (currentWidth != (uint32_t)params.previewWidth || currentHeight != (uint32_t)params.previewHeight) { if (streamInfo.width != (uint32_t)params.previewWidth || streamInfo.height != (uint32_t)params.previewHeight) { ALOGV("%s: Camera %d: Preview size switch: %d x %d -> %d x %d", __FUNCTION__, mId, currentWidth, currentHeight, __FUNCTION__, mId, streamInfo.width, streamInfo.height, params.previewWidth, params.previewHeight); res = device->waitUntilDrained(); if (res != OK) { Loading Loading @@ -312,10 +311,8 @@ status_t StreamingProcessor::recordingStreamNeedsUpdate( return INVALID_OPERATION; } uint32_t currentWidth, currentHeight, currentFormat; android_dataspace currentDataSpace; res = device->getStreamInfo(mRecordingStreamId, ¤tWidth, ¤tHeight, ¤tFormat, ¤tDataSpace); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mRecordingStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying recording output stream info: " "%s (%d)", __FUNCTION__, mId, Loading @@ -324,10 +321,10 @@ status_t StreamingProcessor::recordingStreamNeedsUpdate( } if (mRecordingWindow == nullptr || currentWidth != (uint32_t)params.videoWidth || currentHeight != (uint32_t)params.videoHeight || currentFormat != (uint32_t)params.videoFormat || currentDataSpace != params.videoDataSpace) { streamInfo.width != (uint32_t)params.videoWidth || streamInfo.height != (uint32_t)params.videoHeight || !streamInfo.matchFormat((uint32_t)params.videoFormat) || streamInfo.dataSpace != params.videoDataSpace) { *needsUpdate = true; return res; } Loading @@ -348,22 +345,18 @@ status_t StreamingProcessor::updateRecordingStream(const Parameters ¶ms) { if (mRecordingStreamId != NO_STREAM) { // Check if stream parameters have to change uint32_t currentWidth, currentHeight; uint32_t currentFormat; android_dataspace currentDataSpace; res = device->getStreamInfo(mRecordingStreamId, ¤tWidth, ¤tHeight, ¤tFormat, ¤tDataSpace); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mRecordingStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying recording output stream info: " "%s (%d)", __FUNCTION__, mId, strerror(-res), res); return res; } if (currentWidth != (uint32_t)params.videoWidth || currentHeight != (uint32_t)params.videoHeight || currentFormat != (uint32_t)params.videoFormat || currentDataSpace != params.videoDataSpace) { if (streamInfo.width != (uint32_t)params.videoWidth || streamInfo.height != (uint32_t)params.videoHeight || !streamInfo.matchFormat((uint32_t)params.videoFormat) || streamInfo.dataSpace != params.videoDataSpace) { // TODO: Should wait to be sure previous recording has finished res = device->deleteStream(mRecordingStreamId); Loading services/camera/libcameraservice/api1/client2/ZslProcessor.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -233,17 +233,16 @@ status_t ZslProcessor::updateStream(const Parameters ¶ms) { if ((mZslStreamId != NO_STREAM) || (mInputStreamId != NO_STREAM)) { // Check if stream parameters have to change uint32_t currentWidth, currentHeight; res = device->getStreamInfo(mZslStreamId, ¤tWidth, ¤tHeight, 0, 0); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mZslStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying capture output stream info: " "%s (%d)", __FUNCTION__, client->getCameraId(), strerror(-res), res); return res; } if (currentWidth != (uint32_t)params.fastInfo.arrayWidth || currentHeight != (uint32_t)params.fastInfo.arrayHeight) { if (streamInfo.width != (uint32_t)params.fastInfo.arrayWidth || streamInfo.height != (uint32_t)params.fastInfo.arrayHeight) { if (mZslStreamId != NO_STREAM) { ALOGV("%s: Camera %d: Deleting stream %d since the buffer " "dimensions changed", Loading services/camera/libcameraservice/common/CameraDeviceBase.h +23 −3 Original line number Diff line number Diff line Loading @@ -142,12 +142,32 @@ class CameraDeviceBase : public virtual RefBase { virtual status_t createInputStream(uint32_t width, uint32_t height, int32_t format, /*out*/ int32_t *id) = 0; struct StreamInfo { uint32_t width; uint32_t height; uint32_t format; bool formatOverridden; uint32_t originalFormat; android_dataspace dataSpace; StreamInfo() : width(0), height(0), format(0), formatOverridden(false), originalFormat(0), dataSpace(HAL_DATASPACE_UNKNOWN) {} /** * Check whether the format matches the current or the original one in case * it got overridden. */ bool matchFormat(uint32_t clientFormat) { if ((formatOverridden && (originalFormat == clientFormat)) || (format == clientFormat)) { return true; } return false; } }; /** * Get information about a given stream. */ virtual status_t getStreamInfo(int id, uint32_t *width, uint32_t *height, uint32_t *format, android_dataspace *dataSpace) = 0; virtual status_t getStreamInfo(int id, StreamInfo *streamInfo) = 0; /** * Set stream gralloc buffer transform Loading Loading
services/camera/libcameraservice/api1/client2/CallbackProcessor.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -121,18 +121,17 @@ status_t CallbackProcessor::updateStream(const Parameters ¶ms) { if (mCallbackStreamId != NO_STREAM) { // Check if stream parameters have to change uint32_t currentWidth, currentHeight, currentFormat; res = device->getStreamInfo(mCallbackStreamId, ¤tWidth, ¤tHeight, ¤tFormat, 0); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mCallbackStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying callback output stream info: " "%s (%d)", __FUNCTION__, mId, strerror(-res), res); return res; } if (currentWidth != (uint32_t)params.previewWidth || currentHeight != (uint32_t)params.previewHeight || currentFormat != (uint32_t)callbackFormat) { if (streamInfo.width != (uint32_t)params.previewWidth || streamInfo.height != (uint32_t)params.previewHeight || !streamInfo.matchFormat((uint32_t)callbackFormat)) { // Since size should only change while preview is not running, // assuming that all existing use of old callback stream is // completed. Loading
services/camera/libcameraservice/api1/client2/JpegProcessor.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -136,17 +136,16 @@ status_t JpegProcessor::updateStream(const Parameters ¶ms) { if (mCaptureStreamId != NO_STREAM) { // Check if stream parameters have to change uint32_t currentWidth, currentHeight; res = device->getStreamInfo(mCaptureStreamId, ¤tWidth, ¤tHeight, 0, 0); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mCaptureStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying capture output stream info: " "%s (%d)", __FUNCTION__, mId, strerror(-res), res); return res; } if (currentWidth != (uint32_t)params.pictureWidth || currentHeight != (uint32_t)params.pictureHeight) { if (streamInfo.width != (uint32_t)params.pictureWidth || streamInfo.height != (uint32_t)params.pictureHeight) { ALOGV("%s: Camera %d: Deleting stream %d since the buffer dimensions changed", __FUNCTION__, mId, mCaptureStreamId); res = device->deleteStream(mCaptureStreamId); Loading
services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp +17 −24 Original line number Diff line number Diff line Loading @@ -161,18 +161,17 @@ status_t StreamingProcessor::updatePreviewStream(const Parameters ¶ms) { if (mPreviewStreamId != NO_STREAM) { // Check if stream parameters have to change uint32_t currentWidth, currentHeight; res = device->getStreamInfo(mPreviewStreamId, ¤tWidth, ¤tHeight, 0, 0); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mPreviewStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying preview stream info: " "%s (%d)", __FUNCTION__, mId, strerror(-res), res); return res; } if (currentWidth != (uint32_t)params.previewWidth || currentHeight != (uint32_t)params.previewHeight) { if (streamInfo.width != (uint32_t)params.previewWidth || streamInfo.height != (uint32_t)params.previewHeight) { ALOGV("%s: Camera %d: Preview size switch: %d x %d -> %d x %d", __FUNCTION__, mId, currentWidth, currentHeight, __FUNCTION__, mId, streamInfo.width, streamInfo.height, params.previewWidth, params.previewHeight); res = device->waitUntilDrained(); if (res != OK) { Loading Loading @@ -312,10 +311,8 @@ status_t StreamingProcessor::recordingStreamNeedsUpdate( return INVALID_OPERATION; } uint32_t currentWidth, currentHeight, currentFormat; android_dataspace currentDataSpace; res = device->getStreamInfo(mRecordingStreamId, ¤tWidth, ¤tHeight, ¤tFormat, ¤tDataSpace); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mRecordingStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying recording output stream info: " "%s (%d)", __FUNCTION__, mId, Loading @@ -324,10 +321,10 @@ status_t StreamingProcessor::recordingStreamNeedsUpdate( } if (mRecordingWindow == nullptr || currentWidth != (uint32_t)params.videoWidth || currentHeight != (uint32_t)params.videoHeight || currentFormat != (uint32_t)params.videoFormat || currentDataSpace != params.videoDataSpace) { streamInfo.width != (uint32_t)params.videoWidth || streamInfo.height != (uint32_t)params.videoHeight || !streamInfo.matchFormat((uint32_t)params.videoFormat) || streamInfo.dataSpace != params.videoDataSpace) { *needsUpdate = true; return res; } Loading @@ -348,22 +345,18 @@ status_t StreamingProcessor::updateRecordingStream(const Parameters ¶ms) { if (mRecordingStreamId != NO_STREAM) { // Check if stream parameters have to change uint32_t currentWidth, currentHeight; uint32_t currentFormat; android_dataspace currentDataSpace; res = device->getStreamInfo(mRecordingStreamId, ¤tWidth, ¤tHeight, ¤tFormat, ¤tDataSpace); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mRecordingStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying recording output stream info: " "%s (%d)", __FUNCTION__, mId, strerror(-res), res); return res; } if (currentWidth != (uint32_t)params.videoWidth || currentHeight != (uint32_t)params.videoHeight || currentFormat != (uint32_t)params.videoFormat || currentDataSpace != params.videoDataSpace) { if (streamInfo.width != (uint32_t)params.videoWidth || streamInfo.height != (uint32_t)params.videoHeight || !streamInfo.matchFormat((uint32_t)params.videoFormat) || streamInfo.dataSpace != params.videoDataSpace) { // TODO: Should wait to be sure previous recording has finished res = device->deleteStream(mRecordingStreamId); Loading
services/camera/libcameraservice/api1/client2/ZslProcessor.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -233,17 +233,16 @@ status_t ZslProcessor::updateStream(const Parameters ¶ms) { if ((mZslStreamId != NO_STREAM) || (mInputStreamId != NO_STREAM)) { // Check if stream parameters have to change uint32_t currentWidth, currentHeight; res = device->getStreamInfo(mZslStreamId, ¤tWidth, ¤tHeight, 0, 0); CameraDeviceBase::StreamInfo streamInfo; res = device->getStreamInfo(mZslStreamId, &streamInfo); if (res != OK) { ALOGE("%s: Camera %d: Error querying capture output stream info: " "%s (%d)", __FUNCTION__, client->getCameraId(), strerror(-res), res); return res; } if (currentWidth != (uint32_t)params.fastInfo.arrayWidth || currentHeight != (uint32_t)params.fastInfo.arrayHeight) { if (streamInfo.width != (uint32_t)params.fastInfo.arrayWidth || streamInfo.height != (uint32_t)params.fastInfo.arrayHeight) { if (mZslStreamId != NO_STREAM) { ALOGV("%s: Camera %d: Deleting stream %d since the buffer " "dimensions changed", Loading
services/camera/libcameraservice/common/CameraDeviceBase.h +23 −3 Original line number Diff line number Diff line Loading @@ -142,12 +142,32 @@ class CameraDeviceBase : public virtual RefBase { virtual status_t createInputStream(uint32_t width, uint32_t height, int32_t format, /*out*/ int32_t *id) = 0; struct StreamInfo { uint32_t width; uint32_t height; uint32_t format; bool formatOverridden; uint32_t originalFormat; android_dataspace dataSpace; StreamInfo() : width(0), height(0), format(0), formatOverridden(false), originalFormat(0), dataSpace(HAL_DATASPACE_UNKNOWN) {} /** * Check whether the format matches the current or the original one in case * it got overridden. */ bool matchFormat(uint32_t clientFormat) { if ((formatOverridden && (originalFormat == clientFormat)) || (format == clientFormat)) { return true; } return false; } }; /** * Get information about a given stream. */ virtual status_t getStreamInfo(int id, uint32_t *width, uint32_t *height, uint32_t *format, android_dataspace *dataSpace) = 0; virtual status_t getStreamInfo(int id, StreamInfo *streamInfo) = 0; /** * Set stream gralloc buffer transform Loading