Delete almost all default methods on PeerConnectionInterface

Keeping default implementations only for methods involved in
ongoing transitions.

Intended to catch inconsistencies between the interface and the
PeerConnectionProxy class, at compile time.

Bug: webrtc:10716
Change-Id: I4cb126c353855f7288ba09273fa6f87aaa0f32eb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/140860
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29224}
This commit is contained in:
Niels Möller
2019-09-13 15:41:21 +02:00
committed by Commit Bot
parent e607a06338
commit 7b04a91f4a
5 changed files with 63 additions and 159 deletions

View File

@ -42,103 +42,17 @@ PeerConnectionInterface::RTCConfiguration::RTCConfiguration(
PeerConnectionInterface::RTCConfiguration::~RTCConfiguration() = default; PeerConnectionInterface::RTCConfiguration::~RTCConfiguration() = default;
RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>
PeerConnectionInterface::AddTrack(
rtc::scoped_refptr<MediaStreamTrackInterface> track,
const std::vector<std::string>& stream_ids) {
return RTCError(RTCErrorType::UNSUPPORTED_OPERATION, "Not implemented");
}
bool PeerConnectionInterface::RemoveTrack(RtpSenderInterface* sender) {
return RemoveTrackNew(sender).ok();
}
RTCError PeerConnectionInterface::RemoveTrackNew( RTCError PeerConnectionInterface::RemoveTrackNew(
rtc::scoped_refptr<RtpSenderInterface> sender) { rtc::scoped_refptr<RtpSenderInterface> sender) {
return RTCError(RemoveTrack(sender) ? RTCErrorType::NONE return RTCError(RemoveTrack(sender) ? RTCErrorType::NONE
: RTCErrorType::INTERNAL_ERROR); : RTCErrorType::INTERNAL_ERROR);
} }
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
PeerConnectionInterface::AddTransceiver(
rtc::scoped_refptr<MediaStreamTrackInterface> track) {
return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented");
}
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
PeerConnectionInterface::AddTransceiver(
rtc::scoped_refptr<MediaStreamTrackInterface> track,
const RtpTransceiverInit& init) {
return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented");
}
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
PeerConnectionInterface::AddTransceiver(cricket::MediaType media_type) {
return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented");
}
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
PeerConnectionInterface::AddTransceiver(cricket::MediaType media_type,
const RtpTransceiverInit& init) {
return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented");
}
rtc::scoped_refptr<RtpSenderInterface> PeerConnectionInterface::CreateSender(
const std::string& kind,
const std::string& stream_id) {
return rtc::scoped_refptr<RtpSenderInterface>();
}
std::vector<rtc::scoped_refptr<RtpSenderInterface>>
PeerConnectionInterface::GetSenders() const {
return std::vector<rtc::scoped_refptr<RtpSenderInterface>>();
}
std::vector<rtc::scoped_refptr<RtpReceiverInterface>>
PeerConnectionInterface::GetReceivers() const {
return std::vector<rtc::scoped_refptr<RtpReceiverInterface>>();
}
std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>
PeerConnectionInterface::GetTransceivers() const {
return std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>();
}
const SessionDescriptionInterface*
PeerConnectionInterface::current_local_description() const {
return nullptr;
}
const SessionDescriptionInterface*
PeerConnectionInterface::current_remote_description() const {
return nullptr;
}
const SessionDescriptionInterface*
PeerConnectionInterface::pending_local_description() const {
return nullptr;
}
const SessionDescriptionInterface*
PeerConnectionInterface::pending_remote_description() const {
return nullptr;
}
PeerConnectionInterface::RTCConfiguration
PeerConnectionInterface::GetConfiguration() {
return PeerConnectionInterface::RTCConfiguration();
}
RTCError PeerConnectionInterface::SetConfiguration( RTCError PeerConnectionInterface::SetConfiguration(
const PeerConnectionInterface::RTCConfiguration& config) { const PeerConnectionInterface::RTCConfiguration& config) {
return RTCError(); return RTCError();
} }
bool PeerConnectionInterface::RemoveIceCandidates(
const std::vector<cricket::Candidate>& candidates) {
return false;
}
RTCError PeerConnectionInterface::SetBitrate(const BitrateSettings& bitrate) { RTCError PeerConnectionInterface::SetBitrate(const BitrateSettings& bitrate) {
BitrateParameters bitrate_parameters; BitrateParameters bitrate_parameters;
bitrate_parameters.min_bitrate_bps = bitrate.min_bitrate_bps; bitrate_parameters.min_bitrate_bps = bitrate.min_bitrate_bps;
@ -156,39 +70,6 @@ RTCError PeerConnectionInterface::SetBitrate(
return SetBitrate(bitrate); return SetBitrate(bitrate);
} }
PeerConnectionInterface::IceConnectionState
PeerConnectionInterface::standardized_ice_connection_state() {
return PeerConnectionInterface::IceConnectionState::kIceConnectionFailed;
}
PeerConnectionInterface::PeerConnectionState
PeerConnectionInterface::peer_connection_state() {
return PeerConnectionInterface::PeerConnectionState::kFailed;
}
bool PeerConnectionInterface::StartRtcEventLog(
std::unique_ptr<RtcEventLogOutput> output,
int64_t output_period_ms) {
return false;
}
bool PeerConnectionInterface::StartRtcEventLog(
std::unique_ptr<RtcEventLogOutput> output) {
return false;
}
rtc::scoped_refptr<DtlsTransportInterface>
PeerConnectionInterface::LookupDtlsTransportByMid(const std::string& mid) {
RTC_NOTREACHED();
return nullptr;
}
rtc::scoped_refptr<SctpTransportInterface>
PeerConnectionInterface::GetSctpTransport() const {
RTC_NOTREACHED();
return nullptr;
}
PeerConnectionInterface::BitrateParameters::BitrateParameters() = default; PeerConnectionInterface::BitrateParameters::BitrateParameters() = default;
PeerConnectionInterface::BitrateParameters::~BitrateParameters() = default; PeerConnectionInterface::BitrateParameters::~BitrateParameters() = default;

View File

@ -760,12 +760,12 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// - INVALID_STATE: The PeerConnection is closed. // - INVALID_STATE: The PeerConnection is closed.
virtual RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> AddTrack( virtual RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> AddTrack(
rtc::scoped_refptr<MediaStreamTrackInterface> track, rtc::scoped_refptr<MediaStreamTrackInterface> track,
const std::vector<std::string>& stream_ids); const std::vector<std::string>& stream_ids) = 0;
// Remove an RtpSender from this PeerConnection. // Remove an RtpSender from this PeerConnection.
// Returns true on success. // Returns true on success.
// TODO(steveanton): Replace with signature that returns RTCError. // TODO(steveanton): Replace with signature that returns RTCError.
virtual bool RemoveTrack(RtpSenderInterface* sender); virtual bool RemoveTrack(RtpSenderInterface* sender) = 0;
// Plan B semantics: Removes the RtpSender from this PeerConnection. // Plan B semantics: Removes the RtpSender from this PeerConnection.
// Unified Plan semantics: Stop sending on the RtpSender and mark the // Unified Plan semantics: Stop sending on the RtpSender and mark the
@ -798,8 +798,6 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// //
// Common errors: // Common errors:
// - INTERNAL_ERROR: The configuration does not have Unified Plan enabled. // - INTERNAL_ERROR: The configuration does not have Unified Plan enabled.
// TODO(steveanton): Make these pure virtual once downstream projects have
// updated.
// Adds a transceiver with a sender set to transmit the given track. The kind // Adds a transceiver with a sender set to transmit the given track. The kind
// of the transceiver (and sender/receiver) will be derived from the kind of // of the transceiver (and sender/receiver) will be derived from the kind of
@ -807,10 +805,10 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// Errors: // Errors:
// - INVALID_PARAMETER: |track| is null. // - INVALID_PARAMETER: |track| is null.
virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
AddTransceiver(rtc::scoped_refptr<MediaStreamTrackInterface> track); AddTransceiver(rtc::scoped_refptr<MediaStreamTrackInterface> track) = 0;
virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
AddTransceiver(rtc::scoped_refptr<MediaStreamTrackInterface> track, AddTransceiver(rtc::scoped_refptr<MediaStreamTrackInterface> track,
const RtpTransceiverInit& init); const RtpTransceiverInit& init) = 0;
// Adds a transceiver with the given kind. Can either be MEDIA_TYPE_AUDIO or // Adds a transceiver with the given kind. Can either be MEDIA_TYPE_AUDIO or
// MEDIA_TYPE_VIDEO. // MEDIA_TYPE_VIDEO.
@ -818,11 +816,10 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// - INVALID_PARAMETER: |media_type| is not MEDIA_TYPE_AUDIO or // - INVALID_PARAMETER: |media_type| is not MEDIA_TYPE_AUDIO or
// MEDIA_TYPE_VIDEO. // MEDIA_TYPE_VIDEO.
virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
AddTransceiver(cricket::MediaType media_type); AddTransceiver(cricket::MediaType media_type) = 0;
virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
AddTransceiver(cricket::MediaType media_type, const RtpTransceiverInit& init); AddTransceiver(cricket::MediaType media_type,
const RtpTransceiverInit& init) = 0;
// TODO(deadbeef): Make these pure virtual once all subclasses implement them.
// Creates a sender without a track. Can be used for "early media"/"warmup" // Creates a sender without a track. Can be used for "early media"/"warmup"
// use cases, where the application may want to negotiate video attributes // use cases, where the application may want to negotiate video attributes
@ -840,7 +837,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// AddTransceiver instead. // AddTransceiver instead.
virtual rtc::scoped_refptr<RtpSenderInterface> CreateSender( virtual rtc::scoped_refptr<RtpSenderInterface> CreateSender(
const std::string& kind, const std::string& kind,
const std::string& stream_id); const std::string& stream_id) = 0;
// If Plan B semantics are specified, gets all RtpSenders, created either // If Plan B semantics are specified, gets all RtpSenders, created either
// through AddStream, AddTrack, or CreateSender. All senders of a specific // through AddStream, AddTrack, or CreateSender. All senders of a specific
@ -849,7 +846,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// If Unified Plan semantics are specified, gets the RtpSender for each // If Unified Plan semantics are specified, gets the RtpSender for each
// RtpTransceiver. // RtpTransceiver.
virtual std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders() virtual std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders()
const; const = 0;
// If Plan B semantics are specified, gets all RtpReceivers created when a // If Plan B semantics are specified, gets all RtpReceivers created when a
// remote description is applied. All receivers of a specific media type share // remote description is applied. All receivers of a specific media type share
@ -860,7 +857,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// If Unified Plan semantics are specified, gets the RtpReceiver for each // If Unified Plan semantics are specified, gets the RtpReceiver for each
// RtpTransceiver. // RtpTransceiver.
virtual std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers() virtual std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers()
const; const = 0;
// Get all RtpTransceivers, created either through AddTransceiver, AddTrack or // Get all RtpTransceivers, created either through AddTransceiver, AddTrack or
// by a remote description applied with SetRemoteDescription. // by a remote description applied with SetRemoteDescription.
@ -868,7 +865,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// Note: This method is only available when Unified Plan is enabled (see // Note: This method is only available when Unified Plan is enabled (see
// RTCConfiguration). // RTCConfiguration).
virtual std::vector<rtc::scoped_refptr<RtpTransceiverInterface>> virtual std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>
GetTransceivers() const; GetTransceivers() const = 0;
// The legacy non-compliant GetStats() API. This correspond to the // The legacy non-compliant GetStats() API. This correspond to the
// callback-based version of getStats() in JavaScript. The returned metrics // callback-based version of getStats() in JavaScript. The returned metrics
@ -897,19 +894,17 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// requires stop overriding the current version in third party or making third // requires stop overriding the current version in third party or making third
// party calls explicit to avoid ambiguity during switch. Make the future // party calls explicit to avoid ambiguity during switch. Make the future
// version abstract as soon as third party projects implement it. // version abstract as soon as third party projects implement it.
virtual void GetStats(RTCStatsCollectorCallback* callback) {} virtual void GetStats(RTCStatsCollectorCallback* callback) = 0;
// Spec-compliant getStats() performing the stats selection algorithm with the // Spec-compliant getStats() performing the stats selection algorithm with the
// sender. https://w3c.github.io/webrtc-pc/#dom-rtcrtpsender-getstats // sender. https://w3c.github.io/webrtc-pc/#dom-rtcrtpsender-getstats
// TODO(hbos): Make abstract as soon as third party projects implement it.
virtual void GetStats( virtual void GetStats(
rtc::scoped_refptr<RtpSenderInterface> selector, rtc::scoped_refptr<RtpSenderInterface> selector,
rtc::scoped_refptr<RTCStatsCollectorCallback> callback) {} rtc::scoped_refptr<RTCStatsCollectorCallback> callback) = 0;
// Spec-compliant getStats() performing the stats selection algorithm with the // Spec-compliant getStats() performing the stats selection algorithm with the
// receiver. https://w3c.github.io/webrtc-pc/#dom-rtcrtpreceiver-getstats // receiver. https://w3c.github.io/webrtc-pc/#dom-rtcrtpreceiver-getstats
// TODO(hbos): Make abstract as soon as third party projects implement it.
virtual void GetStats( virtual void GetStats(
rtc::scoped_refptr<RtpReceiverInterface> selector, rtc::scoped_refptr<RtpReceiverInterface> selector,
rtc::scoped_refptr<RTCStatsCollectorCallback> callback) {} rtc::scoped_refptr<RTCStatsCollectorCallback> callback) = 0;
// Clear cached stats in the RTCStatsCollector. // Clear cached stats in the RTCStatsCollector.
// Exposed for testing while waiting for automatic cache clear to work. // Exposed for testing while waiting for automatic cache clear to work.
// https://bugs.webrtc.org/8693 // https://bugs.webrtc.org/8693
@ -933,14 +928,18 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// A "current" description the one currently negotiated from a complete // A "current" description the one currently negotiated from a complete
// offer/answer exchange. // offer/answer exchange.
virtual const SessionDescriptionInterface* current_local_description() const; virtual const SessionDescriptionInterface* current_local_description()
virtual const SessionDescriptionInterface* current_remote_description() const; const = 0;
virtual const SessionDescriptionInterface* current_remote_description()
const = 0;
// A "pending" description is one that's part of an incomplete offer/answer // A "pending" description is one that's part of an incomplete offer/answer
// exchange (thus, either an offer or a pranswer). Once the offer/answer // exchange (thus, either an offer or a pranswer). Once the offer/answer
// exchange is finished, the "pending" description will become "current". // exchange is finished, the "pending" description will become "current".
virtual const SessionDescriptionInterface* pending_local_description() const; virtual const SessionDescriptionInterface* pending_local_description()
virtual const SessionDescriptionInterface* pending_remote_description() const; const = 0;
virtual const SessionDescriptionInterface* pending_remote_description()
const = 0;
// Tells the PeerConnection that ICE should be restarted. This triggers a need // Tells the PeerConnection that ICE should be restarted. This triggers a need
// for negotiation and subsequent CreateOffer() calls will act as if // for negotiation and subsequent CreateOffer() calls will act as if
@ -948,7 +947,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-restartice // https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-restartice
// TODO(hbos): Remove default implementation when downstream projects // TODO(hbos): Remove default implementation when downstream projects
// implement this. // implement this.
virtual void RestartIce() {} virtual void RestartIce() = 0;
// Create a new offer. // Create a new offer.
// The CreateSessionDescriptionObserver callback will be called when done. // The CreateSessionDescriptionObserver callback will be called when done.
@ -973,14 +972,11 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// TODO(hbos): Remove when Chrome implements the new signature. // TODO(hbos): Remove when Chrome implements the new signature.
virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer,
SessionDescriptionInterface* desc) {} SessionDescriptionInterface* desc) {}
// TODO(hbos): Make pure virtual when Chrome has updated its signature.
virtual void SetRemoteDescription( virtual void SetRemoteDescription(
std::unique_ptr<SessionDescriptionInterface> desc, std::unique_ptr<SessionDescriptionInterface> desc,
rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer) {} rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer) = 0;
// TODO(deadbeef): Make this pure virtual once all Chrome subclasses of virtual PeerConnectionInterface::RTCConfiguration GetConfiguration() = 0;
// PeerConnectionInterface implement it.
virtual PeerConnectionInterface::RTCConfiguration GetConfiguration();
// Sets the PeerConnection's global configuration to |config|. // Sets the PeerConnection's global configuration to |config|.
// //
@ -1018,7 +1014,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// continual gathering, to avoid an ever-growing list of candidates as // continual gathering, to avoid an ever-growing list of candidates as
// networks come and go. // networks come and go.
virtual bool RemoveIceCandidates( virtual bool RemoveIceCandidates(
const std::vector<cricket::Candidate>& candidates); const std::vector<cricket::Candidate>& candidates) = 0;
// 0 <= min <= current <= max should hold for set parameters. // 0 <= min <= current <= max should hold for set parameters.
struct BitrateParameters { struct BitrateParameters {
@ -1062,13 +1058,12 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// In the Javascript API, DtlsTransport is a property of a sender, but // In the Javascript API, DtlsTransport is a property of a sender, but
// because the PeerConnection owns the DtlsTransport in this implementation, // because the PeerConnection owns the DtlsTransport in this implementation,
// it is better to look them up on the PeerConnection. // it is better to look them up on the PeerConnection.
// TODO(hta): Remove default implementation after updating Chrome.
virtual rtc::scoped_refptr<DtlsTransportInterface> LookupDtlsTransportByMid( virtual rtc::scoped_refptr<DtlsTransportInterface> LookupDtlsTransportByMid(
const std::string& mid); const std::string& mid) = 0;
// Returns the SCTP transport, if any. // Returns the SCTP transport, if any.
// TODO(hta): Remove default implementation after updating Chrome. virtual rtc::scoped_refptr<SctpTransportInterface> GetSctpTransport()
virtual rtc::scoped_refptr<SctpTransportInterface> GetSctpTransport() const; const = 0;
// Returns the current SignalingState. // Returns the current SignalingState.
virtual SignalingState signaling_state() = 0; virtual SignalingState signaling_state() = 0;
@ -1080,10 +1075,10 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
virtual IceConnectionState ice_connection_state() = 0; virtual IceConnectionState ice_connection_state() = 0;
// Returns an aggregated state of all ICE transports. // Returns an aggregated state of all ICE transports.
virtual IceConnectionState standardized_ice_connection_state(); virtual IceConnectionState standardized_ice_connection_state() = 0;
// Returns an aggregated state of all ICE and DTLS transports. // Returns an aggregated state of all ICE and DTLS transports.
virtual PeerConnectionState peer_connection_state(); virtual PeerConnectionState peer_connection_state() = 0;
virtual IceGatheringState ice_gathering_state() = 0; virtual IceGatheringState ice_gathering_state() = 0;
@ -1097,12 +1092,11 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// lost in case the application crashes. If the |output_period_ms| argument is // lost in case the application crashes. If the |output_period_ms| argument is
// omitted, webrtc selects a default deemed to be workable in most cases. // omitted, webrtc selects a default deemed to be workable in most cases.
virtual bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output, virtual bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output,
int64_t output_period_ms); int64_t output_period_ms) = 0;
virtual bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output); virtual bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output) = 0;
// Stops logging the RtcEventLog. // Stops logging the RtcEventLog.
// TODO(ivoc): Make this pure virtual when Chrome is updat ed. virtual void StopRtcEventLog() = 0;
virtual void StopRtcEventLog() {}
// Terminates all media, closes the transports, and in general releases any // Terminates all media, closes the transports, and in general releases any
// resources used by the PeerConnection. This is an irreversible operation. // resources used by the PeerConnection. This is an irreversible operation.

