Index: talk/session/media/srtpfilter.cc |
diff --git a/talk/session/media/srtpfilter.cc b/talk/session/media/srtpfilter.cc |
index 079ddfb57ee553474c2a42470c2de446d4b9c390..06ce7119ea39ef0db914141d2581890ddbf6b3fd 100644 |
--- a/talk/session/media/srtpfilter.cc |
+++ b/talk/session/media/srtpfilter.cc |
@@ -481,7 +481,7 @@ bool SrtpFilter::ParseKeyParams(const std::string& key_params, |
bool SrtpSession::inited_ = false; |
-// This lock protects SrtpSession::inited_ and SrtpSession::sessions_. |
+// This lock protects SrtpSession::inited_. |
rtc::GlobalLockPod SrtpSession::lock_; |
SrtpSession::SrtpSession() |
@@ -490,19 +490,12 @@ SrtpSession::SrtpSession() |
rtcp_auth_tag_len_(0), |
srtp_stat_(new SrtpStat()), |
last_send_seq_num_(-1) { |
- { |
- rtc::GlobalLockScope ls(&lock_); |
- sessions()->push_back(this); |
- } |
SignalSrtpError.repeat(srtp_stat_->SignalSrtpError); |
} |
SrtpSession::~SrtpSession() { |
- { |
- rtc::GlobalLockScope ls(&lock_); |
- sessions()->erase(std::find(sessions()->begin(), sessions()->end(), this)); |
- } |
if (session_) { |
+ session_->user_data = nullptr; |
srtp_dealloc(session_); |
} |
} |
@@ -717,7 +710,7 @@ bool SrtpSession::SetKey(int type, |
return false; |
} |
- |
+ session_->user_data = this; |
rtp_auth_tag_len_ = policy.rtp.auth_tag_len; |
rtcp_auth_tag_len_ = policy.rtcp.auth_tag_len; |
return true; |
@@ -786,22 +779,12 @@ void SrtpSession::HandleEvent(const srtp_event_data_t* ev) { |
} |
void SrtpSession::HandleEventThunk(srtp_event_data_t* ev) { |
- rtc::GlobalLockScope ls(&lock_); |
- |
- for (std::list<SrtpSession*>::iterator it = sessions()->begin(); |
- it != sessions()->end(); ++it) { |
- if ((*it)->session_ == ev->session) { |
- (*it)->HandleEvent(ev); |
- break; |
- } |
+ SrtpSession* session = static_cast<SrtpSession*>(ev->session->user_data); |
juberti
2015/11/10 01:25:59
Do we know what thread this gets invoked from? Wou
joachim
2015/11/10 16:59:56
Done.
|
+ if (session) { |
+ session->HandleEvent(ev); |
} |
} |
-std::list<SrtpSession*>* SrtpSession::sessions() { |
- RTC_DEFINE_STATIC_LOCAL(std::list<SrtpSession*>, sessions, ()); |
- return &sessions; |
-} |
- |
#else // !HAVE_SRTP |
// On some systems, SRTP is not (yet) available. |