Unify and de-duplicate BaseChannel deletion in PeerConnection
This refactoring reduces code duplication in PeerConnection and
will make it easier to use these methods with the Unified Plan
implementation.
Bug: webrtc:8587
Change-Id: I6afd44fff702290903555cbe7703198b6b091da6
Reviewed-on: https://webrtc-review.googlesource.com/26822
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Reviewed-by: Zhi Huang <zhihuang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21052}
diff --git a/pc/peerconnection.h b/pc/peerconnection.h
index dee46f9..a9565ee 100644
--- a/pc/peerconnection.h
+++ b/pc/peerconnection.h
@@ -766,12 +766,20 @@
const std::string GetTransportName(const std::string& content_name);
void DestroyRtcpTransport_n(const std::string& transport_name);
- void RemoveAndDestroyVideoChannel(cricket::VideoChannel* video_channel);
- void DestroyVideoChannel(cricket::VideoChannel* video_channel);
- void RemoveAndDestroyVoiceChannel(cricket::VoiceChannel* voice_channel);
- void DestroyVoiceChannel(cricket::VoiceChannel* voice_channel);
+
+ // Destroys and clears the BaseChannel associated with the given transceiver,
+ // if such channel is set.
+ void DestroyTransceiverChannel(
+ rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>
+ transceiver);
+
+ // Destroys the RTP data channel and/or the SCTP data channel and clears it.
void DestroyDataChannel();
+ // Destroys the given BaseChannel. The channel cannot be accessed after this
+ // method is called.
+ void DestroyBaseChannel(cricket::BaseChannel* channel);
+
// Storing the factory as a scoped reference pointer ensures that the memory
// in the PeerConnectionFactoryImpl remains available as long as the
// PeerConnection is running. It is passed to PeerConnection as a raw pointer.