Remove dead codecs from ResourceManagerService
When a codec is dead, the resources aren't always removed from
ResourceManagerService, causing MediaCodec to attempt to reclaim
resources continuously without actually doing any reclaiming. Remove the
resources from ResourceManagerService when a dead codec is identified.
Passing 10 iterations on coral-userdebug:
https://android-build.googleplex.com/builds/abtd/run/L09800000954236443
Filed b/230362034 to do further investigation as to why the resources
aren't being removed.
Bug: 229848597
Bug: 228238915
Fixes: 229848597
Fixes: 228238915
Test: atest MediaCodecResourceTest
Change-Id: I81f76742c48d5bc61f89f569a20a1dc54bb9f440
diff --git a/services/mediaresourcemanager/ResourceManagerService.cpp b/services/mediaresourcemanager/ResourceManagerService.cpp
index e0584df..b4610bc 100644
--- a/services/mediaresourcemanager/ResourceManagerService.cpp
+++ b/services/mediaresourcemanager/ResourceManagerService.cpp
@@ -732,6 +732,7 @@
return true;
}
+ int failedClientPid = -1;
{
Mutex::Autolock lock(mLock);
bool found = false;
@@ -746,11 +747,14 @@
}
}
if (found) {
+ failedClientPid = mMap.keyAt(i);
break;
}
}
- if (!found) {
- ALOGV("didn't find failed client");
+ if (found) {
+ ALOGW("Failed to reclaim resources from client with pid %d", failedClientPid);
+ } else {
+ ALOGW("Failed to reclaim resources from unlocateable client");
}
}