diff options
author | Zhijun He <zhijunhe@google.com> | 2014-01-22 09:49:33 -0800 |
---|---|---|
committer | Zhijun He <zhijunhe@google.com> | 2014-01-27 14:11:29 -0800 |
commit | 5f44635dc35814b98b4dc2b255355a93122fec59 (patch) | |
tree | 71ddfbeec0e62ef39f204e1fc958fd34f07f78d6 /services/camera/libcameraservice/device3/Camera3Device.cpp | |
parent | b2b9b2dbdbc0445080d3c2d15212a43ba1f9cff1 (diff) | |
download | frameworks_av-5f44635dc35814b98b4dc2b255355a93122fec59.zip frameworks_av-5f44635dc35814b98b4dc2b255355a93122fec59.tar.gz frameworks_av-5f44635dc35814b98b4dc2b255355a93122fec59.tar.bz2 |
camera3: Delete output stream of bi-directional stream
Bi-directional stream (like Zsl stream) is both input and output streams. When
deleted, both streams need to be deleted.
Change-Id: I8b6bb9054fec264cc03754003797de0bae10cb20
Diffstat (limited to 'services/camera/libcameraservice/device3/Camera3Device.cpp')
-rw-r--r-- | services/camera/libcameraservice/device3/Camera3Device.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp index 3c73e17..da3e121 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.cpp +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp @@ -840,16 +840,20 @@ status_t Camera3Device::deleteStream(int id) { } sp<Camera3StreamInterface> deletedStream; + ssize_t outputStreamIdx = mOutputStreams.indexOfKey(id); if (mInputStream != NULL && id == mInputStream->getId()) { deletedStream = mInputStream; mInputStream.clear(); } else { - ssize_t idx = mOutputStreams.indexOfKey(id); - if (idx == NAME_NOT_FOUND) { + if (outputStreamIdx == NAME_NOT_FOUND) { CLOGE("Stream %d does not exist", id); return BAD_VALUE; } - deletedStream = mOutputStreams.editValueAt(idx); + } + + // Delete output stream or the output part of a bi-directional stream. + if (outputStreamIdx != NAME_NOT_FOUND) { + deletedStream = mOutputStreams.editValueAt(outputStreamIdx); mOutputStreams.removeItem(id); } |