Revert "stagefright: MediaCodec::releaseAsync()"
Revert submission 10446783-mediacodec-lazy-release
Reason for revert: back-to-back video playback jitters
Reverted Changes:
I119945684:stagefright: MediaCodec::releaseAsync()
Ieb4c0b2e1:media: lazy MediaCodec.release()
Bug: 150662913
Change-Id: I5dfbd4a09af5ab29b9a20d58e804ce43993f2088
diff --git a/services/mediaresourcemanager/ResourceManagerService.cpp b/services/mediaresourcemanager/ResourceManagerService.cpp
index ff45c87..be5af00 100644
--- a/services/mediaresourcemanager/ResourceManagerService.cpp
+++ b/services/mediaresourcemanager/ResourceManagerService.cpp
@@ -114,7 +114,6 @@
info.uid = uid;
info.clientId = clientId;
info.client = client;
- info.pendingRemoval = false;
index = infos.add(clientId, info);
}
@@ -649,36 +648,6 @@
return Status::ok();
}
-Status ResourceManagerService::markClientForPendingRemoval(int32_t pid, int64_t clientId) {
- String8 log = String8::format(
- "markClientForPendingRemoval(pid %d, clientId %lld)",
- pid, (long long) clientId);
- mServiceLog->add(log);
-
- Mutex::Autolock lock(mLock);
- if (!mProcessInfo->isValidPid(pid)) {
- ALOGE("Rejected markClientForPendingRemoval call with invalid pid.");
- return Status::fromServiceSpecificError(BAD_VALUE);
- }
- ssize_t index = mMap.indexOfKey(pid);
- if (index < 0) {
- ALOGV("markClientForPendingRemoval: didn't find pid %d for clientId %lld",
- pid, (long long)clientId);
- return Status::ok();
- }
- ResourceInfos &infos = mMap.editValueAt(index);
-
- index = infos.indexOfKey(clientId);
- if (index < 0) {
- ALOGV("markClientForPendingRemoval: didn't find clientId %lld", (long long) clientId);
- return Status::ok();
- }
-
- ResourceInfo &info = infos.editValueAt(index);
- info.pendingRemoval = true;
- return Status::ok();
-}
-
bool ResourceManagerService::getPriority_l(int pid, int* priority) {
int newPid = pid;
@@ -724,12 +693,6 @@
int lowestPriorityPid;
int lowestPriority;
int callingPriority;
-
- // Before looking into other processes, check if we have clients marked for
- // pending removal in the same process.
- if (getBiggestClient_l(callingPid, type, client, true /* pendingRemovalOnly */)) {
- return true;
- }
if (!getPriority_l(callingPid, &callingPriority)) {
ALOGE("getLowestPriorityBiggestClient_l: can't get process priority for pid %d",
callingPid);
@@ -798,8 +761,7 @@
}
bool ResourceManagerService::getBiggestClient_l(
- int pid, MediaResource::Type type, std::shared_ptr<IResourceManagerClient> *client,
- bool pendingRemovalOnly) {
+ int pid, MediaResource::Type type, std::shared_ptr<IResourceManagerClient> *client) {
ssize_t index = mMap.indexOfKey(pid);
if (index < 0) {
ALOGE("getBiggestClient_l: can't find resource info for pid %d", pid);
@@ -811,9 +773,6 @@
const ResourceInfos &infos = mMap.valueAt(index);
for (size_t i = 0; i < infos.size(); ++i) {
const ResourceList &resources = infos[i].resources;
- if (pendingRemovalOnly && !infos[i].pendingRemoval) {
- continue;
- }
for (auto it = resources.begin(); it != resources.end(); it++) {
const MediaResourceParcel &resource = it->second;
if (resource.type == type) {