diff options
author | Chien-Yu Chen <cychen@google.com> | 2017-09-20 11:10:21 -0700 |
---|---|---|
committer | Chien-Yu Chen <cychen@google.com> | 2017-09-20 11:58:32 -0700 |
commit | 3d83627b8a23dfe497f612a5f1d1e17caef3839e (patch) | |
tree | 063ffe14f9dfd71139d31d0c77783cb4744609ea | |
parent | 0c8eaaa140a6051b76390ca5584fbcddd1cef259 (diff) | |
download | camera-3d83627b8a23dfe497f612a5f1d1e17caef3839e.tar.gz |
QCamera3: Make sure stream IDs are unique
If the stream configuration is called again, the indices of
the stream in new stream configuration may be the same as
the old stream configuration, which results in the same
stream ID for two different streams after stream cleanup.
This CL ensures that stream IDs are unique after each
stream configuration.
Test: CTS
Bug: 64117056
Change-Id: I1dd7d8e67a49b48d6f6448d1ed37b1537555b6e7
-rw-r--r-- | msm8998/QCamera2/HAL3/QCamera3HWI.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/msm8998/QCamera2/HAL3/QCamera3HWI.cpp b/msm8998/QCamera2/HAL3/QCamera3HWI.cpp index 7b4dcb7..95f90d5 100644 --- a/msm8998/QCamera2/HAL3/QCamera3HWI.cpp +++ b/msm8998/QCamera2/HAL3/QCamera3HWI.cpp @@ -2243,7 +2243,7 @@ int QCamera3HardwareInterface::configureStreamsPerfLocked( stream_info->stream = newStream; stream_info->status = VALID; stream_info->channel = NULL; - stream_info->id = i; + stream_info->id = i; // ID will be re-assigned in cleanAndSortStreamInfo(). mStreamInfo.push_back(stream_info); } /* Covers Opaque ZSL and API1 F/W ZSL */ @@ -8681,6 +8681,13 @@ void QCamera3HardwareInterface::cleanAndSortStreamInfo() } mStreamInfo = newStreamInfo; + + // Make sure that stream IDs are unique. + uint32_t id = 0; + for (auto streamInfo : mStreamInfo) { + streamInfo->id = id++; + } + } /*=========================================================================== |