Merge "Revert "Camera2: create new streams if surface size has changed""
This commit is contained in:
@@ -95,8 +95,6 @@ public class CameraDeviceImpl extends CameraDevice {
|
|||||||
new SimpleEntry<>(REQUEST_ID_NONE, null);
|
new SimpleEntry<>(REQUEST_ID_NONE, null);
|
||||||
private final SparseArray<OutputConfiguration> mConfiguredOutputs =
|
private final SparseArray<OutputConfiguration> mConfiguredOutputs =
|
||||||
new SparseArray<>();
|
new SparseArray<>();
|
||||||
private final SparseArray<Size> mConfiguredOutputSizes =
|
|
||||||
new SparseArray<>();
|
|
||||||
|
|
||||||
private final String mCameraId;
|
private final String mCameraId;
|
||||||
private final CameraCharacteristics mCharacteristics;
|
private final CameraCharacteristics mCharacteristics;
|
||||||
@@ -390,14 +388,7 @@ public class CameraDeviceImpl extends CameraDevice {
|
|||||||
if (!outputs.contains(outConfig)) {
|
if (!outputs.contains(outConfig)) {
|
||||||
deleteList.add(streamId);
|
deleteList.add(streamId);
|
||||||
} else {
|
} else {
|
||||||
// Even if same surface and rotation, the surface can have re-sized.
|
addSet.remove(outConfig); // Don't create a stream previously created
|
||||||
// If so, we must create a new stream to ensure HAL is configured correctly.
|
|
||||||
Size outSize = SurfaceUtils.getSurfaceSize(outConfig.getSurface());
|
|
||||||
if (!outSize.equals(mConfiguredOutputSizes.valueAt(i))) {
|
|
||||||
deleteList.add(streamId);
|
|
||||||
} else {
|
|
||||||
addSet.remove(outConfig); // Don't create a stream previously created
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,16 +421,13 @@ public class CameraDeviceImpl extends CameraDevice {
|
|||||||
for (Integer streamId : deleteList) {
|
for (Integer streamId : deleteList) {
|
||||||
mRemoteDevice.deleteStream(streamId);
|
mRemoteDevice.deleteStream(streamId);
|
||||||
mConfiguredOutputs.delete(streamId);
|
mConfiguredOutputs.delete(streamId);
|
||||||
mConfiguredOutputSizes.delete(streamId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add all new streams
|
// Add all new streams
|
||||||
for (OutputConfiguration outConfig : outputs) {
|
for (OutputConfiguration outConfig : outputs) {
|
||||||
if (addSet.contains(outConfig)) {
|
if (addSet.contains(outConfig)) {
|
||||||
int streamId = mRemoteDevice.createStream(outConfig);
|
int streamId = mRemoteDevice.createStream(outConfig);
|
||||||
Size outSize = SurfaceUtils.getSurfaceSize(outConfig.getSurface());
|
|
||||||
mConfiguredOutputs.put(streamId, outConfig);
|
mConfiguredOutputs.put(streamId, outConfig);
|
||||||
mConfiguredOutputSizes.put(streamId, outSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user