View File

@ -72,6 +72,7 @@ PROXY_METHOD2(void,
GetStats, GetStats,
rtc::scoped_refptr<RtpReceiverInterface>, rtc::scoped_refptr<RtpReceiverInterface>,
rtc::scoped_refptr<RTCStatsCollectorCallback>) rtc::scoped_refptr<RTCStatsCollectorCallback>)
PROXY_METHOD0(void, ClearStatsCache)
PROXY_METHOD2(rtc::scoped_refptr<DataChannelInterface>, PROXY_METHOD2(rtc::scoped_refptr<DataChannelInterface>,
CreateDataChannel, CreateDataChannel,
const std::string&, const std::string&,

View File

@ -13,6 +13,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <type_traits>
#include <utility> #include <utility>
#include <vector> #include <vector>
@ -39,6 +40,8 @@ class MockPeerConnectionInterface
MediaStreamTrackInterface*, MediaStreamTrackInterface*,
std::vector<MediaStreamInterface*>)); std::vector<MediaStreamInterface*>));
MOCK_METHOD1(RemoveTrack, bool(RtpSenderInterface*)); MOCK_METHOD1(RemoveTrack, bool(RtpSenderInterface*));
MOCK_METHOD1(RemoveTrackNew,
RTCError(rtc::scoped_refptr<RtpSenderInterface>));
MOCK_METHOD1(AddTransceiver, MOCK_METHOD1(AddTransceiver,
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>( RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>(
rtc::scoped_refptr<MediaStreamTrackInterface>)); rtc::scoped_refptr<MediaStreamTrackInterface>));
@ -91,6 +94,7 @@ class MockPeerConnectionInterface
const SessionDescriptionInterface*()); const SessionDescriptionInterface*());
MOCK_CONST_METHOD0(pending_remote_description, MOCK_CONST_METHOD0(pending_remote_description,
const SessionDescriptionInterface*()); const SessionDescriptionInterface*());
MOCK_METHOD0(RestartIce, void());
MOCK_METHOD2(CreateOffer, MOCK_METHOD2(CreateOffer,
void(CreateSessionDescriptionObserver*, void(CreateSessionDescriptionObserver*,
const RTCOfferAnswerOptions&)); const RTCOfferAnswerOptions&));
@ -116,15 +120,22 @@ class MockPeerConnectionInterface
MOCK_METHOD1(SetBitrate, RTCError(const BitrateParameters&)); MOCK_METHOD1(SetBitrate, RTCError(const BitrateParameters&));
MOCK_METHOD1(SetAudioPlayout, void(bool)); MOCK_METHOD1(SetAudioPlayout, void(bool));
MOCK_METHOD1(SetAudioRecording, void(bool)); MOCK_METHOD1(SetAudioRecording, void(bool));
MOCK_METHOD1(LookupDtlsTransportByMid,
rtc::scoped_refptr<DtlsTransportInterface>(const std::string&));
MOCK_METHOD0(signaling_state, SignalingState()); MOCK_METHOD0(signaling_state, SignalingState());
MOCK_METHOD0(ice_connection_state, IceConnectionState()); MOCK_METHOD0(ice_connection_state, IceConnectionState());
MOCK_METHOD0(standardized_ice_connection_state, IceConnectionState());
MOCK_METHOD0(peer_connection_state, PeerConnectionState());
MOCK_METHOD0(ice_gathering_state, IceGatheringState()); MOCK_METHOD0(ice_gathering_state, IceGatheringState());
MOCK_METHOD2(StartRtcEventLog, MOCK_METHOD2(StartRtcEventLog,
bool(std::unique_ptr<RtcEventLogOutput>, int64_t)); bool(std::unique_ptr<RtcEventLogOutput>, int64_t));
MOCK_METHOD1(StartRtcEventLog, bool(std::unique_ptr<RtcEventLogOutput>));
MOCK_METHOD0(StopRtcEventLog, void()); MOCK_METHOD0(StopRtcEventLog, void());
MOCK_METHOD0(Close, void()); MOCK_METHOD0(Close, void());
}; };
static_assert(!std::is_abstract<MockPeerConnectionInterface>::value, "");
} // namespace webrtc } // namespace webrtc
#endif // API_TEST_MOCK_PEERCONNECTIONINTERFACE_H_ #endif // API_TEST_MOCK_PEERCONNECTIONINTERFACE_H_

