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.

This commit is contained in:
Simon Morlat 2018-03-02 20:51:54 +01:00
parent 9c904e7982
commit 204e218bb0
2 changed files with 15 additions and 11 deletions

View file

@ -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());
}

View file

@ -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;
}