Chromium Code Reviews| Index: talk/app/webrtc/peerconnection.cc |
| diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc |
| index 933dc83c25642278d49a9491c2818a57f74fd217..2a5d52f80d0483ed8258c387c29358aedba0bf7d 100644 |
| --- a/talk/app/webrtc/peerconnection.cc |
| +++ b/talk/app/webrtc/peerconnection.cc |
| @@ -107,6 +107,7 @@ enum { |
| MSG_SET_SESSIONDESCRIPTION_FAILED, |
| MSG_CREATE_SESSIONDESCRIPTION_FAILED, |
| MSG_GETSTATS, |
| + MSG_FREE_DATACHANNELS, |
| }; |
| struct SetSessionDescriptionMsg : public rtc::MessageData { |
| @@ -1329,6 +1330,10 @@ void PeerConnection::OnMessage(rtc::Message* msg) { |
| delete param; |
| break; |
| } |
| + case MSG_FREE_DATACHANNELS: { |
| + sctp_data_channels_to_free_.clear(); |
| + break; |
| + } |
| default: |
| RTC_DCHECK(false && "Not implemented"); |
| break; |
| @@ -1908,7 +1913,11 @@ void PeerConnection::OnSctpDataChannelClosed(DataChannel* channel) { |
| if (channel->id() >= 0) { |
| sid_allocator_.ReleaseSid(channel->id()); |
| } |
| + // Since this method is triggered by a signal from the DataChannel, |
| + // we can't free it directly here; we need to free it asynchronously. |
| + sctp_data_channels_to_free_.push_back(*it); |
|
pthatcher1
2015/12/11 02:55:01
We should probably add a RTC_DCHECK(signaling_thre
Taylor Brandstetter
2015/12/11 18:21:48
Done.
|
| sctp_data_channels_.erase(it); |
| + signaling_thread()->Post(this, MSG_FREE_DATACHANNELS, nullptr); |
| return; |
| } |
| } |