Invalidate weak pointers in SdpOfferAnswerHandler::Close().

This stops pending internal callbacks from performing unnecessary
operations when closed.

Also update tests pc tests to call Close().
This will allow PeerConnection to be able to expect the
normal path to be that IsClosed() be true in the dtor
once all 'normal' paths do that

Bug: webrtc:12633
Change-Id: I3882bedf200feda0d04594adeb0fdac85bfef652
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213426
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33617}
This commit is contained in:
Tomas Gunnarsson
2021-04-01 16:26:57 +02:00
committed by Commit Bot
parent 0f030fd263
commit 2efb8a5ec6
8 changed files with 70 additions and 37 deletions

View File

@ -39,6 +39,7 @@
#include "api/set_remote_description_observer_interface.h"
#include "api/transport/data_channel_transport_interface.h"
#include "api/turn_customizer.h"
#include "api/uma_metrics.h"
#include "api/video/video_bitrate_allocator_factory.h"
#include "media/base/media_channel.h"
#include "media/base/stream_params.h"
@ -638,6 +639,12 @@ class SdpOfferAnswerHandler : public SdpStateProvider,
// Updates the error state, signaling if necessary.
void SetSessionError(SessionError error, const std::string& error_desc);
// Implements AddIceCandidate without reporting usage, but returns the
// particular success/error value that should be reported (and can be utilized
// for other purposes).
AddIceCandidateResult AddIceCandidateInternal(
const IceCandidateInterface* candidate);
SessionError session_error_ RTC_GUARDED_BY(signaling_thread()) =
SessionError::kNone;
std::string session_error_desc_ RTC_GUARDED_BY(signaling_thread());