Skip to content
Snippets Groups Projects
Commit 93a34c9a authored by Adrien Béraud's avatar Adrien Béraud
Browse files

notify_one: cleanup

Change-Id: I26433e1463ecb261fb586431b6c43a3e6b931dcf
parent e5d95eb6
No related branches found
No related tags found
No related merge requests found
...@@ -43,10 +43,10 @@ namespace jami { ...@@ -43,10 +43,10 @@ namespace jami {
struct ConnectionInfo struct ConnectionInfo
{ {
std::mutex mutex_ {};
std::condition_variable responseCv_ {}; std::condition_variable responseCv_ {};
std::atomic_bool responseReceived_ {false}; bool responseReceived_ {false};
PeerConnectionRequest response_ {}; PeerConnectionRequest response_ {};
std::mutex mutex_ {};
std::unique_ptr<IceTransport> ice_ {nullptr}; std::unique_ptr<IceTransport> ice_ {nullptr};
// Used to store currently non ready TLS Socket // Used to store currently non ready TLS Socket
std::unique_ptr<TlsSocketEndpoint> tls_ {nullptr}; std::unique_ptr<TlsSocketEndpoint> tls_ {nullptr};
...@@ -325,11 +325,10 @@ ConnectionManager::Impl::connectDeviceStartIce(const DeviceId& deviceId, const d ...@@ -325,11 +325,10 @@ ConnectionManager::Impl::connectDeviceStartIce(const DeviceId& deviceId, const d
return; return;
} }
auto& response = info->response_;
if (!ice) if (!ice)
return; return;
auto sdp = ice->parseIceCandidates(response.ice_msg); auto sdp = ice->parseIceCandidates(info->response_.ice_msg);
if (not ice->startIce({sdp.rem_ufrag, sdp.rem_pwd}, std::move(sdp.rem_candidates))) { if (not ice->startIce({sdp.rem_ufrag, sdp.rem_pwd}, std::move(sdp.rem_candidates))) {
JAMI_WARN("[Account:%s] start ICE failed", account.getAccountID().c_str()); JAMI_WARN("[Account:%s] start ICE failed", account.getAccountID().c_str());
...@@ -607,14 +606,14 @@ ConnectionManager::Impl::onPeerResponse(const PeerConnectionRequest& req) ...@@ -607,14 +606,14 @@ ConnectionManager::Impl::onPeerResponse(const PeerConnectionRequest& req)
{ {
auto device = req.from; auto device = req.from;
JAMI_INFO() << account << " New response received from " << device.to_c_str(); JAMI_INFO() << account << " New response received from " << device.to_c_str();
auto info = getInfo(device, req.id); if (auto info = getInfo(device, req.id)) {
if (!info) { std::lock_guard<std::mutex> lk {info->mutex_};
JAMI_WARN() << account << " respond received, but cannot find request";
return;
}
info->responseReceived_ = true; info->responseReceived_ = true;
info->response_ = std::move(req); info->response_ = std::move(req);
info->responseCv_.notify_one(); info->responseCv_.notify_one();
} else {
JAMI_WARN() << account << " respond received, but cannot find request";
}
} }
void void
......
...@@ -413,8 +413,8 @@ void JackLayer::stopStream(AudioDeviceType) ...@@ -413,8 +413,8 @@ void JackLayer::stopStream(AudioDeviceType)
if (status_ != Status::Started) if (status_ != Status::Started)
return; return;
status_ = Status::Idle; status_ = Status::Idle;
}
data_ready_.notify_one(); data_ready_.notify_one();
}
if (jack_deactivate(playbackClient_) or jack_deactivate(captureClient_)) { if (jack_deactivate(playbackClient_) or jack_deactivate(captureClient_)) {
JAMI_ERR("JACK client could not deactivate"); JAMI_ERR("JACK client could not deactivate");
......
...@@ -308,7 +308,6 @@ void ...@@ -308,7 +308,6 @@ void
OpenSLLayer::engineServiceRec() OpenSLLayer::engineServiceRec()
{ {
recCv.notify_one(); recCv.notify_one();
return;
} }
void void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment