media.bufferpool2: Ensure uniqueness of connection id

Currently same connection id can be given to different connections if
they don't belong to the same bufferpool.

Ensure uniqueness of connection id for each connection.

Bug: 323793249
Change-Id: I350872e6d60736ea4525d473944c92b5fe3f5f84
diff --git a/media/bufferpool/aidl/default/Accessor.h b/media/bufferpool/aidl/default/Accessor.h
index 85e2fa7..0ebe347 100644
--- a/media/bufferpool/aidl/default/Accessor.h
+++ b/media/bufferpool/aidl/default/Accessor.h
@@ -189,7 +189,14 @@
 private:
     // ConnectionId = pid : (timestamp_created + seqId)
     // in order to guarantee uniqueness for each connection
-    static uint32_t sSeqId;
+    struct ConnectionIdGenerator {
+        int32_t mPid;
+        uint32_t mSeqId;
+        std::mutex mLock;
+
+        ConnectionIdGenerator();
+        ConnectionId getConnectionId();
+    };
 
     const std::shared_ptr<BufferPoolAllocator> mAllocator;
     nsecs_t mScheduleEvictTs;