Commit 204e218b authored by Simon Morlat's avatar Simon Morlat
Browse files

Fix : move Cpu lock and so on into the Call object. There are not needed for...

Fix : move Cpu lock and so on into the Call object. There are not needed for INVITE sessions without media (like group chat), and they cause important battery drain because the phone will stay awake all the time since the INVITE session never BYEs.
parent 9c904e79
......@@ -285,6 +285,21 @@ void CallPrivate::onCallSessionStartReferred (const shared_ptr<CallSession> &ses
void CallPrivate::onCallSessionStateChanged (const shared_ptr<CallSession> &session, CallSession::State state, const string &message) {
L_Q();
switch(state){
case CallSession::State::OutgoingInit:
case CallSession::State::IncomingReceived:
getPlatformHelpers(q->getCore()->getCCore())->acquireWifiLock();
getPlatformHelpers(q->getCore()->getCCore())->acquireMcastLock();
getPlatformHelpers(q->getCore()->getCCore())->acquireCpuLock();
break;
case CallSession::State::Released:
getPlatformHelpers(q->getCore()->getCCore())->releaseWifiLock();
getPlatformHelpers(q->getCore()->getCCore())->releaseMcastLock();
getPlatformHelpers(q->getCore()->getCCore())->releaseCpuLock();
break;
default:
break;
}
linphone_call_notify_state_changed(L_GET_C_BACK_PTR(q), static_cast<LinphoneCallState>(state), message.c_str());
}
......
......@@ -86,12 +86,6 @@ void CallSessionPrivate::setState (CallSession::State newState, const string &me
}
switch (newState) {
case CallSession::State::OutgoingInit:
case CallSession::State::IncomingReceived:
getPlatformHelpers(q->getCore()->getCCore())->acquireWifiLock();
getPlatformHelpers(q->getCore()->getCCore())->acquireMcastLock();
getPlatformHelpers(q->getCore()->getCCore())->acquireCpuLock();
break;
case CallSession::State::End:
case CallSession::State::Error:
switch (linphone_error_info_get_reason(q->getErrorInfo())) {
......@@ -129,11 +123,6 @@ void CallSessionPrivate::setState (CallSession::State newState, const string &me
log->status = LinphoneCallSuccess;
log->connected_date_time = ms_time(nullptr);
break;
case CallSession::State::Released:
getPlatformHelpers(q->getCore()->getCCore())->releaseWifiLock();
getPlatformHelpers(q->getCore()->getCCore())->releaseMcastLock();
getPlatformHelpers(q->getCore()->getCCore())->releaseCpuLock();
break;
default:
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment