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
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 @@
             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 @@
     }
 
     mStreamInfo = newStreamInfo;
+
+    // Make sure that stream IDs are unique.
+    uint32_t id = 0;
+    for (auto streamInfo : mStreamInfo) {
+        streamInfo->id = id++;
+    }
+
 }
 
 /*===========================================================================