summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-06-12 17:21:01 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-06-12 17:21:01 +0000
commitd32c56d24d645e15160ff221c4f7a6a5652b77e1 (patch)
tree33ac662087f5fc8368fb6390a74989694696344c
parent7883b53e283cd69c8e556773a212b6c0e59fe9ac (diff)
parent071e7dcc2bda77bab2edc2837df3028c0c08e3d9 (diff)
Merge "Merge "Add mutual exclusion access for addOrUpdateStream and removeStream" am: af108c45d6 am: 760c2bccd2 am: bd580a07b4 am: 91e082a90d am: 7f6cc71fe5" into rvc-dev
-rw-r--r--services/core/jni/com_android_server_tv_TvInputHal.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/services/core/jni/com_android_server_tv_TvInputHal.cpp b/services/core/jni/com_android_server_tv_TvInputHal.cpp
index 098b2ef6439d..4e1a23416330 100644
--- a/services/core/jni/com_android_server_tv_TvInputHal.cpp
+++ b/services/core/jni/com_android_server_tv_TvInputHal.cpp
@@ -301,6 +301,7 @@ private:
JTvInputHal(JNIEnv* env, jobject thiz, sp<ITvInput> tvInput, const sp<Looper>& looper);
Mutex mLock;
+ Mutex mStreamLock;
jweak mThiz;
sp<Looper> mLooper;
@@ -338,6 +339,7 @@ JTvInputHal* JTvInputHal::createInstance(JNIEnv* env, jobject thiz, const sp<Loo
}
int JTvInputHal::addOrUpdateStream(int deviceId, int streamId, const sp<Surface>& surface) {
+ Mutex::Autolock autoLock(&mStreamLock);
KeyedVector<int, Connection>& connections = mConnections.editValueFor(deviceId);
if (connections.indexOfKey(streamId) < 0) {
connections.add(streamId, Connection());
@@ -412,6 +414,7 @@ int JTvInputHal::addOrUpdateStream(int deviceId, int streamId, const sp<Surface>
}
int JTvInputHal::removeStream(int deviceId, int streamId) {
+ Mutex::Autolock autoLock(&mStreamLock);
KeyedVector<int, Connection>& connections = mConnections.editValueFor(deviceId);
if (connections.indexOfKey(streamId) < 0) {
return BAD_VALUE;