Reformat the WebRTC code base
Running clang-format with chromium's style guide. The goal is n-fold: * providing consistency and readability (that's what code guidelines are for) * preventing noise with presubmit checks and git cl format * building on the previous point: making it easier to automatically fix format issues * you name it Please consider using git-hyper-blame to ignore this commit. Bug: webrtc:9340 Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87 Reviewed-on: https://webrtc-review.googlesource.com/81185 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
@ -11,8 +11,8 @@
|
||||
#ifndef API_ARRAY_VIEW_H_
|
||||
#define API_ARRAY_VIEW_H_
|
||||
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <type_traits>
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
@ -66,7 +66,8 @@ void AudioFrame::UpdateFrame(uint32_t timestamp,
|
||||
}
|
||||
|
||||
void AudioFrame::CopyFrom(const AudioFrame& src) {
|
||||
if (this == &src) return;
|
||||
if (this == &src)
|
||||
return;
|
||||
|
||||
timestamp_ = src.timestamp_;
|
||||
elapsed_time_ms_ = src.elapsed_time_ms_;
|
||||
@ -116,7 +117,9 @@ void AudioFrame::Mute() {
|
||||
muted_ = true;
|
||||
}
|
||||
|
||||
bool AudioFrame::muted() const { return muted_; }
|
||||
bool AudioFrame::muted() const {
|
||||
return muted_;
|
||||
}
|
||||
|
||||
// static
|
||||
const int16_t* AudioFrame::empty_data() {
|
||||
|
||||
@ -43,11 +43,7 @@ class AudioFrame {
|
||||
kMaxDataSizeBytes = kMaxDataSizeSamples * sizeof(int16_t),
|
||||
};
|
||||
|
||||
enum VADActivity {
|
||||
kVadActive = 0,
|
||||
kVadPassive = 1,
|
||||
kVadUnknown = 2
|
||||
};
|
||||
enum VADActivity { kVadActive = 0, kVadPassive = 1, kVadUnknown = 2 };
|
||||
enum SpeechType {
|
||||
kNormalSpeech = 0,
|
||||
kPLC = 1,
|
||||
@ -66,9 +62,12 @@ class AudioFrame {
|
||||
// ResetWithoutMuting() to skip this wasteful zeroing.
|
||||
void ResetWithoutMuting();
|
||||
|
||||
void UpdateFrame(uint32_t timestamp, const int16_t* data,
|
||||
size_t samples_per_channel, int sample_rate_hz,
|
||||
SpeechType speech_type, VADActivity vad_activity,
|
||||
void UpdateFrame(uint32_t timestamp,
|
||||
const int16_t* data,
|
||||
size_t samples_per_channel,
|
||||
int sample_rate_hz,
|
||||
SpeechType speech_type,
|
||||
VADActivity vad_activity,
|
||||
size_t num_channels = 1);
|
||||
|
||||
void CopyFrom(const AudioFrame& src);
|
||||
|
||||
@ -87,9 +87,8 @@ TEST(AudioFrameTest, CopyFrom) {
|
||||
AudioFrame frame2;
|
||||
|
||||
int16_t samples[kNumChannels * kSamplesPerChannel] = {17};
|
||||
frame2.UpdateFrame(kTimestamp, samples, kSamplesPerChannel,
|
||||
kSampleRateHz, AudioFrame::kPLC, AudioFrame::kVadActive,
|
||||
kNumChannels);
|
||||
frame2.UpdateFrame(kTimestamp, samples, kSamplesPerChannel, kSampleRateHz,
|
||||
AudioFrame::kPLC, AudioFrame::kVadActive, kNumChannels);
|
||||
frame1.CopyFrom(frame2);
|
||||
|
||||
EXPECT_EQ(frame2.timestamp_, frame1.timestamp_);
|
||||
|
||||
@ -220,9 +220,8 @@ class AudioEncoder {
|
||||
|
||||
// Provides target audio bitrate and corresponding probing interval of
|
||||
// the bandwidth estimator to this encoder to allow it to adapt.
|
||||
virtual void OnReceivedUplinkBandwidth(
|
||||
int target_audio_bitrate_bps,
|
||||
rtc::Optional<int64_t> bwe_period_ms);
|
||||
virtual void OnReceivedUplinkBandwidth(int target_audio_bitrate_bps,
|
||||
rtc::Optional<int64_t> bwe_period_ms);
|
||||
|
||||
// Provides RTT to this encoder to allow it to adapt.
|
||||
virtual void OnReceivedRtt(int rtt_ms);
|
||||
|
||||
@ -112,7 +112,7 @@ struct AudioOptions {
|
||||
ost << ToStringIfSet("residual_echo_detector", residual_echo_detector);
|
||||
ost << ToStringIfSet("tx_agc_target_dbov", tx_agc_target_dbov);
|
||||
ost << ToStringIfSet("tx_agc_digital_compression_gain",
|
||||
tx_agc_digital_compression_gain);
|
||||
tx_agc_digital_compression_gain);
|
||||
ost << ToStringIfSet("tx_agc_limiter", tx_agc_limiter);
|
||||
ost << ToStringIfSet("combined_audio_video_bwe", combined_audio_video_bwe);
|
||||
ost << ToStringIfSet("audio_network_adaptor", audio_network_adaptor);
|
||||
|
||||
@ -46,14 +46,14 @@ class Candidate {
|
||||
Candidate(const Candidate&);
|
||||
~Candidate();
|
||||
|
||||
const std::string & id() const { return id_; }
|
||||
void set_id(const std::string & id) { id_ = id; }
|
||||
const std::string& id() const { return id_; }
|
||||
void set_id(const std::string& id) { id_ = id; }
|
||||
|
||||
int component() const { return component_; }
|
||||
void set_component(int component) { component_ = component; }
|
||||
|
||||
const std::string & protocol() const { return protocol_; }
|
||||
void set_protocol(const std::string & protocol) { protocol_ = protocol; }
|
||||
const std::string& protocol() const { return protocol_; }
|
||||
void set_protocol(const std::string& protocol) { protocol_ = protocol; }
|
||||
|
||||
// The protocol used to talk to relay.
|
||||
const std::string& relay_protocol() const { return relay_protocol_; }
|
||||
@ -61,10 +61,8 @@ class Candidate {
|
||||
relay_protocol_ = protocol;
|
||||
}
|
||||
|
||||
const rtc::SocketAddress & address() const { return address_; }
|
||||
void set_address(const rtc::SocketAddress & address) {
|
||||
address_ = address;
|
||||
}
|
||||
const rtc::SocketAddress& address() const { return address_; }
|
||||
void set_address(const rtc::SocketAddress& address) { address_ = address; }
|
||||
|
||||
uint32_t priority() const { return priority_; }
|
||||
void set_priority(const uint32_t priority) { priority_ = priority; }
|
||||
@ -91,17 +89,17 @@ class Candidate {
|
||||
}
|
||||
|
||||
// TODO(honghaiz): Change to usernameFragment or ufrag.
|
||||
const std::string & username() const { return username_; }
|
||||
void set_username(const std::string & username) { username_ = username; }
|
||||
const std::string& username() const { return username_; }
|
||||
void set_username(const std::string& username) { username_ = username; }
|
||||
|
||||
const std::string & password() const { return password_; }
|
||||
void set_password(const std::string & password) { password_ = password; }
|
||||
const std::string& password() const { return password_; }
|
||||
void set_password(const std::string& password) { password_ = password; }
|
||||
|
||||
const std::string & type() const { return type_; }
|
||||
void set_type(const std::string & type) { type_ = type; }
|
||||
const std::string& type() const { return type_; }
|
||||
void set_type(const std::string& type) { type_ = type; }
|
||||
|
||||
const std::string & network_name() const { return network_name_; }
|
||||
void set_network_name(const std::string & network_name) {
|
||||
const std::string& network_name() const { return network_name_; }
|
||||
void set_network_name(const std::string& network_name) {
|
||||
network_name_ = network_name;
|
||||
}
|
||||
|
||||
@ -127,24 +125,17 @@ class Candidate {
|
||||
uint16_t network_id() const { return network_id_; }
|
||||
void set_network_id(uint16_t network_id) { network_id_ = network_id; }
|
||||
|
||||
const std::string& foundation() const {
|
||||
return foundation_;
|
||||
}
|
||||
const std::string& foundation() const { return foundation_; }
|
||||
void set_foundation(const std::string& foundation) {
|
||||
foundation_ = foundation;
|
||||
}
|
||||
|
||||
const rtc::SocketAddress & related_address() const {
|
||||
return related_address_;
|
||||
}
|
||||
void set_related_address(
|
||||
const rtc::SocketAddress & related_address) {
|
||||
const rtc::SocketAddress& related_address() const { return related_address_; }
|
||||
void set_related_address(const rtc::SocketAddress& related_address) {
|
||||
related_address_ = related_address;
|
||||
}
|
||||
const std::string& tcptype() const { return tcptype_; }
|
||||
void set_tcptype(const std::string& tcptype) {
|
||||
tcptype_ = tcptype;
|
||||
}
|
||||
void set_tcptype(const std::string& tcptype) { tcptype_ = tcptype; }
|
||||
|
||||
// The name of the transport channel of this candidate.
|
||||
// TODO(phoglund): remove.
|
||||
@ -164,13 +155,9 @@ class Candidate {
|
||||
// given one when looking for a matching candidate to remove.
|
||||
bool MatchesForRemoval(const Candidate& c) const;
|
||||
|
||||
std::string ToString() const {
|
||||
return ToStringInternal(false);
|
||||
}
|
||||
std::string ToString() const { return ToStringInternal(false); }
|
||||
|
||||
std::string ToSensitiveString() const {
|
||||
return ToStringInternal(true);
|
||||
}
|
||||
std::string ToSensitiveString() const { return ToStringInternal(true); }
|
||||
|
||||
uint32_t GetPriority(uint32_t type_preference,
|
||||
int network_adapter_preference,
|
||||
|
||||
@ -61,14 +61,10 @@ struct DataChannelInit {
|
||||
// as binary or text.
|
||||
struct DataBuffer {
|
||||
DataBuffer(const rtc::CopyOnWriteBuffer& data, bool binary)
|
||||
: data(data),
|
||||
binary(binary) {
|
||||
}
|
||||
: data(data), binary(binary) {}
|
||||
// For convenience for unit tests.
|
||||
explicit DataBuffer(const std::string& text)
|
||||
: data(text.data(), text.length()),
|
||||
binary(false) {
|
||||
}
|
||||
: data(text.data(), text.length()), binary(false) {}
|
||||
size_t size() const { return data.size(); }
|
||||
|
||||
rtc::CopyOnWriteBuffer data;
|
||||
|
||||
@ -67,7 +67,8 @@ class DtmfSenderInterface : public rtc::RefCountInterface {
|
||||
// If InsertDtmf is called on the same object while an existing task for this
|
||||
// object to generate DTMF is still running, the previous task is canceled.
|
||||
// Returns true on success and false on failure.
|
||||
virtual bool InsertDtmf(const std::string& tones, int duration,
|
||||
virtual bool InsertDtmf(const std::string& tones,
|
||||
int duration,
|
||||
int inter_tone_gap) = 0;
|
||||
|
||||
// Returns the track given as argument to the constructor. Only exists for
|
||||
|
||||
@ -36,7 +36,7 @@ void FakeMetricsObserver::IncrementEnumCounter(
|
||||
}
|
||||
|
||||
void FakeMetricsObserver::AddHistogramSample(PeerConnectionMetricsName type,
|
||||
int value) {
|
||||
int value) {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
RTC_DCHECK_EQ(histogram_samples_[type], 0);
|
||||
histogram_samples_[type] = value;
|
||||
|
||||
@ -28,8 +28,7 @@ class FakeMetricsObserver : public MetricsObserverInterface {
|
||||
void IncrementEnumCounter(PeerConnectionEnumCounterType,
|
||||
int counter,
|
||||
int counter_max) override;
|
||||
void AddHistogramSample(PeerConnectionMetricsName type,
|
||||
int value) override;
|
||||
void AddHistogramSample(PeerConnectionMetricsName type, int value) override;
|
||||
|
||||
// Accessors to be used by the tests.
|
||||
int GetEnumCounter(PeerConnectionEnumCounterType type, int counter) const;
|
||||
|
||||
@ -205,9 +205,7 @@ class CreateSessionDescriptionObserver : public rtc::RefCountInterface {
|
||||
// is deprecated; in order to let clients remove the old version, it has a
|
||||
// default implementation. If both versions are unimplemented, the
|
||||
// result will be a runtime error (stack overflow). This is intentional.
|
||||
virtual void OnFailure(RTCError error) {
|
||||
OnFailure(error.message());
|
||||
}
|
||||
virtual void OnFailure(RTCError error) { OnFailure(error.message()); }
|
||||
virtual void OnFailure(const std::string& error) {
|
||||
OnFailure(RTCError(RTCErrorType::INTERNAL_ERROR, std::string(error)));
|
||||
}
|
||||
|
||||
@ -28,7 +28,8 @@ namespace webrtc {
|
||||
class JsepIceCandidate : public IceCandidateInterface {
|
||||
public:
|
||||
JsepIceCandidate(const std::string& sdp_mid, int sdp_mline_index);
|
||||
JsepIceCandidate(const std::string& sdp_mid, int sdp_mline_index,
|
||||
JsepIceCandidate(const std::string& sdp_mid,
|
||||
int sdp_mline_index,
|
||||
const cricket::Candidate& candidate);
|
||||
~JsepIceCandidate();
|
||||
// |err| may be null.
|
||||
@ -39,9 +40,7 @@ class JsepIceCandidate : public IceCandidateInterface {
|
||||
|
||||
virtual std::string sdp_mid() const { return sdp_mid_; }
|
||||
virtual int sdp_mline_index() const { return sdp_mline_index_; }
|
||||
virtual const cricket::Candidate& candidate() const {
|
||||
return candidate_;
|
||||
}
|
||||
virtual const cricket::Candidate& candidate() const { return candidate_; }
|
||||
|
||||
virtual std::string server_url() const { return candidate_.url(); }
|
||||
|
||||
@ -64,9 +63,7 @@ class JsepCandidateCollection : public IceCandidateCollection {
|
||||
JsepCandidateCollection(JsepCandidateCollection&& o)
|
||||
: candidates_(std::move(o.candidates_)) {}
|
||||
~JsepCandidateCollection();
|
||||
virtual size_t count() const {
|
||||
return candidates_.size();
|
||||
}
|
||||
virtual size_t count() const { return candidates_.size(); }
|
||||
virtual bool HasCandidate(const IceCandidateInterface* candidate) const;
|
||||
// Adds and takes ownership of the JsepIceCandidate.
|
||||
// TODO(deadbeef): Make this use an std::unique_ptr<>, so ownership logic is
|
||||
|
||||
@ -41,8 +41,8 @@ class JsepSessionDescription : public SessionDescriptionInterface {
|
||||
// TODO(deadbeef): Make this use an std::unique_ptr<>, so ownership logic is
|
||||
// more clear.
|
||||
bool Initialize(cricket::SessionDescription* description,
|
||||
const std::string& session_id,
|
||||
const std::string& session_version);
|
||||
const std::string& session_id,
|
||||
const std::string& session_version);
|
||||
|
||||
virtual cricket::SessionDescription* description() {
|
||||
return description_.get();
|
||||
@ -50,12 +50,8 @@ class JsepSessionDescription : public SessionDescriptionInterface {
|
||||
virtual const cricket::SessionDescription* description() const {
|
||||
return description_.get();
|
||||
}
|
||||
virtual std::string session_id() const {
|
||||
return session_id_;
|
||||
}
|
||||
virtual std::string session_version() const {
|
||||
return session_version_;
|
||||
}
|
||||
virtual std::string session_id() const { return session_id_; }
|
||||
virtual std::string session_version() const { return session_version_; }
|
||||
virtual SdpType GetType() const { return type_; }
|
||||
virtual std::string type() const { return SdpTypeToString(type_); }
|
||||
// Allows changing the type. Used for testing.
|
||||
|
||||
@ -89,8 +89,7 @@ const char MediaConstraintsInterface::kMaxFrameRate[] = "maxFrameRate";
|
||||
const char MediaConstraintsInterface::kMinFrameRate[] = "minFrameRate";
|
||||
|
||||
// Audio constraints.
|
||||
const char MediaConstraintsInterface::kEchoCancellation[] =
|
||||
"echoCancellation";
|
||||
const char MediaConstraintsInterface::kEchoCancellation[] = "echoCancellation";
|
||||
const char MediaConstraintsInterface::kGoogEchoCancellation[] =
|
||||
"googEchoCancellation";
|
||||
const char MediaConstraintsInterface::kExtendedFilterEchoCancellation[] =
|
||||
@ -107,8 +106,7 @@ const char MediaConstraintsInterface::kExperimentalNoiseSuppression[] =
|
||||
"googNoiseSuppression2";
|
||||
const char MediaConstraintsInterface::kIntelligibilityEnhancer[] =
|
||||
"intelligibilityEnhancer";
|
||||
const char MediaConstraintsInterface::kHighpassFilter[] =
|
||||
"googHighpassFilter";
|
||||
const char MediaConstraintsInterface::kHighpassFilter[] = "googHighpassFilter";
|
||||
const char MediaConstraintsInterface::kTypingNoiseDetection[] =
|
||||
"googTypingNoiseDetection";
|
||||
const char MediaConstraintsInterface::kAudioMirroring[] = "googAudioMirroring";
|
||||
@ -125,11 +123,9 @@ const char MediaConstraintsInterface::kOfferToReceiveVideo[] =
|
||||
"OfferToReceiveVideo";
|
||||
const char MediaConstraintsInterface::kVoiceActivityDetection[] =
|
||||
"VoiceActivityDetection";
|
||||
const char MediaConstraintsInterface::kIceRestart[] =
|
||||
"IceRestart";
|
||||
const char MediaConstraintsInterface::kIceRestart[] = "IceRestart";
|
||||
// Google specific constraint for BUNDLE enable/disable.
|
||||
const char MediaConstraintsInterface::kUseRtpMux[] =
|
||||
"googUseRtpMUX";
|
||||
const char MediaConstraintsInterface::kUseRtpMux[] = "googUseRtpMUX";
|
||||
|
||||
// Below constraints should be used during PeerConnection construction.
|
||||
const char MediaConstraintsInterface::kEnableDtlsSrtp[] =
|
||||
@ -150,11 +146,11 @@ const char MediaConstraintsInterface::kCpuOveruseDetection[] =
|
||||
"googCpuOveruseDetection";
|
||||
const char MediaConstraintsInterface::kPayloadPadding[] = "googPayloadPadding";
|
||||
|
||||
|
||||
// Set |value| to the value associated with the first appearance of |key|, or
|
||||
// return false if |key| is not found.
|
||||
bool MediaConstraintsInterface::Constraints::FindFirst(
|
||||
const std::string& key, std::string* value) const {
|
||||
const std::string& key,
|
||||
std::string* value) const {
|
||||
for (Constraints::const_iterator iter = begin(); iter != end(); ++iter) {
|
||||
if (iter->key == key) {
|
||||
*value = iter->value;
|
||||
@ -165,7 +161,8 @@ bool MediaConstraintsInterface::Constraints::FindFirst(
|
||||
}
|
||||
|
||||
bool FindConstraint(const MediaConstraintsInterface* constraints,
|
||||
const std::string& key, bool* value,
|
||||
const std::string& key,
|
||||
bool* value,
|
||||
size_t* mandatory_constraints) {
|
||||
return ::FindConstraint<bool>(constraints, key, value, mandatory_constraints);
|
||||
}
|
||||
@ -192,9 +189,9 @@ void CopyConstraintsIntoRtcConfiguration(
|
||||
}
|
||||
FindConstraint(constraints, MediaConstraintsInterface::kEnableDscp,
|
||||
&configuration->media_config.enable_dscp, nullptr);
|
||||
FindConstraint(
|
||||
constraints, MediaConstraintsInterface::kCpuOveruseDetection,
|
||||
&configuration->media_config.video.enable_cpu_adaptation, nullptr);
|
||||
FindConstraint(constraints, MediaConstraintsInterface::kCpuOveruseDetection,
|
||||
&configuration->media_config.video.enable_cpu_adaptation,
|
||||
nullptr);
|
||||
FindConstraint(constraints, MediaConstraintsInterface::kEnableRtpDataChannels,
|
||||
&configuration->enable_rtp_data_channel, nullptr);
|
||||
// Find Suspend Below Min Bitrate constraint.
|
||||
|
||||
@ -39,8 +39,7 @@ class MediaConstraintsInterface {
|
||||
struct Constraint {
|
||||
Constraint() {}
|
||||
Constraint(const std::string& key, const std::string value)
|
||||
: key(key), value(value) {
|
||||
}
|
||||
: key(key), value(value) {}
|
||||
std::string key;
|
||||
std::string value;
|
||||
};
|
||||
@ -54,12 +53,12 @@ class MediaConstraintsInterface {
|
||||
// Specified by draft-alvestrand-constraints-resolution-00b
|
||||
static const char kMinAspectRatio[]; // minAspectRatio
|
||||
static const char kMaxAspectRatio[]; // maxAspectRatio
|
||||
static const char kMaxWidth[]; // maxWidth
|
||||
static const char kMinWidth[]; // minWidth
|
||||
static const char kMaxHeight[]; // maxHeight
|
||||
static const char kMinHeight[]; // minHeight
|
||||
static const char kMaxFrameRate[]; // maxFrameRate
|
||||
static const char kMinFrameRate[]; // minFrameRate
|
||||
static const char kMaxWidth[]; // maxWidth
|
||||
static const char kMinWidth[]; // minWidth
|
||||
static const char kMaxHeight[]; // maxHeight
|
||||
static const char kMinHeight[]; // minHeight
|
||||
static const char kMaxFrameRate[]; // maxFrameRate
|
||||
static const char kMinFrameRate[]; // minFrameRate
|
||||
|
||||
// Constraint keys used by a local audio source.
|
||||
static const char kEchoCancellation[]; // echoCancellation
|
||||
@ -68,15 +67,15 @@ class MediaConstraintsInterface {
|
||||
static const char kGoogEchoCancellation[]; // googEchoCancellation
|
||||
|
||||
static const char kExtendedFilterEchoCancellation[]; // googEchoCancellation2
|
||||
static const char kDAEchoCancellation[]; // googDAEchoCancellation
|
||||
static const char kAutoGainControl[]; // googAutoGainControl
|
||||
static const char kExperimentalAutoGainControl[]; // googAutoGainControl2
|
||||
static const char kNoiseSuppression[]; // googNoiseSuppression
|
||||
static const char kDAEchoCancellation[]; // googDAEchoCancellation
|
||||
static const char kAutoGainControl[]; // googAutoGainControl
|
||||
static const char kExperimentalAutoGainControl[]; // googAutoGainControl2
|
||||
static const char kNoiseSuppression[]; // googNoiseSuppression
|
||||
static const char kExperimentalNoiseSuppression[]; // googNoiseSuppression2
|
||||
static const char kIntelligibilityEnhancer[]; // intelligibilityEnhancer
|
||||
static const char kHighpassFilter[]; // googHighpassFilter
|
||||
static const char kIntelligibilityEnhancer[]; // intelligibilityEnhancer
|
||||
static const char kHighpassFilter[]; // googHighpassFilter
|
||||
static const char kTypingNoiseDetection[]; // googTypingNoiseDetection
|
||||
static const char kAudioMirroring[]; // googAudioMirroring
|
||||
static const char kAudioMirroring[]; // googAudioMirroring
|
||||
static const char
|
||||
kAudioNetworkAdaptorConfig[]; // goodAudioNetworkAdaptorConfig
|
||||
|
||||
@ -85,15 +84,15 @@ class MediaConstraintsInterface {
|
||||
|
||||
// Constraint keys for CreateOffer / CreateAnswer
|
||||
// Specified by the W3C PeerConnection spec
|
||||
static const char kOfferToReceiveVideo[]; // OfferToReceiveVideo
|
||||
static const char kOfferToReceiveAudio[]; // OfferToReceiveAudio
|
||||
static const char kOfferToReceiveVideo[]; // OfferToReceiveVideo
|
||||
static const char kOfferToReceiveAudio[]; // OfferToReceiveAudio
|
||||
static const char kVoiceActivityDetection[]; // VoiceActivityDetection
|
||||
static const char kIceRestart[]; // IceRestart
|
||||
static const char kIceRestart[]; // IceRestart
|
||||
// These keys are google specific.
|
||||
static const char kUseRtpMux[]; // googUseRtpMUX
|
||||
|
||||
// Constraints values.
|
||||
static const char kValueTrue[]; // true
|
||||
static const char kValueTrue[]; // true
|
||||
static const char kValueFalse[]; // false
|
||||
|
||||
// PeerConnection constraint keys.
|
||||
@ -108,12 +107,12 @@ class MediaConstraintsInterface {
|
||||
static const char kEnableIPv6[]; // googIPv6
|
||||
// Temporary constraint to enable suspend below min bitrate feature.
|
||||
static const char kEnableVideoSuspendBelowMinBitrate[];
|
||||
// googSuspendBelowMinBitrate
|
||||
// googSuspendBelowMinBitrate
|
||||
// Constraint to enable combined audio+video bandwidth estimation.
|
||||
static const char kCombinedAudioVideoBwe[]; // googCombinedAudioVideoBwe
|
||||
static const char kScreencastMinBitrate[]; // googScreencastMinBitrate
|
||||
static const char kCpuOveruseDetection[]; // googCpuOveruseDetection
|
||||
static const char kPayloadPadding[]; // googPayloadPadding
|
||||
static const char kScreencastMinBitrate[]; // googScreencastMinBitrate
|
||||
static const char kCpuOveruseDetection[]; // googCpuOveruseDetection
|
||||
static const char kPayloadPadding[]; // googPayloadPadding
|
||||
|
||||
// The prefix of internal-only constraints whose JS set values should be
|
||||
// stripped by Chrome before passed down to Libjingle.
|
||||
@ -126,7 +125,8 @@ class MediaConstraintsInterface {
|
||||
};
|
||||
|
||||
bool FindConstraint(const MediaConstraintsInterface* constraints,
|
||||
const std::string& key, bool* value,
|
||||
const std::string& key,
|
||||
bool* value,
|
||||
size_t* mandatory_constraints);
|
||||
|
||||
bool FindConstraint(const MediaConstraintsInterface* constraints,
|
||||
|
||||
@ -60,12 +60,7 @@ class NotifierInterface {
|
||||
class MediaSourceInterface : public rtc::RefCountInterface,
|
||||
public NotifierInterface {
|
||||
public:
|
||||
enum SourceState {
|
||||
kInitializing,
|
||||
kLive,
|
||||
kEnded,
|
||||
kMuted
|
||||
};
|
||||
enum SourceState { kInitializing, kLive, kEnded, kMuted };
|
||||
|
||||
virtual SourceState state() const = 0;
|
||||
|
||||
@ -116,9 +111,8 @@ class MediaStreamTrackInterface : public rtc::RefCountInterface,
|
||||
// on the worker thread via a VideoTrack. A custom implementation of a source
|
||||
// can inherit AdaptedVideoTrackSource instead of directly implementing this
|
||||
// interface.
|
||||
class VideoTrackSourceInterface
|
||||
: public MediaSourceInterface,
|
||||
public rtc::VideoSourceInterface<VideoFrame> {
|
||||
class VideoTrackSourceInterface : public MediaSourceInterface,
|
||||
public rtc::VideoSourceInterface<VideoFrame> {
|
||||
public:
|
||||
struct Stats {
|
||||
// Original size of captured frame, before video adaptation.
|
||||
@ -156,9 +150,8 @@ class VideoTrackSourceInterface
|
||||
// PeerConnectionFactory::CreateVideoTrack can be used for creating a VideoTrack
|
||||
// that ensures thread safety and that all methods are called on the right
|
||||
// thread.
|
||||
class VideoTrackInterface
|
||||
: public MediaStreamTrackInterface,
|
||||
public rtc::VideoSourceInterface<VideoFrame> {
|
||||
class VideoTrackInterface : public MediaStreamTrackInterface,
|
||||
public rtc::VideoSourceInterface<VideoFrame> {
|
||||
public:
|
||||
// Video track content hint, used to override the source is_screencast
|
||||
// property.
|
||||
@ -276,7 +269,7 @@ class AudioTrackInterface : public MediaStreamTrackInterface {
|
||||
public:
|
||||
// TODO(deadbeef): Figure out if the following interface should be const or
|
||||
// not.
|
||||
virtual AudioSourceInterface* GetSource() const = 0;
|
||||
virtual AudioSourceInterface* GetSource() const = 0;
|
||||
|
||||
// Add/Remove a sink that will receive the audio data from the track.
|
||||
virtual void AddSink(AudioTrackSinkInterface* sink) = 0;
|
||||
@ -297,10 +290,8 @@ class AudioTrackInterface : public MediaStreamTrackInterface {
|
||||
~AudioTrackInterface() override = default;
|
||||
};
|
||||
|
||||
typedef std::vector<rtc::scoped_refptr<AudioTrackInterface> >
|
||||
AudioTrackVector;
|
||||
typedef std::vector<rtc::scoped_refptr<VideoTrackInterface> >
|
||||
VideoTrackVector;
|
||||
typedef std::vector<rtc::scoped_refptr<AudioTrackInterface> > AudioTrackVector;
|
||||
typedef std::vector<rtc::scoped_refptr<VideoTrackInterface> > VideoTrackVector;
|
||||
|
||||
// C++ version of https://www.w3.org/TR/mediacapture-streams/#mediastream.
|
||||
//
|
||||
@ -317,10 +308,10 @@ class MediaStreamInterface : public rtc::RefCountInterface,
|
||||
|
||||
virtual AudioTrackVector GetAudioTracks() = 0;
|
||||
virtual VideoTrackVector GetVideoTracks() = 0;
|
||||
virtual rtc::scoped_refptr<AudioTrackInterface>
|
||||
FindAudioTrack(const std::string& track_id) = 0;
|
||||
virtual rtc::scoped_refptr<VideoTrackInterface>
|
||||
FindVideoTrack(const std::string& track_id) = 0;
|
||||
virtual rtc::scoped_refptr<AudioTrackInterface> FindAudioTrack(
|
||||
const std::string& track_id) = 0;
|
||||
virtual rtc::scoped_refptr<VideoTrackInterface> FindVideoTrack(
|
||||
const std::string& track_id) = 0;
|
||||
|
||||
virtual bool AddTrack(AudioTrackInterface* track) = 0;
|
||||
virtual bool AddTrack(VideoTrackInterface* track) = 0;
|
||||
|
||||
@ -21,22 +21,22 @@ namespace webrtc {
|
||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||
// are called on is an implementation detail.
|
||||
BEGIN_SIGNALING_PROXY_MAP(MediaStream)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_CONSTMETHOD0(std::string, id)
|
||||
PROXY_METHOD0(AudioTrackVector, GetAudioTracks)
|
||||
PROXY_METHOD0(VideoTrackVector, GetVideoTracks)
|
||||
PROXY_METHOD1(rtc::scoped_refptr<AudioTrackInterface>,
|
||||
FindAudioTrack,
|
||||
const std::string&)
|
||||
PROXY_METHOD1(rtc::scoped_refptr<VideoTrackInterface>,
|
||||
FindVideoTrack,
|
||||
const std::string&)
|
||||
PROXY_METHOD1(bool, AddTrack, AudioTrackInterface*)
|
||||
PROXY_METHOD1(bool, AddTrack, VideoTrackInterface*)
|
||||
PROXY_METHOD1(bool, RemoveTrack, AudioTrackInterface*)
|
||||
PROXY_METHOD1(bool, RemoveTrack, VideoTrackInterface*)
|
||||
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
||||
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_CONSTMETHOD0(std::string, id)
|
||||
PROXY_METHOD0(AudioTrackVector, GetAudioTracks)
|
||||
PROXY_METHOD0(VideoTrackVector, GetVideoTracks)
|
||||
PROXY_METHOD1(rtc::scoped_refptr<AudioTrackInterface>,
|
||||
FindAudioTrack,
|
||||
const std::string&)
|
||||
PROXY_METHOD1(rtc::scoped_refptr<VideoTrackInterface>,
|
||||
FindVideoTrack,
|
||||
const std::string&)
|
||||
PROXY_METHOD1(bool, AddTrack, AudioTrackInterface*)
|
||||
PROXY_METHOD1(bool, AddTrack, VideoTrackInterface*)
|
||||
PROXY_METHOD1(bool, RemoveTrack, AudioTrackInterface*)
|
||||
PROXY_METHOD1(bool, RemoveTrack, VideoTrackInterface*)
|
||||
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
||||
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
||||
END_PROXY_MAP()
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -25,39 +25,39 @@ namespace webrtc {
|
||||
// are called on is an implementation detail.
|
||||
|
||||
BEGIN_SIGNALING_PROXY_MAP(AudioTrack)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_CONSTMETHOD0(std::string, kind)
|
||||
PROXY_CONSTMETHOD0(std::string, id)
|
||||
PROXY_CONSTMETHOD0(TrackState, state)
|
||||
PROXY_CONSTMETHOD0(bool, enabled)
|
||||
PROXY_CONSTMETHOD0(AudioSourceInterface*, GetSource)
|
||||
PROXY_METHOD1(void, AddSink, AudioTrackSinkInterface*)
|
||||
PROXY_METHOD1(void, RemoveSink, AudioTrackSinkInterface*)
|
||||
PROXY_METHOD1(bool, GetSignalLevel, int*)
|
||||
PROXY_METHOD0(rtc::scoped_refptr<AudioProcessorInterface>, GetAudioProcessor)
|
||||
PROXY_METHOD1(bool, set_enabled, bool)
|
||||
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
||||
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_CONSTMETHOD0(std::string, kind)
|
||||
PROXY_CONSTMETHOD0(std::string, id)
|
||||
PROXY_CONSTMETHOD0(TrackState, state)
|
||||
PROXY_CONSTMETHOD0(bool, enabled)
|
||||
PROXY_CONSTMETHOD0(AudioSourceInterface*, GetSource)
|
||||
PROXY_METHOD1(void, AddSink, AudioTrackSinkInterface*)
|
||||
PROXY_METHOD1(void, RemoveSink, AudioTrackSinkInterface*)
|
||||
PROXY_METHOD1(bool, GetSignalLevel, int*)
|
||||
PROXY_METHOD0(rtc::scoped_refptr<AudioProcessorInterface>, GetAudioProcessor)
|
||||
PROXY_METHOD1(bool, set_enabled, bool)
|
||||
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
||||
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
||||
END_PROXY_MAP()
|
||||
|
||||
BEGIN_PROXY_MAP(VideoTrack)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_CONSTMETHOD0(std::string, kind)
|
||||
PROXY_CONSTMETHOD0(std::string, id)
|
||||
PROXY_CONSTMETHOD0(TrackState, state)
|
||||
PROXY_CONSTMETHOD0(bool, enabled)
|
||||
PROXY_METHOD1(bool, set_enabled, bool)
|
||||
PROXY_CONSTMETHOD0(ContentHint, content_hint)
|
||||
PROXY_METHOD1(void, set_content_hint, ContentHint)
|
||||
PROXY_WORKER_METHOD2(void,
|
||||
AddOrUpdateSink,
|
||||
rtc::VideoSinkInterface<VideoFrame>*,
|
||||
const rtc::VideoSinkWants&)
|
||||
PROXY_WORKER_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
|
||||
PROXY_CONSTMETHOD0(VideoTrackSourceInterface*, GetSource)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_CONSTMETHOD0(std::string, kind)
|
||||
PROXY_CONSTMETHOD0(std::string, id)
|
||||
PROXY_CONSTMETHOD0(TrackState, state)
|
||||
PROXY_CONSTMETHOD0(bool, enabled)
|
||||
PROXY_METHOD1(bool, set_enabled, bool)
|
||||
PROXY_CONSTMETHOD0(ContentHint, content_hint)
|
||||
PROXY_METHOD1(void, set_content_hint, ContentHint)
|
||||
PROXY_WORKER_METHOD2(void,
|
||||
AddOrUpdateSink,
|
||||
rtc::VideoSinkInterface<VideoFrame>*,
|
||||
const rtc::VideoSinkWants&)
|
||||
PROXY_WORKER_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
|
||||
PROXY_CONSTMETHOD0(VideoTrackSourceInterface*, GetSource)
|
||||
|
||||
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
||||
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
||||
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
||||
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
||||
END_PROXY_MAP()
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -15,11 +15,7 @@
|
||||
|
||||
namespace cricket {
|
||||
|
||||
enum MediaType {
|
||||
MEDIA_TYPE_AUDIO,
|
||||
MEDIA_TYPE_VIDEO,
|
||||
MEDIA_TYPE_DATA
|
||||
};
|
||||
enum MediaType { MEDIA_TYPE_AUDIO, MEDIA_TYPE_VIDEO, MEDIA_TYPE_DATA };
|
||||
|
||||
std::string MediaTypeToString(MediaType type);
|
||||
// Aborts on invalid string. Only expected to be used on strings that are
|
||||
|
||||
@ -23,8 +23,7 @@ namespace webrtc {
|
||||
template <class T>
|
||||
class Notifier : public T {
|
||||
public:
|
||||
Notifier() {
|
||||
}
|
||||
Notifier() {}
|
||||
|
||||
virtual void RegisterObserver(ObserverInterface* observer) {
|
||||
RTC_DCHECK(observer != nullptr);
|
||||
|
||||
@ -20,4 +20,4 @@ TEST_F(SessionDescriptionTest, CreateSessionDescription) {
|
||||
EXPECT_EQ(-1, s.session_id());
|
||||
EXPECT_EQ("0", s.session_version());
|
||||
}
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
#ifndef API_ORTC_SRTPTRANSPORTINTERFACE_H_
|
||||
#define API_ORTC_SRTPTRANSPORTINTERFACE_H_
|
||||
|
||||
#include "api/cryptoparams.h"
|
||||
#include "api/ortc/rtptransportinterface.h"
|
||||
#include "api/rtcerror.h"
|
||||
#include "api/cryptoparams.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
||||
@ -24,50 +24,53 @@ namespace webrtc {
|
||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||
// are called on is an implementation detail.
|
||||
BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
// Use the overloads of CreateVideoSource that take raw VideoCapturer
|
||||
// pointers from PeerConnectionFactoryInterface.
|
||||
// TODO(deadbeef): Remove this using statement once those overloads are
|
||||
// removed.
|
||||
using PeerConnectionFactoryInterface::CreateVideoSource;
|
||||
PROXY_METHOD1(void, SetOptions, const Options&)
|
||||
PROXY_METHOD5(rtc::scoped_refptr<PeerConnectionInterface>,
|
||||
CreatePeerConnection,
|
||||
const PeerConnectionInterface::RTCConfiguration&,
|
||||
const MediaConstraintsInterface*,
|
||||
std::unique_ptr<cricket::PortAllocator>,
|
||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface>,
|
||||
PeerConnectionObserver*);
|
||||
PROXY_METHOD4(rtc::scoped_refptr<PeerConnectionInterface>,
|
||||
CreatePeerConnection,
|
||||
const PeerConnectionInterface::RTCConfiguration&,
|
||||
std::unique_ptr<cricket::PortAllocator>,
|
||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface>,
|
||||
PeerConnectionObserver*);
|
||||
PROXY_METHOD2(rtc::scoped_refptr<PeerConnectionInterface>,
|
||||
CreatePeerConnection,
|
||||
const PeerConnectionInterface::RTCConfiguration&,
|
||||
PeerConnectionDependencies);
|
||||
PROXY_METHOD1(rtc::scoped_refptr<MediaStreamInterface>,
|
||||
CreateLocalMediaStream, const std::string&)
|
||||
PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>,
|
||||
CreateAudioSource,
|
||||
const cricket::AudioOptions&)
|
||||
PROXY_METHOD2(rtc::scoped_refptr<VideoTrackSourceInterface>,
|
||||
CreateVideoSource,
|
||||
std::unique_ptr<cricket::VideoCapturer>,
|
||||
const MediaConstraintsInterface*)
|
||||
PROXY_METHOD1(rtc::scoped_refptr<VideoTrackSourceInterface>,
|
||||
CreateVideoSource,
|
||||
std::unique_ptr<cricket::VideoCapturer>)
|
||||
PROXY_METHOD2(rtc::scoped_refptr<VideoTrackInterface>,
|
||||
CreateVideoTrack,
|
||||
const std::string&,
|
||||
VideoTrackSourceInterface*)
|
||||
PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>,
|
||||
CreateAudioTrack, const std::string&, AudioSourceInterface*)
|
||||
PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t)
|
||||
PROXY_METHOD0(void, StopAecDump)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
// Use the overloads of CreateVideoSource that take raw VideoCapturer
|
||||
// pointers from PeerConnectionFactoryInterface.
|
||||
// TODO(deadbeef): Remove this using statement once those overloads are
|
||||
// removed.
|
||||
using PeerConnectionFactoryInterface::CreateVideoSource;
|
||||
PROXY_METHOD1(void, SetOptions, const Options&)
|
||||
PROXY_METHOD5(rtc::scoped_refptr<PeerConnectionInterface>,
|
||||
CreatePeerConnection,
|
||||
const PeerConnectionInterface::RTCConfiguration&,
|
||||
const MediaConstraintsInterface*,
|
||||
std::unique_ptr<cricket::PortAllocator>,
|
||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface>,
|
||||
PeerConnectionObserver*);
|
||||
PROXY_METHOD4(rtc::scoped_refptr<PeerConnectionInterface>,
|
||||
CreatePeerConnection,
|
||||
const PeerConnectionInterface::RTCConfiguration&,
|
||||
std::unique_ptr<cricket::PortAllocator>,
|
||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface>,
|
||||
PeerConnectionObserver*);
|
||||
PROXY_METHOD2(rtc::scoped_refptr<PeerConnectionInterface>,
|
||||
CreatePeerConnection,
|
||||
const PeerConnectionInterface::RTCConfiguration&,
|
||||
PeerConnectionDependencies);
|
||||
PROXY_METHOD1(rtc::scoped_refptr<MediaStreamInterface>,
|
||||
CreateLocalMediaStream,
|
||||
const std::string&)
|
||||
PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>,
|
||||
CreateAudioSource,
|
||||
const cricket::AudioOptions&)
|
||||
PROXY_METHOD2(rtc::scoped_refptr<VideoTrackSourceInterface>,
|
||||
CreateVideoSource,
|
||||
std::unique_ptr<cricket::VideoCapturer>,
|
||||
const MediaConstraintsInterface*)
|
||||
PROXY_METHOD1(rtc::scoped_refptr<VideoTrackSourceInterface>,
|
||||
CreateVideoSource,
|
||||
std::unique_ptr<cricket::VideoCapturer>)
|
||||
PROXY_METHOD2(rtc::scoped_refptr<VideoTrackInterface>,
|
||||
CreateVideoTrack,
|
||||
const std::string&,
|
||||
VideoTrackSourceInterface*)
|
||||
PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>,
|
||||
CreateAudioTrack,
|
||||
const std::string&,
|
||||
AudioSourceInterface*)
|
||||
PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t)
|
||||
PROXY_METHOD0(void, StopAecDump)
|
||||
END_PROXY_MAP()
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -116,13 +116,13 @@
|
||||
namespace rtc {
|
||||
class SSLIdentity;
|
||||
class Thread;
|
||||
}
|
||||
} // namespace rtc
|
||||
|
||||
namespace cricket {
|
||||
class MediaEngineInterface;
|
||||
class WebRtcVideoDecoderFactory;
|
||||
class WebRtcVideoEncoderFactory;
|
||||
}
|
||||
} // namespace cricket
|
||||
|
||||
namespace webrtc {
|
||||
class AudioDeviceModule;
|
||||
@ -139,10 +139,8 @@ class StreamCollectionInterface : public rtc::RefCountInterface {
|
||||
virtual size_t count() = 0;
|
||||
virtual MediaStreamInterface* at(size_t index) = 0;
|
||||
virtual MediaStreamInterface* find(const std::string& label) = 0;
|
||||
virtual MediaStreamTrackInterface* FindAudioTrack(
|
||||
const std::string& id) = 0;
|
||||
virtual MediaStreamTrackInterface* FindVideoTrack(
|
||||
const std::string& id) = 0;
|
||||
virtual MediaStreamTrackInterface* FindAudioTrack(const std::string& id) = 0;
|
||||
virtual MediaStreamTrackInterface* FindVideoTrack(const std::string& id) = 0;
|
||||
|
||||
protected:
|
||||
// Dtor protected as objects shouldn't be deleted via this interface.
|
||||
@ -262,10 +260,7 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||
kCandidateNetworkPolicyLowCost
|
||||
};
|
||||
|
||||
enum ContinualGatheringPolicy {
|
||||
GATHER_ONCE,
|
||||
GATHER_CONTINUALLY
|
||||
};
|
||||
enum ContinualGatheringPolicy { GATHER_ONCE, GATHER_CONTINUALLY };
|
||||
|
||||
enum class RTCConfigurationType {
|
||||
// A configuration that is safer to use, despite not having the best
|
||||
@ -634,14 +629,12 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||
// Accessor methods to active local streams.
|
||||
// This method is not supported with kUnifiedPlan semantics. Please use
|
||||
// GetSenders() instead.
|
||||
virtual rtc::scoped_refptr<StreamCollectionInterface>
|
||||
local_streams() = 0;
|
||||
virtual rtc::scoped_refptr<StreamCollectionInterface> local_streams() = 0;
|
||||
|
||||
// Accessor methods to remote streams.
|
||||
// This method is not supported with kUnifiedPlan semantics. Please use
|
||||
// GetReceivers() instead.
|
||||
virtual rtc::scoped_refptr<StreamCollectionInterface>
|
||||
remote_streams() = 0;
|
||||
virtual rtc::scoped_refptr<StreamCollectionInterface> remote_streams() = 0;
|
||||
|
||||
// Add a new MediaStream to be sent on this PeerConnection.
|
||||
// Note that a SessionDescription negotiation is needed before the
|
||||
@ -1374,9 +1367,9 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
|
||||
VideoTrackSourceInterface* source) = 0;
|
||||
|
||||
// Creates an new AudioTrack. At the moment |source| can be null.
|
||||
virtual rtc::scoped_refptr<AudioTrackInterface>
|
||||
CreateAudioTrack(const std::string& label,
|
||||
AudioSourceInterface* source) = 0;
|
||||
virtual rtc::scoped_refptr<AudioTrackInterface> CreateAudioTrack(
|
||||
const std::string& label,
|
||||
AudioSourceInterface* source) = 0;
|
||||
|
||||
// Starts AEC dump using existing file. Takes ownership of |file| and passes
|
||||
// it on to VoiceEngine (via other objects) immediately, which will take
|
||||
@ -1394,7 +1387,7 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
|
||||
// Dtor and ctor protected as objects shouldn't be created or deleted via
|
||||
// this interface.
|
||||
PeerConnectionFactoryInterface() {}
|
||||
~PeerConnectionFactoryInterface() {} // NOLINT
|
||||
~PeerConnectionFactoryInterface() {} // NOLINT
|
||||
};
|
||||
|
||||
// Create a new instance of PeerConnectionFactoryInterface.
|
||||
|
||||
@ -23,132 +23,132 @@ namespace webrtc {
|
||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||
// are called on is an implementation detail.
|
||||
BEGIN_SIGNALING_PROXY_MAP(PeerConnection)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, local_streams)
|
||||
PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, remote_streams)
|
||||
PROXY_METHOD1(bool, AddStream, MediaStreamInterface*)
|
||||
PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*)
|
||||
PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>,
|
||||
AddTrack,
|
||||
rtc::scoped_refptr<MediaStreamTrackInterface>,
|
||||
const std::vector<std::string>&);
|
||||
PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>,
|
||||
AddTrack,
|
||||
MediaStreamTrackInterface*,
|
||||
std::vector<MediaStreamInterface*>)
|
||||
PROXY_METHOD1(bool, RemoveTrack, RtpSenderInterface*)
|
||||
PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
|
||||
AddTransceiver,
|
||||
rtc::scoped_refptr<MediaStreamTrackInterface>)
|
||||
PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
|
||||
AddTransceiver,
|
||||
rtc::scoped_refptr<MediaStreamTrackInterface>,
|
||||
const RtpTransceiverInit&)
|
||||
PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
|
||||
AddTransceiver,
|
||||
cricket::MediaType)
|
||||
PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
|
||||
AddTransceiver,
|
||||
cricket::MediaType,
|
||||
const RtpTransceiverInit&)
|
||||
PROXY_METHOD1(rtc::scoped_refptr<DtmfSenderInterface>,
|
||||
CreateDtmfSender,
|
||||
AudioTrackInterface*)
|
||||
PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>,
|
||||
CreateSender,
|
||||
const std::string&,
|
||||
const std::string&)
|
||||
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpSenderInterface>>,
|
||||
GetSenders)
|
||||
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpReceiverInterface>>,
|
||||
GetReceivers)
|
||||
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>,
|
||||
GetTransceivers)
|
||||
PROXY_METHOD3(bool,
|
||||
GetStats,
|
||||
StatsObserver*,
|
||||
MediaStreamTrackInterface*,
|
||||
StatsOutputLevel)
|
||||
PROXY_METHOD1(void, GetStats, RTCStatsCollectorCallback*)
|
||||
PROXY_METHOD2(void,
|
||||
GetStats,
|
||||
rtc::scoped_refptr<RtpSenderInterface>,
|
||||
rtc::scoped_refptr<RTCStatsCollectorCallback>);
|
||||
PROXY_METHOD2(void,
|
||||
GetStats,
|
||||
rtc::scoped_refptr<RtpReceiverInterface>,
|
||||
rtc::scoped_refptr<RTCStatsCollectorCallback>);
|
||||
PROXY_METHOD2(rtc::scoped_refptr<DataChannelInterface>,
|
||||
CreateDataChannel,
|
||||
const std::string&,
|
||||
const DataChannelInit*)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, local_description)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, remote_description)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
||||
pending_local_description)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
||||
pending_remote_description)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
||||
current_local_description)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
||||
current_remote_description)
|
||||
PROXY_METHOD2(void,
|
||||
CreateOffer,
|
||||
CreateSessionDescriptionObserver*,
|
||||
const MediaConstraintsInterface*)
|
||||
PROXY_METHOD2(void,
|
||||
CreateAnswer,
|
||||
CreateSessionDescriptionObserver*,
|
||||
const MediaConstraintsInterface*)
|
||||
PROXY_METHOD2(void,
|
||||
CreateOffer,
|
||||
CreateSessionDescriptionObserver*,
|
||||
const RTCOfferAnswerOptions&)
|
||||
PROXY_METHOD2(void,
|
||||
CreateAnswer,
|
||||
CreateSessionDescriptionObserver*,
|
||||
const RTCOfferAnswerOptions&)
|
||||
PROXY_METHOD2(void,
|
||||
SetLocalDescription,
|
||||
SetSessionDescriptionObserver*,
|
||||
SessionDescriptionInterface*)
|
||||
PROXY_METHOD2(void,
|
||||
SetRemoteDescription,
|
||||
SetSessionDescriptionObserver*,
|
||||
SessionDescriptionInterface*)
|
||||
PROXY_METHOD2(void,
|
||||
SetRemoteDescription,
|
||||
std::unique_ptr<SessionDescriptionInterface>,
|
||||
rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>);
|
||||
PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration);
|
||||
PROXY_METHOD2(bool,
|
||||
SetConfiguration,
|
||||
const PeerConnectionInterface::RTCConfiguration&,
|
||||
RTCError*);
|
||||
PROXY_METHOD1(bool,
|
||||
SetConfiguration,
|
||||
const PeerConnectionInterface::RTCConfiguration&);
|
||||
PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*)
|
||||
PROXY_METHOD1(bool,
|
||||
RemoveIceCandidates,
|
||||
const std::vector<cricket::Candidate>&);
|
||||
PROXY_METHOD1(void, SetAudioPlayout, bool)
|
||||
PROXY_METHOD1(void, SetAudioRecording, bool)
|
||||
PROXY_METHOD1(void, RegisterUMAObserver, UMAObserver*)
|
||||
PROXY_METHOD1(RTCError, SetBitrate, const BitrateSettings&);
|
||||
PROXY_METHOD1(void,
|
||||
SetBitrateAllocationStrategy,
|
||||
std::unique_ptr<rtc::BitrateAllocationStrategy>);
|
||||
PROXY_METHOD0(SignalingState, signaling_state)
|
||||
PROXY_METHOD0(IceConnectionState, ice_connection_state)
|
||||
PROXY_METHOD0(IceGatheringState, ice_gathering_state)
|
||||
PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t)
|
||||
PROXY_METHOD2(bool,
|
||||
StartRtcEventLog,
|
||||
std::unique_ptr<RtcEventLogOutput>,
|
||||
int64_t);
|
||||
PROXY_METHOD0(void, StopRtcEventLog)
|
||||
PROXY_METHOD0(void, Close)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, local_streams)
|
||||
PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, remote_streams)
|
||||
PROXY_METHOD1(bool, AddStream, MediaStreamInterface*)
|
||||
PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*)
|
||||
PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>,
|
||||
AddTrack,
|
||||
rtc::scoped_refptr<MediaStreamTrackInterface>,
|
||||
const std::vector<std::string>&);
|
||||
PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>,
|
||||
AddTrack,
|
||||
MediaStreamTrackInterface*,
|
||||
std::vector<MediaStreamInterface*>)
|
||||
PROXY_METHOD1(bool, RemoveTrack, RtpSenderInterface*)
|
||||
PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
|
||||
AddTransceiver,
|
||||
rtc::scoped_refptr<MediaStreamTrackInterface>)
|
||||
PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
|
||||
AddTransceiver,
|
||||
rtc::scoped_refptr<MediaStreamTrackInterface>,
|
||||
const RtpTransceiverInit&)
|
||||
PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
|
||||
AddTransceiver,
|
||||
cricket::MediaType)
|
||||
PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
|
||||
AddTransceiver,
|
||||
cricket::MediaType,
|
||||
const RtpTransceiverInit&)
|
||||
PROXY_METHOD1(rtc::scoped_refptr<DtmfSenderInterface>,
|
||||
CreateDtmfSender,
|
||||
AudioTrackInterface*)
|
||||
PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>,
|
||||
CreateSender,
|
||||
const std::string&,
|
||||
const std::string&)
|
||||
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpSenderInterface>>,
|
||||
GetSenders)
|
||||
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpReceiverInterface>>,
|
||||
GetReceivers)
|
||||
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>,
|
||||
GetTransceivers)
|
||||
PROXY_METHOD3(bool,
|
||||
GetStats,
|
||||
StatsObserver*,
|
||||
MediaStreamTrackInterface*,
|
||||
StatsOutputLevel)
|
||||
PROXY_METHOD1(void, GetStats, RTCStatsCollectorCallback*)
|
||||
PROXY_METHOD2(void,
|
||||
GetStats,
|
||||
rtc::scoped_refptr<RtpSenderInterface>,
|
||||
rtc::scoped_refptr<RTCStatsCollectorCallback>);
|
||||
PROXY_METHOD2(void,
|
||||
GetStats,
|
||||
rtc::scoped_refptr<RtpReceiverInterface>,
|
||||
rtc::scoped_refptr<RTCStatsCollectorCallback>);
|
||||
PROXY_METHOD2(rtc::scoped_refptr<DataChannelInterface>,
|
||||
CreateDataChannel,
|
||||
const std::string&,
|
||||
const DataChannelInit*)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, local_description)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, remote_description)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
||||
pending_local_description)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
||||
pending_remote_description)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
||||
current_local_description)
|
||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
||||
current_remote_description)
|
||||
PROXY_METHOD2(void,
|
||||
CreateOffer,
|
||||
CreateSessionDescriptionObserver*,
|
||||
const MediaConstraintsInterface*)
|
||||
PROXY_METHOD2(void,
|
||||
CreateAnswer,
|
||||
CreateSessionDescriptionObserver*,
|
||||
const MediaConstraintsInterface*)
|
||||
PROXY_METHOD2(void,
|
||||
CreateOffer,
|
||||
CreateSessionDescriptionObserver*,
|
||||
const RTCOfferAnswerOptions&)
|
||||
PROXY_METHOD2(void,
|
||||
CreateAnswer,
|
||||
CreateSessionDescriptionObserver*,
|
||||
const RTCOfferAnswerOptions&)
|
||||
PROXY_METHOD2(void,
|
||||
SetLocalDescription,
|
||||
SetSessionDescriptionObserver*,
|
||||
SessionDescriptionInterface*)
|
||||
PROXY_METHOD2(void,
|
||||
SetRemoteDescription,
|
||||
SetSessionDescriptionObserver*,
|
||||
SessionDescriptionInterface*)
|
||||
PROXY_METHOD2(void,
|
||||
SetRemoteDescription,
|
||||
std::unique_ptr<SessionDescriptionInterface>,
|
||||
rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>);
|
||||
PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration);
|
||||
PROXY_METHOD2(bool,
|
||||
SetConfiguration,
|
||||
const PeerConnectionInterface::RTCConfiguration&,
|
||||
RTCError*);
|
||||
PROXY_METHOD1(bool,
|
||||
SetConfiguration,
|
||||
const PeerConnectionInterface::RTCConfiguration&);
|
||||
PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*)
|
||||
PROXY_METHOD1(bool,
|
||||
RemoveIceCandidates,
|
||||
const std::vector<cricket::Candidate>&);
|
||||
PROXY_METHOD1(void, SetAudioPlayout, bool)
|
||||
PROXY_METHOD1(void, SetAudioRecording, bool)
|
||||
PROXY_METHOD1(void, RegisterUMAObserver, UMAObserver*)
|
||||
PROXY_METHOD1(RTCError, SetBitrate, const BitrateSettings&);
|
||||
PROXY_METHOD1(void,
|
||||
SetBitrateAllocationStrategy,
|
||||
std::unique_ptr<rtc::BitrateAllocationStrategy>);
|
||||
PROXY_METHOD0(SignalingState, signaling_state)
|
||||
PROXY_METHOD0(IceConnectionState, ice_connection_state)
|
||||
PROXY_METHOD0(IceGatheringState, ice_gathering_state)
|
||||
PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t)
|
||||
PROXY_METHOD2(bool,
|
||||
StartRtcEventLog,
|
||||
std::unique_ptr<RtcEventLogOutput>,
|
||||
int64_t);
|
||||
PROXY_METHOD0(void, StopRtcEventLog)
|
||||
PROXY_METHOD0(void, Close)
|
||||
END_PROXY_MAP()
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
86
api/proxy.h
86
api/proxy.h
@ -64,8 +64,10 @@ namespace webrtc {
|
||||
template <typename R>
|
||||
class ReturnType {
|
||||
public:
|
||||
template<typename C, typename M>
|
||||
void Invoke(C* c, M m) { r_ = (c->*m)(); }
|
||||
template <typename C, typename M>
|
||||
void Invoke(C* c, M m) {
|
||||
r_ = (c->*m)();
|
||||
}
|
||||
template <typename C, typename M, typename T1>
|
||||
void Invoke(C* c, M m, T1 a1) {
|
||||
r_ = (c->*m)(std::move(a1));
|
||||
@ -78,13 +80,22 @@ class ReturnType {
|
||||
void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3) {
|
||||
r_ = (c->*m)(std::move(a1), std::move(a2), std::move(a3));
|
||||
}
|
||||
template<typename C, typename M, typename T1, typename T2, typename T3,
|
||||
typename T4>
|
||||
template <typename C,
|
||||
typename M,
|
||||
typename T1,
|
||||
typename T2,
|
||||
typename T3,
|
||||
typename T4>
|
||||
void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3, T4 a4) {
|
||||
r_ = (c->*m)(std::move(a1), std::move(a2), std::move(a3), std::move(a4));
|
||||
}
|
||||
template<typename C, typename M, typename T1, typename T2, typename T3,
|
||||
typename T4, typename T5>
|
||||
template <typename C,
|
||||
typename M,
|
||||
typename T1,
|
||||
typename T2,
|
||||
typename T3,
|
||||
typename T4,
|
||||
typename T5>
|
||||
void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {
|
||||
r_ = (c->*m)(std::move(a1), std::move(a2), std::move(a3), std::move(a4),
|
||||
std::move(a5));
|
||||
@ -99,8 +110,10 @@ class ReturnType {
|
||||
template <>
|
||||
class ReturnType<void> {
|
||||
public:
|
||||
template<typename C, typename M>
|
||||
void Invoke(C* c, M m) { (c->*m)(); }
|
||||
template <typename C, typename M>
|
||||
void Invoke(C* c, M m) {
|
||||
(c->*m)();
|
||||
}
|
||||
template <typename C, typename M, typename T1>
|
||||
void Invoke(C* c, M m, T1 a1) {
|
||||
(c->*m)(std::move(a1));
|
||||
@ -119,9 +132,8 @@ class ReturnType<void> {
|
||||
|
||||
namespace internal {
|
||||
|
||||
class SynchronousMethodCall
|
||||
: public rtc::MessageData,
|
||||
public rtc::MessageHandler {
|
||||
class SynchronousMethodCall : public rtc::MessageData,
|
||||
public rtc::MessageHandler {
|
||||
public:
|
||||
explicit SynchronousMethodCall(rtc::MessageHandler* proxy);
|
||||
~SynchronousMethodCall() override;
|
||||
@ -138,8 +150,7 @@ class SynchronousMethodCall
|
||||
} // namespace internal
|
||||
|
||||
template <typename C, typename R>
|
||||
class MethodCall0 : public rtc::Message,
|
||||
public rtc::MessageHandler {
|
||||
class MethodCall0 : public rtc::Message, public rtc::MessageHandler {
|
||||
public:
|
||||
typedef R (C::*Method)();
|
||||
MethodCall0(C* c, Method m) : c_(c), m_(m) {}
|
||||
@ -150,7 +161,7 @@ class MethodCall0 : public rtc::Message,
|
||||
}
|
||||
|
||||
private:
|
||||
void OnMessage(rtc::Message*) { r_.Invoke(c_, m_); }
|
||||
void OnMessage(rtc::Message*) { r_.Invoke(c_, m_); }
|
||||
|
||||
C* c_;
|
||||
Method m_;
|
||||
@ -158,8 +169,7 @@ class MethodCall0 : public rtc::Message,
|
||||
};
|
||||
|
||||
template <typename C, typename R>
|
||||
class ConstMethodCall0 : public rtc::Message,
|
||||
public rtc::MessageHandler {
|
||||
class ConstMethodCall0 : public rtc::Message, public rtc::MessageHandler {
|
||||
public:
|
||||
typedef R (C::*Method)() const;
|
||||
ConstMethodCall0(C* c, Method m) : c_(c), m_(m) {}
|
||||
@ -177,9 +187,8 @@ class ConstMethodCall0 : public rtc::Message,
|
||||
ReturnType<R> r_;
|
||||
};
|
||||
|
||||
template <typename C, typename R, typename T1>
|
||||
class MethodCall1 : public rtc::Message,
|
||||
public rtc::MessageHandler {
|
||||
template <typename C, typename R, typename T1>
|
||||
class MethodCall1 : public rtc::Message, public rtc::MessageHandler {
|
||||
public:
|
||||
typedef R (C::*Method)(T1 a1);
|
||||
MethodCall1(C* c, Method m, T1 a1) : c_(c), m_(m), a1_(std::move(a1)) {}
|
||||
@ -198,9 +207,8 @@ class MethodCall1 : public rtc::Message,
|
||||
T1 a1_;
|
||||
};
|
||||
|
||||
template <typename C, typename R, typename T1>
|
||||
class ConstMethodCall1 : public rtc::Message,
|
||||
public rtc::MessageHandler {
|
||||
template <typename C, typename R, typename T1>
|
||||
class ConstMethodCall1 : public rtc::Message, public rtc::MessageHandler {
|
||||
public:
|
||||
typedef R (C::*Method)(T1 a1) const;
|
||||
ConstMethodCall1(C* c, Method m, T1 a1) : c_(c), m_(m), a1_(std::move(a1)) {}
|
||||
@ -220,8 +228,7 @@ class ConstMethodCall1 : public rtc::Message,
|
||||
};
|
||||
|
||||
template <typename C, typename R, typename T1, typename T2>
|
||||
class MethodCall2 : public rtc::Message,
|
||||
public rtc::MessageHandler {
|
||||
class MethodCall2 : public rtc::Message, public rtc::MessageHandler {
|
||||
public:
|
||||
typedef R (C::*Method)(T1 a1, T2 a2);
|
||||
MethodCall2(C* c, Method m, T1 a1, T2 a2)
|
||||
@ -245,8 +252,7 @@ class MethodCall2 : public rtc::Message,
|
||||
};
|
||||
|
||||
template <typename C, typename R, typename T1, typename T2, typename T3>
|
||||
class MethodCall3 : public rtc::Message,
|
||||
public rtc::MessageHandler {
|
||||
class MethodCall3 : public rtc::Message, public rtc::MessageHandler {
|
||||
public:
|
||||
typedef R (C::*Method)(T1 a1, T2 a2, T3 a3);
|
||||
MethodCall3(C* c, Method m, T1 a1, T2 a2, T3 a3)
|
||||
@ -274,10 +280,13 @@ class MethodCall3 : public rtc::Message,
|
||||
T3 a3_;
|
||||
};
|
||||
|
||||
template <typename C, typename R, typename T1, typename T2, typename T3,
|
||||
typename T4>
|
||||
class MethodCall4 : public rtc::Message,
|
||||
public rtc::MessageHandler {
|
||||
template <typename C,
|
||||
typename R,
|
||||
typename T1,
|
||||
typename T2,
|
||||
typename T3,
|
||||
typename T4>
|
||||
class MethodCall4 : public rtc::Message, public rtc::MessageHandler {
|
||||
public:
|
||||
typedef R (C::*Method)(T1 a1, T2 a2, T3 a3, T4 a4);
|
||||
MethodCall4(C* c, Method m, T1 a1, T2 a2, T3 a3, T4 a4)
|
||||
@ -308,10 +317,14 @@ class MethodCall4 : public rtc::Message,
|
||||
T4 a4_;
|
||||
};
|
||||
|
||||
template <typename C, typename R, typename T1, typename T2, typename T3,
|
||||
typename T4, typename T5>
|
||||
class MethodCall5 : public rtc::Message,
|
||||
public rtc::MessageHandler {
|
||||
template <typename C,
|
||||
typename R,
|
||||
typename T1,
|
||||
typename T2,
|
||||
typename T3,
|
||||
typename T4,
|
||||
typename T5>
|
||||
class MethodCall5 : public rtc::Message, public rtc::MessageHandler {
|
||||
public:
|
||||
typedef R (C::*Method)(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
|
||||
MethodCall5(C* c, Method m, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
|
||||
@ -344,7 +357,6 @@ class MethodCall5 : public rtc::Message,
|
||||
T5 a5_;
|
||||
};
|
||||
|
||||
|
||||
// Helper macros to reduce code duplication.
|
||||
#define PROXY_MAP_BOILERPLATE(c) \
|
||||
template <class INTERNAL_CLASS> \
|
||||
@ -359,8 +371,12 @@ class MethodCall5 : public rtc::Message,
|
||||
const INTERNAL_CLASS* internal() const { return c_; } \
|
||||
INTERNAL_CLASS* internal() { return c_; }
|
||||
|
||||
// clang-format off
|
||||
// clang-format would put the semicolon alone,
|
||||
// leading to a presubmit error (cpplint.py)
|
||||
#define END_PROXY_MAP() \
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
#define SIGNALING_PROXY_MAP_BOILERPLATE(c) \
|
||||
protected: \
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
#include "api/video/video_rotation.h"
|
||||
#include "api/video/video_timing.h"
|
||||
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/deprecation.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "typedefs.h" // NOLINT(build/include)
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -128,17 +128,17 @@ class RtpReceiverInterface : public rtc::RefCountInterface {
|
||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||
// are called on is an implementation detail.
|
||||
BEGIN_SIGNALING_PROXY_MAP(RtpReceiver)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
|
||||
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<MediaStreamInterface>>,
|
||||
streams)
|
||||
PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
||||
PROXY_CONSTMETHOD0(std::string, id)
|
||||
PROXY_CONSTMETHOD0(RtpParameters, GetParameters);
|
||||
PROXY_METHOD1(bool, SetParameters, const RtpParameters&)
|
||||
PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*);
|
||||
PROXY_CONSTMETHOD0(std::vector<RtpSource>, GetSources);
|
||||
END_PROXY_MAP()
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
|
||||
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<MediaStreamInterface>>,
|
||||
streams)
|
||||
PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
||||
PROXY_CONSTMETHOD0(std::string, id)
|
||||
PROXY_CONSTMETHOD0(RtpParameters, GetParameters);
|
||||
PROXY_METHOD1(bool, SetParameters, const RtpParameters&)
|
||||
PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*);
|
||||
PROXY_CONSTMETHOD0(std::vector<RtpSource>, GetSources);
|
||||
END_PROXY_MAP()
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -70,17 +70,17 @@ class RtpSenderInterface : public rtc::RefCountInterface {
|
||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||
// are called on is an implementation detail.
|
||||
BEGIN_SIGNALING_PROXY_MAP(RtpSender)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*)
|
||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
|
||||
PROXY_CONSTMETHOD0(uint32_t, ssrc)
|
||||
PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
||||
PROXY_CONSTMETHOD0(std::string, id)
|
||||
PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
|
||||
PROXY_METHOD0(RtpParameters, GetParameters);
|
||||
PROXY_METHOD1(RTCError, SetParameters, const RtpParameters&)
|
||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtmfSenderInterface>, GetDtmfSender);
|
||||
END_PROXY_MAP()
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*)
|
||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
|
||||
PROXY_CONSTMETHOD0(uint32_t, ssrc)
|
||||
PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
||||
PROXY_CONSTMETHOD0(std::string, id)
|
||||
PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
|
||||
PROXY_METHOD0(RtpParameters, GetParameters);
|
||||
PROXY_METHOD1(RTCError, SetParameters, const RtpParameters&)
|
||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtmfSenderInterface>, GetDtmfSender);
|
||||
END_PROXY_MAP()
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ class RTCStats {
|
||||
|
||||
// Downcasts the stats object to an |RTCStats| subclass |T|. DCHECKs that the
|
||||
// object is of type |T|.
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
const T& cast_to() const {
|
||||
RTC_DCHECK_EQ(type(), T::kType);
|
||||
return static_cast<const T&>(*this);
|
||||
@ -90,8 +90,7 @@ class RTCStats {
|
||||
// shall be reserved in the vector (so that subclasses can allocate a vector
|
||||
// with room for both parent and child members without it having to resize).
|
||||
virtual std::vector<const RTCStatsMemberInterface*>
|
||||
MembersOfThisObjectAndAncestors(
|
||||
size_t additional_capacity) const;
|
||||
MembersOfThisObjectAndAncestors(size_t additional_capacity) const;
|
||||
|
||||
std::string const id_;
|
||||
int64_t timestamp_us_;
|
||||
@ -138,18 +137,18 @@ class RTCStats {
|
||||
// bar("bar") {
|
||||
// }
|
||||
//
|
||||
#define WEBRTC_RTCSTATS_DECL() \
|
||||
public: \
|
||||
static const char kType[]; \
|
||||
\
|
||||
std::unique_ptr<webrtc::RTCStats> copy() const override; \
|
||||
const char* type() const override; \
|
||||
\
|
||||
protected: \
|
||||
std::vector<const webrtc::RTCStatsMemberInterface*> \
|
||||
MembersOfThisObjectAndAncestors( \
|
||||
size_t local_var_additional_capacity) const override; \
|
||||
\
|
||||
#define WEBRTC_RTCSTATS_DECL() \
|
||||
public: \
|
||||
static const char kType[]; \
|
||||
\
|
||||
std::unique_ptr<webrtc::RTCStats> copy() const override; \
|
||||
const char* type() const override; \
|
||||
\
|
||||
protected: \
|
||||
std::vector<const webrtc::RTCStatsMemberInterface*> \
|
||||
MembersOfThisObjectAndAncestors(size_t local_var_additional_capacity) \
|
||||
const override; \
|
||||
\
|
||||
public:
|
||||
|
||||
#define WEBRTC_RTCSTATS_IMPL(this_class, parent_class, type_str, ...) \
|
||||
@ -159,20 +158,17 @@ class RTCStats {
|
||||
return std::unique_ptr<webrtc::RTCStats>(new this_class(*this)); \
|
||||
} \
|
||||
\
|
||||
const char* this_class::type() const { \
|
||||
return this_class::kType; \
|
||||
} \
|
||||
const char* this_class::type() const { return this_class::kType; } \
|
||||
\
|
||||
std::vector<const webrtc::RTCStatsMemberInterface*> \
|
||||
this_class::MembersOfThisObjectAndAncestors( \
|
||||
size_t local_var_additional_capacity) const { \
|
||||
const webrtc::RTCStatsMemberInterface* local_var_members[] = { \
|
||||
__VA_ARGS__ \
|
||||
}; \
|
||||
__VA_ARGS__}; \
|
||||
size_t local_var_members_count = \
|
||||
sizeof(local_var_members) / sizeof(local_var_members[0]); \
|
||||
std::vector<const webrtc::RTCStatsMemberInterface*> local_var_members_vec =\
|
||||
parent_class::MembersOfThisObjectAndAncestors( \
|
||||
std::vector<const webrtc::RTCStatsMemberInterface*> \
|
||||
local_var_members_vec = parent_class::MembersOfThisObjectAndAncestors( \
|
||||
local_var_members_count + local_var_additional_capacity); \
|
||||
RTC_DCHECK_GE( \
|
||||
local_var_members_vec.capacity() - local_var_members_vec.size(), \
|
||||
@ -191,21 +187,21 @@ class RTCStatsMemberInterface {
|
||||
public:
|
||||
// Member value types.
|
||||
enum Type {
|
||||
kBool, // bool
|
||||
kInt32, // int32_t
|
||||
kUint32, // uint32_t
|
||||
kInt64, // int64_t
|
||||
kUint64, // uint64_t
|
||||
kDouble, // double
|
||||
kString, // std::string
|
||||
kBool, // bool
|
||||
kInt32, // int32_t
|
||||
kUint32, // uint32_t
|
||||
kInt64, // int64_t
|
||||
kUint64, // uint64_t
|
||||
kDouble, // double
|
||||
kString, // std::string
|
||||
|
||||
kSequenceBool, // std::vector<bool>
|
||||
kSequenceInt32, // std::vector<int32_t>
|
||||
kSequenceUint32, // std::vector<uint32_t>
|
||||
kSequenceInt64, // std::vector<int64_t>
|
||||
kSequenceUint64, // std::vector<uint64_t>
|
||||
kSequenceDouble, // std::vector<double>
|
||||
kSequenceString, // std::vector<std::string>
|
||||
kSequenceBool, // std::vector<bool>
|
||||
kSequenceInt32, // std::vector<int32_t>
|
||||
kSequenceUint32, // std::vector<uint32_t>
|
||||
kSequenceInt64, // std::vector<int64_t>
|
||||
kSequenceUint64, // std::vector<uint64_t>
|
||||
kSequenceDouble, // std::vector<double>
|
||||
kSequenceString, // std::vector<std::string>
|
||||
};
|
||||
|
||||
virtual ~RTCStatsMemberInterface() {}
|
||||
@ -229,7 +225,7 @@ class RTCStatsMemberInterface {
|
||||
// instead.
|
||||
virtual std::string ValueToJson() const = 0;
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
const T& cast_to() const {
|
||||
RTC_DCHECK_EQ(type(), T::kType);
|
||||
return static_cast<const T&>(*this);
|
||||
@ -247,20 +243,17 @@ class RTCStatsMemberInterface {
|
||||
// specialized in rtcstats.cc, using a different |T| results in a linker error
|
||||
// (undefined reference to |kType|). The supported types are the ones described
|
||||
// by |RTCStatsMemberInterface::Type|.
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
class RTCStatsMember : public RTCStatsMemberInterface {
|
||||
public:
|
||||
static const Type kType;
|
||||
|
||||
explicit RTCStatsMember(const char* name)
|
||||
: RTCStatsMemberInterface(name, false),
|
||||
value_() {}
|
||||
: RTCStatsMemberInterface(name, false), value_() {}
|
||||
RTCStatsMember(const char* name, const T& value)
|
||||
: RTCStatsMemberInterface(name, true),
|
||||
value_(value) {}
|
||||
: RTCStatsMemberInterface(name, true), value_(value) {}
|
||||
RTCStatsMember(const char* name, T&& value)
|
||||
: RTCStatsMemberInterface(name, true),
|
||||
value_(std::move(value)) {}
|
||||
: RTCStatsMemberInterface(name, true), value_(std::move(value)) {}
|
||||
explicit RTCStatsMember(const RTCStatsMember<T>& other)
|
||||
: RTCStatsMemberInterface(other.name_, other.is_defined_),
|
||||
value_(other.value_) {}
|
||||
|
||||
@ -209,8 +209,9 @@ class RTCIceCandidateStats : public RTCStats {
|
||||
RTCStatsMember<bool> deleted; // = false
|
||||
|
||||
protected:
|
||||
RTCIceCandidateStats(
|
||||
const std::string& id, int64_t timestamp_us, bool is_remote);
|
||||
RTCIceCandidateStats(const std::string& id,
|
||||
int64_t timestamp_us,
|
||||
bool is_remote);
|
||||
RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote);
|
||||
};
|
||||
|
||||
@ -258,9 +259,11 @@ class RTCMediaStreamTrackStats final : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
|
||||
RTCMediaStreamTrackStats(const std::string& id, int64_t timestamp_us,
|
||||
RTCMediaStreamTrackStats(const std::string& id,
|
||||
int64_t timestamp_us,
|
||||
const char* kind);
|
||||
RTCMediaStreamTrackStats(std::string&& id, int64_t timestamp_us,
|
||||
RTCMediaStreamTrackStats(std::string&& id,
|
||||
int64_t timestamp_us,
|
||||
const char* kind);
|
||||
RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other);
|
||||
~RTCMediaStreamTrackStats() override;
|
||||
|
||||
@ -76,7 +76,7 @@ class RTCStatsReport : public rtc::RefCountInterface {
|
||||
|
||||
// Gets the subset of stats that are of type |T|, where |T| is any class
|
||||
// descending from |RTCStats|.
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
std::vector<const T*> GetStatsOfType() const {
|
||||
std::vector<const T*> stats_of_type;
|
||||
for (const RTCStats& stats : *this) {
|
||||
|
||||
@ -98,8 +98,7 @@ class TypedIntId : public StatsReport::IdBase {
|
||||
}
|
||||
|
||||
std::string ToString() const override {
|
||||
return std::string(InternalTypeToString(type_)) +
|
||||
kSeparator +
|
||||
return std::string(InternalTypeToString(type_)) + kSeparator +
|
||||
rtc::ToString<int>(id_);
|
||||
}
|
||||
|
||||
@ -109,7 +108,8 @@ class TypedIntId : public StatsReport::IdBase {
|
||||
|
||||
class IdWithDirection : public TypedId {
|
||||
public:
|
||||
IdWithDirection(StatsReport::StatsType type, const std::string& id,
|
||||
IdWithDirection(StatsReport::StatsType type,
|
||||
const std::string& id,
|
||||
StatsReport::Direction direction)
|
||||
: TypedId(type, id), direction_(direction) {}
|
||||
|
||||
@ -132,39 +132,34 @@ class IdWithDirection : public TypedId {
|
||||
class CandidateId : public TypedId {
|
||||
public:
|
||||
CandidateId(bool local, const std::string& id)
|
||||
: TypedId(local ?
|
||||
StatsReport::kStatsReportTypeIceLocalCandidate :
|
||||
StatsReport::kStatsReportTypeIceRemoteCandidate,
|
||||
id) {
|
||||
}
|
||||
: TypedId(local ? StatsReport::kStatsReportTypeIceLocalCandidate
|
||||
: StatsReport::kStatsReportTypeIceRemoteCandidate,
|
||||
id) {}
|
||||
|
||||
std::string ToString() const override {
|
||||
return "Cand-" + id_;
|
||||
}
|
||||
std::string ToString() const override { return "Cand-" + id_; }
|
||||
};
|
||||
|
||||
class ComponentId : public StatsReport::IdBase {
|
||||
public:
|
||||
ComponentId(const std::string& content_name, int component)
|
||||
: ComponentId(StatsReport::kStatsReportTypeComponent, content_name,
|
||||
component) {}
|
||||
: ComponentId(StatsReport::kStatsReportTypeComponent,
|
||||
content_name,
|
||||
component) {}
|
||||
|
||||
bool Equals(const IdBase& other) const override {
|
||||
return IdBase::Equals(other) &&
|
||||
static_cast<const ComponentId&>(other).component_ == component_ &&
|
||||
static_cast<const ComponentId&>(other).content_name_ == content_name_;
|
||||
static_cast<const ComponentId&>(other).component_ == component_ &&
|
||||
static_cast<const ComponentId&>(other).content_name_ ==
|
||||
content_name_;
|
||||
}
|
||||
|
||||
std::string ToString() const override {
|
||||
return ToString("Channel-");
|
||||
}
|
||||
std::string ToString() const override { return ToString("Channel-"); }
|
||||
|
||||
protected:
|
||||
ComponentId(StatsReport::StatsType type, const std::string& content_name,
|
||||
ComponentId(StatsReport::StatsType type,
|
||||
const std::string& content_name,
|
||||
int component)
|
||||
: IdBase(type),
|
||||
content_name_(content_name),
|
||||
component_(component) {}
|
||||
: IdBase(type), content_name_(content_name), component_(component) {}
|
||||
|
||||
std::string ToString(const char* prefix) const {
|
||||
std::string ret(prefix);
|
||||
@ -182,13 +177,14 @@ class ComponentId : public StatsReport::IdBase {
|
||||
class CandidatePairId : public ComponentId {
|
||||
public:
|
||||
CandidatePairId(const std::string& content_name, int component, int index)
|
||||
: ComponentId(StatsReport::kStatsReportTypeCandidatePair, content_name,
|
||||
component),
|
||||
: ComponentId(StatsReport::kStatsReportTypeCandidatePair,
|
||||
content_name,
|
||||
component),
|
||||
index_(index) {}
|
||||
|
||||
bool Equals(const IdBase& other) const override {
|
||||
return ComponentId::Equals(other) &&
|
||||
static_cast<const CandidatePairId&>(other).index_ == index_;
|
||||
static_cast<const CandidatePairId&>(other).index_ == index_;
|
||||
}
|
||||
|
||||
std::string ToString() const override {
|
||||
@ -207,7 +203,9 @@ class CandidatePairId : public ComponentId {
|
||||
StatsReport::IdBase::IdBase(StatsType type) : type_(type) {}
|
||||
StatsReport::IdBase::~IdBase() {}
|
||||
|
||||
StatsReport::StatsType StatsReport::IdBase::type() const { return type_; }
|
||||
StatsReport::StatsType StatsReport::IdBase::type() const {
|
||||
return type_;
|
||||
}
|
||||
|
||||
bool StatsReport::IdBase::Equals(const IdBase& other) const {
|
||||
return other.type_ == type_;
|
||||
@ -316,8 +314,8 @@ bool StatsReport::Value::operator==(const char* value) const {
|
||||
}
|
||||
|
||||
bool StatsReport::Value::operator==(int64_t value) const {
|
||||
return type_ == kInt ? value_.int_ == static_cast<int>(value) :
|
||||
(type_ == kInt64 ? value_.int64_ == value : false);
|
||||
return type_ == kInt ? value_.int_ == static_cast<int>(value)
|
||||
: (type_ == kInt64 ? value_.int64_ == value : false);
|
||||
}
|
||||
|
||||
bool StatsReport::Value::operator==(bool value) const {
|
||||
@ -699,7 +697,9 @@ StatsReport::Id StatsReport::NewTypedIntId(StatsType type, int id) {
|
||||
|
||||
// static
|
||||
StatsReport::Id StatsReport::NewIdWithDirection(
|
||||
StatsType type, const std::string& id, StatsReport::Direction direction) {
|
||||
StatsType type,
|
||||
const std::string& id,
|
||||
StatsReport::Direction direction) {
|
||||
return Id(new RefCountedObject<IdWithDirection>(type, id, direction));
|
||||
}
|
||||
|
||||
@ -709,16 +709,17 @@ StatsReport::Id StatsReport::NewCandidateId(bool local, const std::string& id) {
|
||||
}
|
||||
|
||||
// static
|
||||
StatsReport::Id StatsReport::NewComponentId(
|
||||
const std::string& content_name, int component) {
|
||||
StatsReport::Id StatsReport::NewComponentId(const std::string& content_name,
|
||||
int component) {
|
||||
return Id(new RefCountedObject<ComponentId>(content_name, component));
|
||||
}
|
||||
|
||||
// static
|
||||
StatsReport::Id StatsReport::NewCandidatePairId(
|
||||
const std::string& content_name, int component, int index) {
|
||||
return Id(new RefCountedObject<CandidatePairId>(
|
||||
content_name, component, index));
|
||||
StatsReport::Id StatsReport::NewCandidatePairId(const std::string& content_name,
|
||||
int component,
|
||||
int index) {
|
||||
return Id(
|
||||
new RefCountedObject<CandidatePairId>(content_name, component, index));
|
||||
}
|
||||
|
||||
const char* StatsReport::TypeToString() const {
|
||||
@ -763,8 +764,7 @@ void StatsReport::AddBoolean(StatsReport::StatsValueName name, bool value) {
|
||||
values_[name] = ValuePtr(new Value(name, value));
|
||||
}
|
||||
|
||||
void StatsReport::AddId(StatsReport::StatsValueName name,
|
||||
const Id& value) {
|
||||
void StatsReport::AddId(StatsReport::StatsValueName name, const Id& value) {
|
||||
const Value* found = FindValue(name);
|
||||
if (!found || !(*found == value))
|
||||
values_[name] = ValuePtr(new Value(name, value));
|
||||
@ -775,8 +775,7 @@ const StatsReport::Value* StatsReport::FindValue(StatsValueName name) const {
|
||||
return it == values_.end() ? nullptr : it->second.get();
|
||||
}
|
||||
|
||||
StatsCollection::StatsCollection() {
|
||||
}
|
||||
StatsCollection::StatsCollection() {}
|
||||
|
||||
StatsCollection::~StatsCollection() {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
@ -816,8 +815,9 @@ StatsReport* StatsCollection::FindOrAddNew(const StatsReport::Id& id) {
|
||||
StatsReport* StatsCollection::ReplaceOrAddNew(const StatsReport::Id& id) {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
RTC_DCHECK(id.get());
|
||||
Container::iterator it = std::find_if(list_.begin(), list_.end(),
|
||||
[&id](const StatsReport* r)->bool { return r->id()->Equals(id); });
|
||||
Container::iterator it = std::find_if(
|
||||
list_.begin(), list_.end(),
|
||||
[&id](const StatsReport* r) -> bool { return r->id()->Equals(id); });
|
||||
if (it != end()) {
|
||||
StatsReport* report = new StatsReport((*it)->id());
|
||||
delete *it;
|
||||
@ -831,8 +831,9 @@ StatsReport* StatsCollection::ReplaceOrAddNew(const StatsReport::Id& id) {
|
||||
// will be returned.
|
||||
StatsReport* StatsCollection::Find(const StatsReport::Id& id) {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
Container::iterator it = std::find_if(list_.begin(), list_.end(),
|
||||
[&id](const StatsReport* r)->bool { return r->id()->Equals(id); });
|
||||
Container::iterator it = std::find_if(
|
||||
list_.begin(), list_.end(),
|
||||
[&id](const StatsReport* r) -> bool { return r->id()->Equals(id); });
|
||||
return it == list_.end() ? nullptr : *it;
|
||||
}
|
||||
|
||||
|
||||
@ -369,13 +369,14 @@ class StatsReport {
|
||||
static Id NewBandwidthEstimationId();
|
||||
static Id NewTypedId(StatsType type, const std::string& id);
|
||||
static Id NewTypedIntId(StatsType type, int id);
|
||||
static Id NewIdWithDirection(
|
||||
StatsType type, const std::string& id, Direction direction);
|
||||
static Id NewIdWithDirection(StatsType type,
|
||||
const std::string& id,
|
||||
Direction direction);
|
||||
static Id NewCandidateId(bool local, const std::string& id);
|
||||
static Id NewComponentId(
|
||||
const std::string& content_name, int component);
|
||||
static Id NewCandidatePairId(
|
||||
const std::string& content_name, int component, int index);
|
||||
static Id NewComponentId(const std::string& content_name, int component);
|
||||
static Id NewCandidatePairId(const std::string& content_name,
|
||||
int component,
|
||||
int index);
|
||||
|
||||
const Id& id() const { return id_; }
|
||||
StatsType type() const { return id_->type(); }
|
||||
|
||||
@ -22,13 +22,12 @@ namespace test {
|
||||
|
||||
using Config = VideoCodecTestFixture::Config;
|
||||
|
||||
std::unique_ptr<VideoCodecTestFixture>
|
||||
CreateVideoCodecTestFixture(const Config& config) {
|
||||
std::unique_ptr<VideoCodecTestFixture> CreateVideoCodecTestFixture(
|
||||
const Config& config) {
|
||||
return rtc::MakeUnique<VideoCodecTestFixtureImpl>(config);
|
||||
}
|
||||
|
||||
std::unique_ptr<VideoCodecTestFixture>
|
||||
CreateVideoCodecTestFixture(
|
||||
std::unique_ptr<VideoCodecTestFixture> CreateVideoCodecTestFixture(
|
||||
const Config& config,
|
||||
std::unique_ptr<VideoDecoderFactory> decoder_factory,
|
||||
std::unique_ptr<VideoEncoderFactory> encoder_factory) {
|
||||
|
||||
@ -21,16 +21,12 @@ namespace webrtc {
|
||||
|
||||
class FakeConstraints : public webrtc::MediaConstraintsInterface {
|
||||
public:
|
||||
FakeConstraints() { }
|
||||
virtual ~FakeConstraints() { }
|
||||
FakeConstraints() {}
|
||||
virtual ~FakeConstraints() {}
|
||||
|
||||
virtual const Constraints& GetMandatory() const {
|
||||
return mandatory_;
|
||||
}
|
||||
virtual const Constraints& GetMandatory() const { return mandatory_; }
|
||||
|
||||
virtual const Constraints& GetOptional() const {
|
||||
return optional_;
|
||||
}
|
||||
virtual const Constraints& GetOptional() const { return optional_; }
|
||||
|
||||
template <class T>
|
||||
void AddMandatory(const std::string& key, const T& value) {
|
||||
|
||||
@ -18,7 +18,6 @@ class PortInterface;
|
||||
class StunMessage;
|
||||
} // namespace cricket
|
||||
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class TurnCustomizer {
|
||||
|
||||
@ -13,9 +13,13 @@
|
||||
namespace webrtc {
|
||||
namespace video_coding {
|
||||
|
||||
bool EncodedFrame::delayed_by_retransmission() const { return 0; }
|
||||
bool EncodedFrame::delayed_by_retransmission() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t EncodedFrame::Timestamp() const { return timestamp; }
|
||||
uint32_t EncodedFrame::Timestamp() const {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
} // namespace video_coding
|
||||
} // namespace webrtc
|
||||
|
||||
@ -34,8 +34,7 @@ int I420DataSize(int height, int stride_y, int stride_u, int stride_v) {
|
||||
} // namespace
|
||||
|
||||
I420Buffer::I420Buffer(int width, int height)
|
||||
: I420Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) {
|
||||
}
|
||||
: I420Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) {}
|
||||
|
||||
I420Buffer::I420Buffer(int width,
|
||||
int height,
|
||||
@ -47,9 +46,9 @@ I420Buffer::I420Buffer(int width,
|
||||
stride_y_(stride_y),
|
||||
stride_u_(stride_u),
|
||||
stride_v_(stride_v),
|
||||
data_(static_cast<uint8_t*>(AlignedMalloc(
|
||||
I420DataSize(height, stride_y, stride_u, stride_v),
|
||||
kBufferAlignment))) {
|
||||
data_(static_cast<uint8_t*>(
|
||||
AlignedMalloc(I420DataSize(height, stride_y, stride_u, stride_v),
|
||||
kBufferAlignment))) {
|
||||
RTC_DCHECK_GT(width, 0);
|
||||
RTC_DCHECK_GT(height, 0);
|
||||
RTC_DCHECK_GE(stride_y, width);
|
||||
@ -57,8 +56,7 @@ I420Buffer::I420Buffer(int width,
|
||||
RTC_DCHECK_GE(stride_v, (width + 1) / 2);
|
||||
}
|
||||
|
||||
I420Buffer::~I420Buffer() {
|
||||
}
|
||||
I420Buffer::~I420Buffer() {}
|
||||
|
||||
// static
|
||||
rtc::scoped_refptr<I420Buffer> I420Buffer::Create(int width, int height) {
|
||||
@ -71,34 +69,34 @@ rtc::scoped_refptr<I420Buffer> I420Buffer::Create(int width,
|
||||
int stride_y,
|
||||
int stride_u,
|
||||
int stride_v) {
|
||||
return new rtc::RefCountedObject<I420Buffer>(
|
||||
width, height, stride_y, stride_u, stride_v);
|
||||
return new rtc::RefCountedObject<I420Buffer>(width, height, stride_y,
|
||||
stride_u, stride_v);
|
||||
}
|
||||
|
||||
// static
|
||||
rtc::scoped_refptr<I420Buffer> I420Buffer::Copy(
|
||||
const I420BufferInterface& source) {
|
||||
return Copy(source.width(), source.height(),
|
||||
source.DataY(), source.StrideY(),
|
||||
source.DataU(), source.StrideU(),
|
||||
source.DataV(), source.StrideV());
|
||||
return Copy(source.width(), source.height(), source.DataY(), source.StrideY(),
|
||||
source.DataU(), source.StrideU(), source.DataV(),
|
||||
source.StrideV());
|
||||
}
|
||||
|
||||
// static
|
||||
rtc::scoped_refptr<I420Buffer> I420Buffer::Copy(
|
||||
int width, int height,
|
||||
const uint8_t* data_y, int stride_y,
|
||||
const uint8_t* data_u, int stride_u,
|
||||
const uint8_t* data_v, int stride_v) {
|
||||
rtc::scoped_refptr<I420Buffer> I420Buffer::Copy(int width,
|
||||
int height,
|
||||
const uint8_t* data_y,
|
||||
int stride_y,
|
||||
const uint8_t* data_u,
|
||||
int stride_u,
|
||||
const uint8_t* data_v,
|
||||
int stride_v) {
|
||||
// Note: May use different strides than the input data.
|
||||
rtc::scoped_refptr<I420Buffer> buffer = Create(width, height);
|
||||
RTC_CHECK_EQ(0, libyuv::I420Copy(data_y, stride_y,
|
||||
data_u, stride_u,
|
||||
data_v, stride_v,
|
||||
buffer->MutableDataY(), buffer->StrideY(),
|
||||
buffer->MutableDataU(), buffer->StrideU(),
|
||||
buffer->MutableDataV(), buffer->StrideV(),
|
||||
width, height));
|
||||
RTC_CHECK_EQ(0, libyuv::I420Copy(data_y, stride_y, data_u, stride_u, data_v,
|
||||
stride_v, buffer->MutableDataY(),
|
||||
buffer->StrideY(), buffer->MutableDataU(),
|
||||
buffer->StrideU(), buffer->MutableDataV(),
|
||||
buffer->StrideV(), width, height));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@ -120,14 +118,13 @@ rtc::scoped_refptr<I420Buffer> I420Buffer::Rotate(
|
||||
rtc::scoped_refptr<webrtc::I420Buffer> buffer =
|
||||
I420Buffer::Create(rotated_width, rotated_height);
|
||||
|
||||
RTC_CHECK_EQ(0, libyuv::I420Rotate(
|
||||
src.DataY(), src.StrideY(),
|
||||
src.DataU(), src.StrideU(),
|
||||
src.DataV(), src.StrideV(),
|
||||
buffer->MutableDataY(), buffer->StrideY(), buffer->MutableDataU(),
|
||||
buffer->StrideU(), buffer->MutableDataV(), buffer->StrideV(),
|
||||
src.width(), src.height(),
|
||||
static_cast<libyuv::RotationMode>(rotation)));
|
||||
RTC_CHECK_EQ(0,
|
||||
libyuv::I420Rotate(
|
||||
src.DataY(), src.StrideY(), src.DataU(), src.StrideU(),
|
||||
src.DataV(), src.StrideV(), buffer->MutableDataY(),
|
||||
buffer->StrideY(), buffer->MutableDataU(), buffer->StrideU(),
|
||||
buffer->MutableDataV(), buffer->StrideV(), src.width(),
|
||||
src.height(), static_cast<libyuv::RotationMode>(rotation)));
|
||||
|
||||
return buffer;
|
||||
}
|
||||
@ -179,9 +176,9 @@ uint8_t* I420Buffer::MutableDataV() {
|
||||
void I420Buffer::SetBlack(I420Buffer* buffer) {
|
||||
RTC_CHECK(libyuv::I420Rect(buffer->MutableDataY(), buffer->StrideY(),
|
||||
buffer->MutableDataU(), buffer->StrideU(),
|
||||
buffer->MutableDataV(), buffer->StrideV(),
|
||||
0, 0, buffer->width(), buffer->height(),
|
||||
0, 128, 128) == 0);
|
||||
buffer->MutableDataV(), buffer->StrideV(), 0, 0,
|
||||
buffer->width(), buffer->height(), 0, 128,
|
||||
128) == 0);
|
||||
}
|
||||
|
||||
void I420Buffer::CropAndScaleFrom(const I420BufferInterface& src,
|
||||
@ -202,20 +199,16 @@ void I420Buffer::CropAndScaleFrom(const I420BufferInterface& src,
|
||||
offset_x = uv_offset_x * 2;
|
||||
offset_y = uv_offset_y * 2;
|
||||
|
||||
const uint8_t* y_plane =
|
||||
src.DataY() + src.StrideY() * offset_y + offset_x;
|
||||
const uint8_t* y_plane = src.DataY() + src.StrideY() * offset_y + offset_x;
|
||||
const uint8_t* u_plane =
|
||||
src.DataU() + src.StrideU() * uv_offset_y + uv_offset_x;
|
||||
const uint8_t* v_plane =
|
||||
src.DataV() + src.StrideV() * uv_offset_y + uv_offset_x;
|
||||
int res = libyuv::I420Scale(y_plane, src.StrideY(),
|
||||
u_plane, src.StrideU(),
|
||||
v_plane, src.StrideV(),
|
||||
crop_width, crop_height,
|
||||
MutableDataY(), StrideY(),
|
||||
MutableDataU(), StrideU(),
|
||||
MutableDataV(), StrideV(),
|
||||
width(), height(), libyuv::kFilterBox);
|
||||
int res =
|
||||
libyuv::I420Scale(y_plane, src.StrideY(), u_plane, src.StrideU(), v_plane,
|
||||
src.StrideV(), crop_width, crop_height, MutableDataY(),
|
||||
StrideY(), MutableDataU(), StrideU(), MutableDataV(),
|
||||
StrideV(), width(), height(), libyuv::kFilterBox);
|
||||
|
||||
RTC_DCHECK_EQ(res, 0);
|
||||
}
|
||||
@ -226,10 +219,8 @@ void I420Buffer::CropAndScaleFrom(const I420BufferInterface& src) {
|
||||
const int crop_height =
|
||||
std::min(src.height(), height() * src.width() / width());
|
||||
|
||||
CropAndScaleFrom(
|
||||
src,
|
||||
(src.width() - crop_width) / 2, (src.height() - crop_height) / 2,
|
||||
crop_width, crop_height);
|
||||
CropAndScaleFrom(src, (src.width() - crop_width) / 2,
|
||||
(src.height() - crop_height) / 2, crop_width, crop_height);
|
||||
}
|
||||
|
||||
void I420Buffer::ScaleFrom(const I420BufferInterface& src) {
|
||||
|
||||
@ -36,11 +36,14 @@ class I420Buffer : public I420BufferInterface {
|
||||
return Copy(*buffer.GetI420());
|
||||
}
|
||||
|
||||
static rtc::scoped_refptr<I420Buffer> Copy(
|
||||
int width, int height,
|
||||
const uint8_t* data_y, int stride_y,
|
||||
const uint8_t* data_u, int stride_u,
|
||||
const uint8_t* data_v, int stride_v);
|
||||
static rtc::scoped_refptr<I420Buffer> Copy(int width,
|
||||
int height,
|
||||
const uint8_t* data_y,
|
||||
int stride_y,
|
||||
const uint8_t* data_u,
|
||||
int stride_u,
|
||||
const uint8_t* data_v,
|
||||
int stride_v);
|
||||
|
||||
// Returns a rotated copy of |src|.
|
||||
static rtc::scoped_refptr<I420Buffer> Rotate(const I420BufferInterface& src,
|
||||
|
||||
@ -68,19 +68,16 @@ bool SetSimulcastId(VideoContentType* content_type, uint8_t simulcast_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t GetExperimentId(
|
||||
const VideoContentType& content_type) {
|
||||
uint8_t GetExperimentId(const VideoContentType& content_type) {
|
||||
return (static_cast<uint8_t>(content_type) & kExperimentBitsMask) >>
|
||||
kExperimentShift;
|
||||
}
|
||||
uint8_t GetSimulcastId(
|
||||
const VideoContentType& content_type) {
|
||||
uint8_t GetSimulcastId(const VideoContentType& content_type) {
|
||||
return (static_cast<uint8_t>(content_type) & kSimulcastBitsMask) >>
|
||||
kSimulcastShift;
|
||||
}
|
||||
|
||||
bool IsScreenshare(
|
||||
const VideoContentType& content_type) {
|
||||
bool IsScreenshare(const VideoContentType& content_type) {
|
||||
return (static_cast<uint8_t>(content_type) & kScreenshareBitsMask) > 0;
|
||||
}
|
||||
|
||||
|
||||
@ -13,8 +13,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "api/video/video_rotation.h"
|
||||
#include "api/video/video_frame_buffer.h"
|
||||
#include "api/video/video_rotation.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
||||
@ -46,21 +46,18 @@ bool VideoCodecVP9::operator==(const VideoCodecVP9& other) const {
|
||||
bool VideoCodecH264::operator==(const VideoCodecH264& other) const {
|
||||
return (frameDroppingOn == other.frameDroppingOn &&
|
||||
keyFrameInterval == other.keyFrameInterval &&
|
||||
spsLen == other.spsLen &&
|
||||
ppsLen == other.ppsLen &&
|
||||
spsLen == other.spsLen && ppsLen == other.ppsLen &&
|
||||
profile == other.profile &&
|
||||
(spsLen == 0 || memcmp(spsData, other.spsData, spsLen) == 0) &&
|
||||
(ppsLen == 0 || memcmp(ppsData, other.ppsData, ppsLen) == 0));
|
||||
}
|
||||
|
||||
bool SpatialLayer::operator==(const SpatialLayer& other) const {
|
||||
return (width == other.width &&
|
||||
height == other.height &&
|
||||
return (width == other.width && height == other.height &&
|
||||
numberOfTemporalLayers == other.numberOfTemporalLayers &&
|
||||
maxBitrate == other.maxBitrate &&
|
||||
targetBitrate == other.targetBitrate &&
|
||||
minBitrate == other.minBitrate &&
|
||||
qpMax == other.qpMax &&
|
||||
minBitrate == other.minBitrate && qpMax == other.qpMax &&
|
||||
active == other.active);
|
||||
}
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
#ifndef API_VIDEOSOURCEPROXY_H_
|
||||
#define API_VIDEOSOURCEPROXY_H_
|
||||
|
||||
#include "api/proxy.h"
|
||||
#include "api/mediastreaminterface.h"
|
||||
#include "api/proxy.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -21,19 +21,19 @@ namespace webrtc {
|
||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||
// are called on is an implementation detail.
|
||||
BEGIN_PROXY_MAP(VideoTrackSource)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_CONSTMETHOD0(SourceState, state)
|
||||
PROXY_CONSTMETHOD0(bool, remote)
|
||||
PROXY_CONSTMETHOD0(bool, is_screencast)
|
||||
PROXY_CONSTMETHOD0(rtc::Optional<bool>, needs_denoising)
|
||||
PROXY_METHOD1(bool, GetStats, Stats*)
|
||||
PROXY_WORKER_METHOD2(void,
|
||||
AddOrUpdateSink,
|
||||
rtc::VideoSinkInterface<VideoFrame>*,
|
||||
const rtc::VideoSinkWants&)
|
||||
PROXY_WORKER_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
|
||||
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
||||
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||
PROXY_CONSTMETHOD0(SourceState, state)
|
||||
PROXY_CONSTMETHOD0(bool, remote)
|
||||
PROXY_CONSTMETHOD0(bool, is_screencast)
|
||||
PROXY_CONSTMETHOD0(rtc::Optional<bool>, needs_denoising)
|
||||
PROXY_METHOD1(bool, GetStats, Stats*)
|
||||
PROXY_WORKER_METHOD2(void,
|
||||
AddOrUpdateSink,
|
||||
rtc::VideoSinkInterface<VideoFrame>*,
|
||||
const rtc::VideoSinkWants&)
|
||||
PROXY_WORKER_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
|
||||
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
||||
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
||||
END_PROXY_MAP()
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user