View File

@ -52,6 +52,11 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
bool RemoveTrack(RtpSenderInterface* sender) override { return false; } bool RemoveTrack(RtpSenderInterface* sender) override { return false; }
RTCError RemoveTrackNew(
rtc::scoped_refptr<RtpSenderInterface> sender) override {
return RTCError(RTCErrorType::UNSUPPORTED_OPERATION);
}
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> AddTransceiver( RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> AddTransceiver(
rtc::scoped_refptr<MediaStreamTrackInterface> track) override { rtc::scoped_refptr<MediaStreamTrackInterface> track) override {
return RTCError(RTCErrorType::UNSUPPORTED_OPERATION, "Not implemented"); return RTCError(RTCErrorType::UNSUPPORTED_OPERATION, "Not implemented");
@ -200,6 +205,14 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
return IceConnectionState::kIceConnectionNew; return IceConnectionState::kIceConnectionNew;
} }
IceConnectionState standardized_ice_connection_state() override {
return IceConnectionState::kIceConnectionNew;
}
PeerConnectionState peer_connection_state() override {
return PeerConnectionState::kNew;
}
IceGatheringState ice_gathering_state() override { IceGatheringState ice_gathering_state() override {
return IceGatheringState::kIceGatheringNew; return IceGatheringState::kIceGatheringNew;
} }
@ -209,6 +222,10 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
return false; return false;
} }
bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output) override {
return false;
}
void StopRtcEventLog() override {} void StopRtcEventLog() override {}
void Close() override {} void Close() override {}