Commit e2b2e6dc authored by Adrien Béraud's avatar Adrien Béraud

call: answer, remove on main thread

Change-Id: I40ab84254b656a1cf5a2a09e839e3393431cb923
parent 3ee3e77b
......@@ -520,7 +520,11 @@ Call::merge(Call& subcall)
setState(subcall.getState(), subcall.getConnectionState());
}
subcall.removeCall();
std::weak_ptr<Call> subCallWeak = subcall.shared_from_this();
runOnMainThread([subCallWeak] {
if (auto subcall = subCallWeak.lock())
subcall->removeCall();
});
}
/// Handle pending IM message
......
......@@ -785,16 +785,16 @@ void
SIPCall::onAnswered()
{
JAMI_WARN("[call:%s] onAnswered()", getCallId().c_str());
if (getConnectionState() != ConnectionState::CONNECTED) {
setState(CallState::ACTIVE, ConnectionState::CONNECTED);
if (not isSubcall()) {
runOnMainThread([w = weak()] {
if (auto shared = w.lock()) {
runOnMainThread([w = weak()] {
if (auto shared = w.lock()) {
if (shared->getConnectionState() != ConnectionState::CONNECTED) {
shared->setState(CallState::ACTIVE, ConnectionState::CONNECTED);
if (not shared->isSubcall()) {
Manager::instance().peerAnsweredCall(*shared);
}
});
}
}
}
});
}
void
......
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