Revert "transcoding: add thermal status listener"
This reverts commit a960d1d94d2ef121d6fab50eeb89bfdae6c2d16a.
Reason for revert: broke build due to race condition with automerger
Change-Id: I1e64e54bf1c37a9cf8cddf9128469b0fbf931e8b
diff --git a/media/libmediatranscoding/TranscodingSessionController.cpp b/media/libmediatranscoding/TranscodingSessionController.cpp
index 09ad3cd..b77a3a4 100644
--- a/media/libmediatranscoding/TranscodingSessionController.cpp
+++ b/media/libmediatranscoding/TranscodingSessionController.cpp
@@ -63,12 +63,10 @@
TranscodingSessionController::TranscodingSessionController(
const std::shared_ptr<TranscoderInterface>& transcoder,
const std::shared_ptr<UidPolicyInterface>& uidPolicy,
- const std::shared_ptr<ResourcePolicyInterface>& resourcePolicy,
- const std::shared_ptr<ThermalPolicyInterface>& thermalPolicy)
+ const std::shared_ptr<ResourcePolicyInterface>& resourcePolicy)
: mTranscoder(transcoder),
mUidPolicy(uidPolicy),
mResourcePolicy(resourcePolicy),
- mThermalPolicy(thermalPolicy),
mCurrentSession(nullptr),
mResourceLost(false) {
// Only push empty offline queue initially. Realtime queues are added when requests come in.
@@ -76,7 +74,6 @@
mOfflineUidIterator = mUidSortedList.begin();
mSessionQueues.emplace(OFFLINE_UID, SessionQueueType());
mUidPackageNames[OFFLINE_UID] = "(offline)";
- mThermalThrottling = thermalPolicy->getThrottlingStatus();
}
TranscodingSessionController::~TranscodingSessionController() {}
@@ -144,7 +141,7 @@
snprintf(buffer, SIZE, "\n========== Dumping past sessions =========\n");
result.append(buffer);
- for (auto& session : mSessionHistory) {
+ for (auto &session : mSessionHistory) {
dumpSession_l(session, result, true /*closedSession*/);
}
@@ -195,27 +192,18 @@
topSession == nullptr ? "null" : sessionToString(topSession->key).c_str(),
curSession == nullptr ? "null" : sessionToString(curSession->key).c_str());
- if (topSession == nullptr) {
- mCurrentSession = nullptr;
- return;
- }
-
- bool shouldBeRunning = !((mResourcePolicy != nullptr && mResourceLost) ||
- (mThermalPolicy != nullptr && mThermalThrottling));
// If we found a topSession that should be run, and it's not already running,
// take some actions to ensure it's running.
- if (topSession != curSession ||
- (shouldBeRunning ^ (topSession->getState() == Session::RUNNING))) {
- // If current session is running, pause it first. Note this is true for either
- // cases: 1) If top session is changing, or 2) if top session is not changing but
- // the topSession's state is changing.
+ if (topSession != nullptr &&
+ (topSession != curSession || topSession->getState() != Session::RUNNING)) {
+ // If another session is currently running, pause it first.
if (curSession != nullptr && curSession->getState() == Session::RUNNING) {
mTranscoder->pause(curSession->key.first, curSession->key.second);
curSession->setState(Session::PAUSED);
}
- // If we are not experiencing resource loss nor thermal throttling, we can start
- // or resume the topSession now.
- if (shouldBeRunning) {
+ // If we are not experiencing resource loss, we can start or resume
+ // the topSession now.
+ if (!mResourceLost) {
if (topSession->getState() == Session::NOT_STARTED) {
mTranscoder->start(topSession->key.first, topSession->key.second,
topSession->request, topSession->callback.lock());
@@ -578,9 +566,7 @@
if (clientCallback != nullptr) {
clientCallback->onTranscodingPaused(sessionKey.second);
}
- if (mResourcePolicy != nullptr) {
- mResourcePolicy->setPidResourceLost(resourceLostSession->request.clientPid);
- }
+ mResourcePolicy->setPidResourceLost(resourceLostSession->request.clientPid);
mResourceLost = true;
validateState_l();
@@ -627,36 +613,6 @@
validateState_l();
}
-void TranscodingSessionController::onThrottlingStarted() {
- std::scoped_lock lock{mLock};
-
- if (mThermalThrottling) {
- return;
- }
-
- ALOGI("%s", __FUNCTION__);
-
- mThermalThrottling = true;
- updateCurrentSession_l();
-
- validateState_l();
-}
-
-void TranscodingSessionController::onThrottlingStopped() {
- std::scoped_lock lock{mLock};
-
- if (!mThermalThrottling) {
- return;
- }
-
- ALOGI("%s", __FUNCTION__);
-
- mThermalThrottling = false;
- updateCurrentSession_l();
-
- validateState_l();
-}
-
void TranscodingSessionController::validateState_l() {
#ifdef VALIDATE_STATE
LOG_ALWAYS_FATAL_IF(mSessionQueues.count(OFFLINE_UID) != 1,