How to close or destruct a PeerConnectionInterface object? It crashed when I'm trying to do so.
I have an object declared like this:
rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection;
It works fine after I create the PeerConnectionInterface by factory.
However, when the session is over and I try to call _peerConnection->Close(); The program crashed.
And I also try to call _peerConnection.release()->Release(); Crashed as well.
I print logs in PeerConnection.cc which is from the source code of WebRtc, and find that it crashed here, which is in Close() function and ~PeerConnection() function:
webrtc_session_desc_factory_.reset(); //PeerConnection.cc
The declare is
std::unique_ptr<WebRtcSessionDescriptionFactory> webrtc_session_desc_factory_;
So I continue to log in WebRtcSessionDescriptionFactory.cc, the ~WebRtcSessionDescriptionFactory() function. Crashed in this function:FailPendingRequests().
Entered the FailPendingRequests() function:
RTC_DCHECK(signaling_thread_->IsCurrent());
while (!create_session_description_requests_.empty()) {
const CreateSessionDescriptionRequest& request =
create_session_description_requests_.front();
//Crashed here in third or fourth loop
PostCreateSessionDescriptionFailed(request.observer,
((request.type == CreateSessionDescriptionRequest::kOffer) ?
"CreateOffer" : "CreateAnswer") + reason);
create_session_description_requests_.pop();
}
I will be really grateful for any suggestion!