Separate PeerConnection's self-message functions to a new file

This prevents having to have sdp_offer_answer depend on peer_connection
for the messaging functions.

Bug: webrtc:11995
Change-Id: Icad7c9c0e6149bd1b8d78e37eff5f9786b74692e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186662
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32310}
This commit is contained in:
Harald Alvestrand
2020-10-05 07:01:09 +00:00
committed by Commit Bot
parent 8e4cda7de0
commit 1090e44ac0
8 changed files with 295 additions and 154 deletions

View File

@ -27,6 +27,7 @@
#include "pc/jsep_transport_controller.h"
#include "pc/peer_connection_factory.h"
#include "pc/peer_connection_internal.h"
#include "pc/peer_connection_message_handler.h"
#include "pc/rtc_stats_collector.h"
#include "pc/rtp_sender.h"
#include "pc/rtp_transceiver.h"
@ -67,7 +68,6 @@ class SdpOfferAnswerHandler;
class PeerConnection : public PeerConnectionInternal,
public JsepTransportController::Observer,
public RtpSenderBase::SetStreamsObserver,
public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
// A bit in the usage pattern is registered when its defining event occurs at
@ -367,6 +367,10 @@ class PeerConnection : public PeerConnectionInternal,
RTC_DCHECK_RUN_ON(signaling_thread());
return sctp_mid_s_;
}
PeerConnectionMessageHandler* message_handler() {
RTC_DCHECK_RUN_ON(signaling_thread());
return &message_handler_;
}
// Functions made public for testing.
void ReturnHistogramVeryQuicklyForTesting() {
@ -401,9 +405,6 @@ class PeerConnection : public PeerConnectionInternal,
uint32_t first_ssrc;
};
// Implements MessageHandler.
void OnMessage(rtc::Message* msg) override;
// Plan B helpers for getting the voice/video media channels for the single
// audio/video transceiver, if it exists.
cricket::VoiceMediaChannel* voice_media_channel() const
@ -540,14 +541,6 @@ class PeerConnection : public PeerConnectionInternal,
MediaStreamInterface* stream)
RTC_RUN_ON(signaling_thread());
void PostSetSessionDescriptionSuccess(
SetSessionDescriptionObserver* observer);
void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer,
RTCError&& error);
void PostCreateSessionDescriptionFailure(
CreateSessionDescriptionObserver* observer,
RTCError error);
// Returns the RtpTransceiver, if found, that is associated to the given MID.
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>
GetAssociatedTransceiver(const std::string& mid) const;
@ -1003,6 +996,9 @@ class PeerConnection : public PeerConnectionInternal,
video_bitrate_allocator_factory_;
DataChannelController data_channel_controller_;
// Machinery for handling messages posted to oneself
PeerConnectionMessageHandler message_handler_;
};
} // namespace webrtc