Enable clang::find_bad_constructs for sdk/android (part 1/2).
This CL removes //build/config/clang:find_bad_constructs from the suppressed_configs list, which means that clang:find_bad_constructs is now enabled on these translation units. Bug: webrtc:9251, webrtc:163, webrtc:9544 Change-Id: I7c211c4ac6b2e095e4c6594fce09fdb487bb1d9e Reviewed-on: https://webrtc-review.googlesource.com/89600 Reviewed-by: Steve Anton <steveanton@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24056}
This commit is contained in:

committed by
Commit Bot

parent
97ddbd7eba
commit
2ffed6d65c
@ -57,6 +57,7 @@ rtc_static_library("libjingle_peerconnection_api") {
|
|||||||
"dtmfsenderinterface.h",
|
"dtmfsenderinterface.h",
|
||||||
"jsep.cc",
|
"jsep.cc",
|
||||||
"jsep.h",
|
"jsep.h",
|
||||||
|
"jsepicecandidate.cc",
|
||||||
"jsepicecandidate.h",
|
"jsepicecandidate.h",
|
||||||
"jsepsessiondescription.h",
|
"jsepsessiondescription.h",
|
||||||
"mediaconstraintsinterface.cc",
|
"mediaconstraintsinterface.cc",
|
||||||
|
83
api/jsepicecandidate.cc
Normal file
83
api/jsepicecandidate.cc
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license
|
||||||
|
* that can be found in the LICENSE file in the root of the source
|
||||||
|
* tree. An additional intellectual property rights grant can be found
|
||||||
|
* in the file PATENTS. All contributing project authors may
|
||||||
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "api/jsepicecandidate.h"
|
||||||
|
|
||||||
|
namespace webrtc {
|
||||||
|
|
||||||
|
std::string JsepIceCandidate::sdp_mid() const {
|
||||||
|
return sdp_mid_;
|
||||||
|
}
|
||||||
|
|
||||||
|
int JsepIceCandidate::sdp_mline_index() const {
|
||||||
|
return sdp_mline_index_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cricket::Candidate& JsepIceCandidate::candidate() const {
|
||||||
|
return candidate_;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string JsepIceCandidate::server_url() const {
|
||||||
|
return candidate_.url();
|
||||||
|
}
|
||||||
|
|
||||||
|
JsepCandidateCollection::JsepCandidateCollection() = default;
|
||||||
|
|
||||||
|
JsepCandidateCollection::JsepCandidateCollection(JsepCandidateCollection&& o)
|
||||||
|
: candidates_(std::move(o.candidates_)) {}
|
||||||
|
|
||||||
|
size_t JsepCandidateCollection::count() const {
|
||||||
|
return candidates_.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void JsepCandidateCollection::add(JsepIceCandidate* candidate) {
|
||||||
|
candidates_.push_back(candidate);
|
||||||
|
}
|
||||||
|
|
||||||
|
const IceCandidateInterface* JsepCandidateCollection::at(size_t index) const {
|
||||||
|
return candidates_[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
JsepCandidateCollection::~JsepCandidateCollection() {
|
||||||
|
for (std::vector<JsepIceCandidate*>::iterator it = candidates_.begin();
|
||||||
|
it != candidates_.end(); ++it) {
|
||||||
|
delete *it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JsepCandidateCollection::HasCandidate(
|
||||||
|
const IceCandidateInterface* candidate) const {
|
||||||
|
bool ret = false;
|
||||||
|
for (std::vector<JsepIceCandidate*>::const_iterator it = candidates_.begin();
|
||||||
|
it != candidates_.end(); ++it) {
|
||||||
|
if ((*it)->sdp_mid() == candidate->sdp_mid() &&
|
||||||
|
(*it)->sdp_mline_index() == candidate->sdp_mline_index() &&
|
||||||
|
(*it)->candidate().IsEquivalent(candidate->candidate())) {
|
||||||
|
ret = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t JsepCandidateCollection::remove(const cricket::Candidate& candidate) {
|
||||||
|
auto iter = std::find_if(candidates_.begin(), candidates_.end(),
|
||||||
|
[candidate](JsepIceCandidate* c) {
|
||||||
|
return candidate.MatchesForRemoval(c->candidate());
|
||||||
|
});
|
||||||
|
if (iter != candidates_.end()) {
|
||||||
|
delete *iter;
|
||||||
|
candidates_.erase(iter);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace webrtc
|
@ -31,20 +31,20 @@ class JsepIceCandidate : public IceCandidateInterface {
|
|||||||
JsepIceCandidate(const std::string& sdp_mid,
|
JsepIceCandidate(const std::string& sdp_mid,
|
||||||
int sdp_mline_index,
|
int sdp_mline_index,
|
||||||
const cricket::Candidate& candidate);
|
const cricket::Candidate& candidate);
|
||||||
~JsepIceCandidate();
|
~JsepIceCandidate() override;
|
||||||
// |err| may be null.
|
// |err| may be null.
|
||||||
bool Initialize(const std::string& sdp, SdpParseError* err);
|
bool Initialize(const std::string& sdp, SdpParseError* err);
|
||||||
void SetCandidate(const cricket::Candidate& candidate) {
|
void SetCandidate(const cricket::Candidate& candidate) {
|
||||||
candidate_ = candidate;
|
candidate_ = candidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string sdp_mid() const { return sdp_mid_; }
|
std::string sdp_mid() const override;
|
||||||
virtual int sdp_mline_index() const { return sdp_mline_index_; }
|
int sdp_mline_index() const override;
|
||||||
virtual const cricket::Candidate& candidate() const { return candidate_; }
|
const cricket::Candidate& candidate() const override;
|
||||||
|
|
||||||
virtual std::string server_url() const { return candidate_.url(); }
|
std::string server_url() const override;
|
||||||
|
|
||||||
virtual bool ToString(std::string* out) const;
|
bool ToString(std::string* out) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string sdp_mid_;
|
std::string sdp_mid_;
|
||||||
@ -57,23 +57,18 @@ class JsepIceCandidate : public IceCandidateInterface {
|
|||||||
// Implementation of IceCandidateCollection which stores JsepIceCandidates.
|
// Implementation of IceCandidateCollection which stores JsepIceCandidates.
|
||||||
class JsepCandidateCollection : public IceCandidateCollection {
|
class JsepCandidateCollection : public IceCandidateCollection {
|
||||||
public:
|
public:
|
||||||
JsepCandidateCollection() {}
|
JsepCandidateCollection();
|
||||||
// Move constructor is defined so that a vector of JsepCandidateCollections
|
// Move constructor is defined so that a vector of JsepCandidateCollections
|
||||||
// can be resized.
|
// can be resized.
|
||||||
JsepCandidateCollection(JsepCandidateCollection&& o)
|
JsepCandidateCollection(JsepCandidateCollection&& o);
|
||||||
: candidates_(std::move(o.candidates_)) {}
|
~JsepCandidateCollection() override;
|
||||||
~JsepCandidateCollection();
|
size_t count() const override;
|
||||||
virtual size_t count() const { return candidates_.size(); }
|
bool HasCandidate(const IceCandidateInterface* candidate) const override;
|
||||||
virtual bool HasCandidate(const IceCandidateInterface* candidate) const;
|
|
||||||
// Adds and takes ownership of the JsepIceCandidate.
|
// Adds and takes ownership of the JsepIceCandidate.
|
||||||
// TODO(deadbeef): Make this use an std::unique_ptr<>, so ownership logic is
|
// TODO(deadbeef): Make this use an std::unique_ptr<>, so ownership logic is
|
||||||
// more clear.
|
// more clear.
|
||||||
virtual void add(JsepIceCandidate* candidate) {
|
virtual void add(JsepIceCandidate* candidate);
|
||||||
candidates_.push_back(candidate);
|
const IceCandidateInterface* at(size_t index) const override;
|
||||||
}
|
|
||||||
virtual const IceCandidateInterface* at(size_t index) const {
|
|
||||||
return candidates_[index];
|
|
||||||
}
|
|
||||||
// Removes the candidate that has a matching address and protocol.
|
// Removes the candidate that has a matching address and protocol.
|
||||||
//
|
//
|
||||||
// Returns the number of candidates that were removed.
|
// Returns the number of candidates that were removed.
|
||||||
|
@ -19,17 +19,18 @@ namespace webrtc {
|
|||||||
|
|
||||||
const double kDefaultBitratePriority = 1.0;
|
const double kDefaultBitratePriority = 1.0;
|
||||||
|
|
||||||
RtcpFeedback::RtcpFeedback() {}
|
RtcpFeedback::RtcpFeedback() = default;
|
||||||
RtcpFeedback::RtcpFeedback(RtcpFeedbackType type) : type(type) {}
|
RtcpFeedback::RtcpFeedback(RtcpFeedbackType type) : type(type) {}
|
||||||
RtcpFeedback::RtcpFeedback(RtcpFeedbackType type,
|
RtcpFeedback::RtcpFeedback(RtcpFeedbackType type,
|
||||||
RtcpFeedbackMessageType message_type)
|
RtcpFeedbackMessageType message_type)
|
||||||
: type(type), message_type(message_type) {}
|
: type(type), message_type(message_type) {}
|
||||||
RtcpFeedback::~RtcpFeedback() {}
|
RtcpFeedback::RtcpFeedback(const RtcpFeedback& rhs) = default;
|
||||||
|
RtcpFeedback::~RtcpFeedback() = default;
|
||||||
|
|
||||||
RtpCodecCapability::RtpCodecCapability() {}
|
RtpCodecCapability::RtpCodecCapability() = default;
|
||||||
RtpCodecCapability::~RtpCodecCapability() {}
|
RtpCodecCapability::~RtpCodecCapability() = default;
|
||||||
|
|
||||||
RtpHeaderExtensionCapability::RtpHeaderExtensionCapability() {}
|
RtpHeaderExtensionCapability::RtpHeaderExtensionCapability() = default;
|
||||||
RtpHeaderExtensionCapability::RtpHeaderExtensionCapability(
|
RtpHeaderExtensionCapability::RtpHeaderExtensionCapability(
|
||||||
const std::string& uri)
|
const std::string& uri)
|
||||||
: uri(uri) {}
|
: uri(uri) {}
|
||||||
@ -37,39 +38,46 @@ RtpHeaderExtensionCapability::RtpHeaderExtensionCapability(
|
|||||||
const std::string& uri,
|
const std::string& uri,
|
||||||
int preferred_id)
|
int preferred_id)
|
||||||
: uri(uri), preferred_id(preferred_id) {}
|
: uri(uri), preferred_id(preferred_id) {}
|
||||||
RtpHeaderExtensionCapability::~RtpHeaderExtensionCapability() {}
|
RtpHeaderExtensionCapability::~RtpHeaderExtensionCapability() = default;
|
||||||
|
|
||||||
RtpExtension::RtpExtension() {}
|
RtpExtension::RtpExtension() = default;
|
||||||
RtpExtension::RtpExtension(const std::string& uri, int id) : uri(uri), id(id) {}
|
RtpExtension::RtpExtension(const std::string& uri, int id) : uri(uri), id(id) {}
|
||||||
RtpExtension::RtpExtension(const std::string& uri, int id, bool encrypt)
|
RtpExtension::RtpExtension(const std::string& uri, int id, bool encrypt)
|
||||||
: uri(uri), id(id), encrypt(encrypt) {}
|
: uri(uri), id(id), encrypt(encrypt) {}
|
||||||
RtpExtension::~RtpExtension() {}
|
RtpExtension::~RtpExtension() = default;
|
||||||
|
|
||||||
RtpFecParameters::RtpFecParameters() {}
|
RtpFecParameters::RtpFecParameters() = default;
|
||||||
RtpFecParameters::RtpFecParameters(FecMechanism mechanism)
|
RtpFecParameters::RtpFecParameters(FecMechanism mechanism)
|
||||||
: mechanism(mechanism) {}
|
: mechanism(mechanism) {}
|
||||||
RtpFecParameters::RtpFecParameters(FecMechanism mechanism, uint32_t ssrc)
|
RtpFecParameters::RtpFecParameters(FecMechanism mechanism, uint32_t ssrc)
|
||||||
: ssrc(ssrc), mechanism(mechanism) {}
|
: ssrc(ssrc), mechanism(mechanism) {}
|
||||||
RtpFecParameters::~RtpFecParameters() {}
|
RtpFecParameters::RtpFecParameters(const RtpFecParameters& rhs) = default;
|
||||||
|
RtpFecParameters::~RtpFecParameters() = default;
|
||||||
|
|
||||||
RtpRtxParameters::RtpRtxParameters() {}
|
RtpRtxParameters::RtpRtxParameters() = default;
|
||||||
RtpRtxParameters::RtpRtxParameters(uint32_t ssrc) : ssrc(ssrc) {}
|
RtpRtxParameters::RtpRtxParameters(uint32_t ssrc) : ssrc(ssrc) {}
|
||||||
RtpRtxParameters::~RtpRtxParameters() {}
|
RtpRtxParameters::RtpRtxParameters(const RtpRtxParameters& rhs) = default;
|
||||||
|
RtpRtxParameters::~RtpRtxParameters() = default;
|
||||||
|
|
||||||
RtpEncodingParameters::RtpEncodingParameters() {}
|
RtpEncodingParameters::RtpEncodingParameters() = default;
|
||||||
RtpEncodingParameters::~RtpEncodingParameters() {}
|
RtpEncodingParameters::RtpEncodingParameters(const RtpEncodingParameters& rhs) =
|
||||||
|
default;
|
||||||
|
RtpEncodingParameters::~RtpEncodingParameters() = default;
|
||||||
|
|
||||||
RtpCodecParameters::RtpCodecParameters() {}
|
RtpCodecParameters::RtpCodecParameters() = default;
|
||||||
RtpCodecParameters::~RtpCodecParameters() {}
|
RtpCodecParameters::RtpCodecParameters(const RtpCodecParameters& rhs) = default;
|
||||||
|
RtpCodecParameters::~RtpCodecParameters() = default;
|
||||||
|
|
||||||
RtpCapabilities::RtpCapabilities() {}
|
RtpCapabilities::RtpCapabilities() = default;
|
||||||
RtpCapabilities::~RtpCapabilities() {}
|
RtpCapabilities::~RtpCapabilities() = default;
|
||||||
|
|
||||||
RtcpParameters::RtcpParameters() {}
|
RtcpParameters::RtcpParameters() = default;
|
||||||
RtcpParameters::~RtcpParameters() {}
|
RtcpParameters::RtcpParameters(const RtcpParameters& rhs) = default;
|
||||||
|
RtcpParameters::~RtcpParameters() = default;
|
||||||
|
|
||||||
RtpParameters::RtpParameters() {}
|
RtpParameters::RtpParameters() = default;
|
||||||
RtpParameters::~RtpParameters() {}
|
RtpParameters::RtpParameters(const RtpParameters& rhs) = default;
|
||||||
|
RtpParameters::~RtpParameters() = default;
|
||||||
|
|
||||||
std::string RtpExtension::ToString() const {
|
std::string RtpExtension::ToString() const {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
@ -100,6 +100,7 @@ struct RtcpFeedback {
|
|||||||
RtcpFeedback();
|
RtcpFeedback();
|
||||||
explicit RtcpFeedback(RtcpFeedbackType type);
|
explicit RtcpFeedback(RtcpFeedbackType type);
|
||||||
RtcpFeedback(RtcpFeedbackType type, RtcpFeedbackMessageType message_type);
|
RtcpFeedback(RtcpFeedbackType type, RtcpFeedbackMessageType message_type);
|
||||||
|
RtcpFeedback(const RtcpFeedback&);
|
||||||
~RtcpFeedback();
|
~RtcpFeedback();
|
||||||
|
|
||||||
bool operator==(const RtcpFeedback& o) const {
|
bool operator==(const RtcpFeedback& o) const {
|
||||||
@ -321,6 +322,7 @@ struct RtpFecParameters {
|
|||||||
RtpFecParameters();
|
RtpFecParameters();
|
||||||
explicit RtpFecParameters(FecMechanism mechanism);
|
explicit RtpFecParameters(FecMechanism mechanism);
|
||||||
RtpFecParameters(FecMechanism mechanism, uint32_t ssrc);
|
RtpFecParameters(FecMechanism mechanism, uint32_t ssrc);
|
||||||
|
RtpFecParameters(const RtpFecParameters&);
|
||||||
~RtpFecParameters();
|
~RtpFecParameters();
|
||||||
|
|
||||||
bool operator==(const RtpFecParameters& o) const {
|
bool operator==(const RtpFecParameters& o) const {
|
||||||
@ -337,6 +339,7 @@ struct RtpRtxParameters {
|
|||||||
// Constructors for convenience.
|
// Constructors for convenience.
|
||||||
RtpRtxParameters();
|
RtpRtxParameters();
|
||||||
explicit RtpRtxParameters(uint32_t ssrc);
|
explicit RtpRtxParameters(uint32_t ssrc);
|
||||||
|
RtpRtxParameters(const RtpRtxParameters&);
|
||||||
~RtpRtxParameters();
|
~RtpRtxParameters();
|
||||||
|
|
||||||
bool operator==(const RtpRtxParameters& o) const { return ssrc == o.ssrc; }
|
bool operator==(const RtpRtxParameters& o) const { return ssrc == o.ssrc; }
|
||||||
@ -345,6 +348,7 @@ struct RtpRtxParameters {
|
|||||||
|
|
||||||
struct RtpEncodingParameters {
|
struct RtpEncodingParameters {
|
||||||
RtpEncodingParameters();
|
RtpEncodingParameters();
|
||||||
|
RtpEncodingParameters(const RtpEncodingParameters&);
|
||||||
~RtpEncodingParameters();
|
~RtpEncodingParameters();
|
||||||
|
|
||||||
// If unset, a value is chosen by the implementation.
|
// If unset, a value is chosen by the implementation.
|
||||||
@ -460,6 +464,7 @@ struct RtpEncodingParameters {
|
|||||||
|
|
||||||
struct RtpCodecParameters {
|
struct RtpCodecParameters {
|
||||||
RtpCodecParameters();
|
RtpCodecParameters();
|
||||||
|
RtpCodecParameters(const RtpCodecParameters&);
|
||||||
~RtpCodecParameters();
|
~RtpCodecParameters();
|
||||||
|
|
||||||
// Build MIME "type/subtype" string from |name| and |kind|.
|
// Build MIME "type/subtype" string from |name| and |kind|.
|
||||||
@ -545,6 +550,7 @@ struct RtpCapabilities {
|
|||||||
|
|
||||||
struct RtcpParameters final {
|
struct RtcpParameters final {
|
||||||
RtcpParameters();
|
RtcpParameters();
|
||||||
|
RtcpParameters(const RtcpParameters&);
|
||||||
~RtcpParameters();
|
~RtcpParameters();
|
||||||
|
|
||||||
// The SSRC to be used in the "SSRC of packet sender" field. If not set, one
|
// The SSRC to be used in the "SSRC of packet sender" field. If not set, one
|
||||||
@ -579,6 +585,7 @@ struct RtcpParameters final {
|
|||||||
|
|
||||||
struct RtpParameters {
|
struct RtpParameters {
|
||||||
RtpParameters();
|
RtpParameters();
|
||||||
|
RtpParameters(const RtpParameters&);
|
||||||
~RtpParameters();
|
~RtpParameters();
|
||||||
|
|
||||||
// Used when calling getParameters/setParameters with a PeerConnection
|
// Used when calling getParameters/setParameters with a PeerConnection
|
||||||
|
@ -14,6 +14,8 @@ namespace webrtc {
|
|||||||
|
|
||||||
RtpTransceiverInit::RtpTransceiverInit() = default;
|
RtpTransceiverInit::RtpTransceiverInit() = default;
|
||||||
|
|
||||||
|
RtpTransceiverInit::RtpTransceiverInit(const RtpTransceiverInit& rhs) = default;
|
||||||
|
|
||||||
RtpTransceiverInit::~RtpTransceiverInit() = default;
|
RtpTransceiverInit::~RtpTransceiverInit() = default;
|
||||||
|
|
||||||
absl::optional<RtpTransceiverDirection>
|
absl::optional<RtpTransceiverDirection>
|
||||||
|
@ -35,6 +35,7 @@ enum class RtpTransceiverDirection {
|
|||||||
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit
|
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit
|
||||||
struct RtpTransceiverInit final {
|
struct RtpTransceiverInit final {
|
||||||
RtpTransceiverInit();
|
RtpTransceiverInit();
|
||||||
|
RtpTransceiverInit(const RtpTransceiverInit&);
|
||||||
~RtpTransceiverInit();
|
~RtpTransceiverInit();
|
||||||
// Direction of the RtpTransceiver. See RtpTransceiverInterface::direction().
|
// Direction of the RtpTransceiver. See RtpTransceiverInterface::direction().
|
||||||
RtpTransceiverDirection direction = RtpTransceiverDirection::kSendRecv;
|
RtpTransceiverDirection direction = RtpTransceiverDirection::kSendRecv;
|
||||||
|
@ -53,39 +53,4 @@ bool JsepIceCandidate::ToString(std::string* out) const {
|
|||||||
return !out->empty();
|
return !out->empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
JsepCandidateCollection::~JsepCandidateCollection() {
|
|
||||||
for (std::vector<JsepIceCandidate*>::iterator it = candidates_.begin();
|
|
||||||
it != candidates_.end(); ++it) {
|
|
||||||
delete *it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JsepCandidateCollection::HasCandidate(
|
|
||||||
const IceCandidateInterface* candidate) const {
|
|
||||||
bool ret = false;
|
|
||||||
for (std::vector<JsepIceCandidate*>::const_iterator it = candidates_.begin();
|
|
||||||
it != candidates_.end(); ++it) {
|
|
||||||
if ((*it)->sdp_mid() == candidate->sdp_mid() &&
|
|
||||||
(*it)->sdp_mline_index() == candidate->sdp_mline_index() &&
|
|
||||||
(*it)->candidate().IsEquivalent(candidate->candidate())) {
|
|
||||||
ret = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t JsepCandidateCollection::remove(const cricket::Candidate& candidate) {
|
|
||||||
auto iter = std::find_if(candidates_.begin(), candidates_.end(),
|
|
||||||
[candidate](JsepIceCandidate* c) {
|
|
||||||
return candidate.MatchesForRemoval(c->candidate());
|
|
||||||
});
|
|
||||||
if (iter != candidates_.end()) {
|
|
||||||
delete *iter;
|
|
||||||
candidates_.erase(iter);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -22,7 +22,7 @@ namespace webrtc {
|
|||||||
class MediaStreamObserver : public ObserverInterface {
|
class MediaStreamObserver : public ObserverInterface {
|
||||||
public:
|
public:
|
||||||
explicit MediaStreamObserver(MediaStreamInterface* stream);
|
explicit MediaStreamObserver(MediaStreamInterface* stream);
|
||||||
~MediaStreamObserver();
|
~MediaStreamObserver() override;
|
||||||
|
|
||||||
const MediaStreamInterface* stream() const { return stream_; }
|
const MediaStreamInterface* stream() const { return stream_; }
|
||||||
|
|
||||||
|
@ -584,11 +584,6 @@ rtc_static_library("peerconnection_jni") {
|
|||||||
"src/jni/pc/turncustomizer.h",
|
"src/jni/pc/turncustomizer.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (is_clang) {
|
|
||||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
|
||||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":base_jni",
|
":base_jni",
|
||||||
":generated_external_classes_jni",
|
":generated_external_classes_jni",
|
||||||
@ -1256,11 +1251,6 @@ rtc_static_library("native_api_peerconnection") {
|
|||||||
"native_api/peerconnection/peerconnectionfactory.h",
|
"native_api/peerconnection/peerconnectionfactory.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (is_clang) {
|
|
||||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
|
||||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":base_jni",
|
":base_jni",
|
||||||
":peerconnection_jni",
|
":peerconnection_jni",
|
||||||
|
@ -29,7 +29,7 @@ namespace {
|
|||||||
class DataChannelObserverJni : public DataChannelObserver {
|
class DataChannelObserverJni : public DataChannelObserver {
|
||||||
public:
|
public:
|
||||||
DataChannelObserverJni(JNIEnv* jni, const JavaRef<jobject>& j_observer);
|
DataChannelObserverJni(JNIEnv* jni, const JavaRef<jobject>& j_observer);
|
||||||
virtual ~DataChannelObserverJni() {}
|
~DataChannelObserverJni() override {}
|
||||||
|
|
||||||
void OnBufferedAmountChange(uint64_t previous_amount) override;
|
void OnBufferedAmountChange(uint64_t previous_amount) override;
|
||||||
void OnStateChange() override;
|
void OnStateChange() override;
|
||||||
|
@ -44,7 +44,7 @@ class MediaConstraintsJni : public MediaConstraintsInterface {
|
|||||||
optional_(PopulateConstraintsFromJavaPairList(
|
optional_(PopulateConstraintsFromJavaPairList(
|
||||||
env,
|
env,
|
||||||
Java_MediaConstraints_getOptional(env, j_constraints))) {}
|
Java_MediaConstraints_getOptional(env, j_constraints))) {}
|
||||||
virtual ~MediaConstraintsJni() = default;
|
~MediaConstraintsJni() override = default;
|
||||||
|
|
||||||
// MediaConstraintsInterface.
|
// MediaConstraintsInterface.
|
||||||
const Constraints& GetMandatory() const override { return mandatory_; }
|
const Constraints& GetMandatory() const override { return mandatory_; }
|
||||||
|
@ -26,7 +26,7 @@ class JavaMediaStream : public sigslot::has_slots<> {
|
|||||||
explicit JavaMediaStream(
|
explicit JavaMediaStream(
|
||||||
JNIEnv* env,
|
JNIEnv* env,
|
||||||
rtc::scoped_refptr<MediaStreamInterface> media_stream);
|
rtc::scoped_refptr<MediaStreamInterface> media_stream);
|
||||||
~JavaMediaStream();
|
~JavaMediaStream() override;
|
||||||
|
|
||||||
const ScopedJavaGlobalRef<jobject>& j_media_stream() {
|
const ScopedJavaGlobalRef<jobject>& j_media_stream() {
|
||||||
return j_media_stream_;
|
return j_media_stream_;
|
||||||
|
@ -20,6 +20,18 @@ PeerConnectionFactoryInterface* factoryFromJava(jlong j_p) {
|
|||||||
return reinterpret_cast<OwnedFactoryAndThreads*>(j_p)->factory();
|
return reinterpret_cast<OwnedFactoryAndThreads*>(j_p)->factory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OwnedFactoryAndThreads::OwnedFactoryAndThreads(
|
||||||
|
std::unique_ptr<Thread> network_thread,
|
||||||
|
std::unique_ptr<Thread> worker_thread,
|
||||||
|
std::unique_ptr<Thread> signaling_thread,
|
||||||
|
rtc::NetworkMonitorFactory* network_monitor_factory,
|
||||||
|
PeerConnectionFactoryInterface* factory)
|
||||||
|
: network_thread_(std::move(network_thread)),
|
||||||
|
worker_thread_(std::move(worker_thread)),
|
||||||
|
signaling_thread_(std::move(signaling_thread)),
|
||||||
|
network_monitor_factory_(network_monitor_factory),
|
||||||
|
factory_(factory) {}
|
||||||
|
|
||||||
OwnedFactoryAndThreads::~OwnedFactoryAndThreads() {
|
OwnedFactoryAndThreads::~OwnedFactoryAndThreads() {
|
||||||
factory_->Release();
|
factory_->Release();
|
||||||
if (network_monitor_factory_ != nullptr) {
|
if (network_monitor_factory_ != nullptr) {
|
||||||
|
@ -37,12 +37,7 @@ class OwnedFactoryAndThreads {
|
|||||||
std::unique_ptr<Thread> worker_thread,
|
std::unique_ptr<Thread> worker_thread,
|
||||||
std::unique_ptr<Thread> signaling_thread,
|
std::unique_ptr<Thread> signaling_thread,
|
||||||
rtc::NetworkMonitorFactory* network_monitor_factory,
|
rtc::NetworkMonitorFactory* network_monitor_factory,
|
||||||
PeerConnectionFactoryInterface* factory)
|
PeerConnectionFactoryInterface* factory);
|
||||||
: network_thread_(std::move(network_thread)),
|
|
||||||
worker_thread_(std::move(worker_thread)),
|
|
||||||
signaling_thread_(std::move(signaling_thread)),
|
|
||||||
network_monitor_factory_(network_monitor_factory),
|
|
||||||
factory_(factory) {}
|
|
||||||
|
|
||||||
~OwnedFactoryAndThreads();
|
~OwnedFactoryAndThreads();
|
||||||
|
|
||||||
|
@ -373,6 +373,13 @@ PeerConnectionObserverJni::NativeToJavaMediaStreamArray(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OwnedPeerConnection::OwnedPeerConnection(
|
||||||
|
rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
|
||||||
|
std::unique_ptr<PeerConnectionObserver> observer)
|
||||||
|
: OwnedPeerConnection(peer_connection,
|
||||||
|
std::move(observer),
|
||||||
|
nullptr /* constraints */) {}
|
||||||
|
|
||||||
OwnedPeerConnection::OwnedPeerConnection(
|
OwnedPeerConnection::OwnedPeerConnection(
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
|
rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
|
||||||
std::unique_ptr<PeerConnectionObserver> observer,
|
std::unique_ptr<PeerConnectionObserver> observer,
|
||||||
|
@ -40,7 +40,7 @@ rtc::KeyType GetRtcConfigKeyType(JNIEnv* env,
|
|||||||
class PeerConnectionObserverJni : public PeerConnectionObserver {
|
class PeerConnectionObserverJni : public PeerConnectionObserver {
|
||||||
public:
|
public:
|
||||||
PeerConnectionObserverJni(JNIEnv* jni, const JavaRef<jobject>& j_observer);
|
PeerConnectionObserverJni(JNIEnv* jni, const JavaRef<jobject>& j_observer);
|
||||||
virtual ~PeerConnectionObserverJni();
|
~PeerConnectionObserverJni() override;
|
||||||
|
|
||||||
// Implementation of PeerConnectionObserver interface, which propagates
|
// Implementation of PeerConnectionObserver interface, which propagates
|
||||||
// the callbacks to the Java observer.
|
// the callbacks to the Java observer.
|
||||||
@ -101,10 +101,7 @@ class OwnedPeerConnection {
|
|||||||
public:
|
public:
|
||||||
OwnedPeerConnection(
|
OwnedPeerConnection(
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
|
rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
|
||||||
std::unique_ptr<PeerConnectionObserver> observer)
|
std::unique_ptr<PeerConnectionObserver> observer);
|
||||||
: OwnedPeerConnection(peer_connection,
|
|
||||||
std::move(observer),
|
|
||||||
nullptr /* constraints */) {}
|
|
||||||
// Deprecated. PC constraints are deprecated.
|
// Deprecated. PC constraints are deprecated.
|
||||||
OwnedPeerConnection(
|
OwnedPeerConnection(
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
|
rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
|
||||||
|
@ -102,7 +102,7 @@ ScopedJavaLocalRef<jobject> MemberToJava(
|
|||||||
ScopedJavaLocalRef<jobject> NativeToJavaRtcStats(JNIEnv* env,
|
ScopedJavaLocalRef<jobject> NativeToJavaRtcStats(JNIEnv* env,
|
||||||
const RTCStats& stats) {
|
const RTCStats& stats) {
|
||||||
JavaMapBuilder builder(env);
|
JavaMapBuilder builder(env);
|
||||||
for (const auto& member : stats.Members()) {
|
for (auto* const member : stats.Members()) {
|
||||||
if (!member->is_defined())
|
if (!member->is_defined())
|
||||||
continue;
|
continue;
|
||||||
builder.put(NativeToJavaString(env, member->name()),
|
builder.put(NativeToJavaString(env, member->name()),
|
||||||
@ -131,6 +131,8 @@ RTCStatsCollectorCallbackWrapper::RTCStatsCollectorCallbackWrapper(
|
|||||||
const JavaRef<jobject>& j_callback)
|
const JavaRef<jobject>& j_callback)
|
||||||
: j_callback_global_(jni, j_callback) {}
|
: j_callback_global_(jni, j_callback) {}
|
||||||
|
|
||||||
|
RTCStatsCollectorCallbackWrapper::~RTCStatsCollectorCallbackWrapper() = default;
|
||||||
|
|
||||||
void RTCStatsCollectorCallbackWrapper::OnStatsDelivered(
|
void RTCStatsCollectorCallbackWrapper::OnStatsDelivered(
|
||||||
const rtc::scoped_refptr<const RTCStatsReport>& report) {
|
const rtc::scoped_refptr<const RTCStatsReport>& report) {
|
||||||
JNIEnv* jni = AttachCurrentThreadIfNeeded();
|
JNIEnv* jni = AttachCurrentThreadIfNeeded();
|
||||||
|
@ -26,6 +26,7 @@ class RTCStatsCollectorCallbackWrapper : public RTCStatsCollectorCallback {
|
|||||||
public:
|
public:
|
||||||
RTCStatsCollectorCallbackWrapper(JNIEnv* jni,
|
RTCStatsCollectorCallbackWrapper(JNIEnv* jni,
|
||||||
const JavaRef<jobject>& j_callback);
|
const JavaRef<jobject>& j_callback);
|
||||||
|
~RTCStatsCollectorCallbackWrapper() override;
|
||||||
|
|
||||||
void OnStatsDelivered(
|
void OnStatsDelivered(
|
||||||
const rtc::scoped_refptr<const RTCStatsReport>& report) override;
|
const rtc::scoped_refptr<const RTCStatsReport>& report) override;
|
||||||
|
@ -27,6 +27,8 @@ CreateSdpObserverJni::CreateSdpObserverJni(
|
|||||||
: j_observer_global_(env, j_observer),
|
: j_observer_global_(env, j_observer),
|
||||||
constraints_(std::move(constraints)) {}
|
constraints_(std::move(constraints)) {}
|
||||||
|
|
||||||
|
CreateSdpObserverJni::~CreateSdpObserverJni() = default;
|
||||||
|
|
||||||
void CreateSdpObserverJni::OnSuccess(SessionDescriptionInterface* desc) {
|
void CreateSdpObserverJni::OnSuccess(SessionDescriptionInterface* desc) {
|
||||||
JNIEnv* env = AttachCurrentThreadIfNeeded();
|
JNIEnv* env = AttachCurrentThreadIfNeeded();
|
||||||
Java_SdpObserver_onCreateSuccess(env, j_observer_global_,
|
Java_SdpObserver_onCreateSuccess(env, j_observer_global_,
|
||||||
@ -49,6 +51,8 @@ SetSdpObserverJni::SetSdpObserverJni(
|
|||||||
: j_observer_global_(env, j_observer),
|
: j_observer_global_(env, j_observer),
|
||||||
constraints_(std::move(constraints)) {}
|
constraints_(std::move(constraints)) {}
|
||||||
|
|
||||||
|
SetSdpObserverJni::~SetSdpObserverJni() = default;
|
||||||
|
|
||||||
void SetSdpObserverJni::OnSuccess() {
|
void SetSdpObserverJni::OnSuccess() {
|
||||||
JNIEnv* env = AttachCurrentThreadIfNeeded();
|
JNIEnv* env = AttachCurrentThreadIfNeeded();
|
||||||
Java_SdpObserver_onSetSuccess(env, j_observer_global_);
|
Java_SdpObserver_onSetSuccess(env, j_observer_global_);
|
||||||
|
@ -26,6 +26,7 @@ class CreateSdpObserverJni : public CreateSessionDescriptionObserver {
|
|||||||
CreateSdpObserverJni(JNIEnv* env,
|
CreateSdpObserverJni(JNIEnv* env,
|
||||||
const JavaRef<jobject>& j_observer,
|
const JavaRef<jobject>& j_observer,
|
||||||
std::unique_ptr<MediaConstraintsInterface> constraints);
|
std::unique_ptr<MediaConstraintsInterface> constraints);
|
||||||
|
~CreateSdpObserverJni() override;
|
||||||
|
|
||||||
MediaConstraintsInterface* constraints() { return constraints_.get(); }
|
MediaConstraintsInterface* constraints() { return constraints_.get(); }
|
||||||
|
|
||||||
@ -42,6 +43,7 @@ class SetSdpObserverJni : public SetSessionDescriptionObserver {
|
|||||||
SetSdpObserverJni(JNIEnv* env,
|
SetSdpObserverJni(JNIEnv* env,
|
||||||
const JavaRef<jobject>& j_observer,
|
const JavaRef<jobject>& j_observer,
|
||||||
std::unique_ptr<MediaConstraintsInterface> constraints);
|
std::unique_ptr<MediaConstraintsInterface> constraints);
|
||||||
|
~SetSdpObserverJni() override;
|
||||||
|
|
||||||
MediaConstraintsInterface* constraints() { return constraints_.get(); }
|
MediaConstraintsInterface* constraints() { return constraints_.get(); }
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ StatsObserverJni::StatsObserverJni(JNIEnv* jni,
|
|||||||
const JavaRef<jobject>& j_observer)
|
const JavaRef<jobject>& j_observer)
|
||||||
: j_observer_global_(jni, j_observer) {}
|
: j_observer_global_(jni, j_observer) {}
|
||||||
|
|
||||||
|
StatsObserverJni::~StatsObserverJni() = default;
|
||||||
|
|
||||||
void StatsObserverJni::OnComplete(const StatsReports& reports) {
|
void StatsObserverJni::OnComplete(const StatsReports& reports) {
|
||||||
JNIEnv* env = AttachCurrentThreadIfNeeded();
|
JNIEnv* env = AttachCurrentThreadIfNeeded();
|
||||||
ScopedJavaLocalRef<jobjectArray> j_reports =
|
ScopedJavaLocalRef<jobjectArray> j_reports =
|
||||||
|
@ -22,6 +22,7 @@ namespace jni {
|
|||||||
class StatsObserverJni : public StatsObserver {
|
class StatsObserverJni : public StatsObserver {
|
||||||
public:
|
public:
|
||||||
StatsObserverJni(JNIEnv* jni, const JavaRef<jobject>& j_observer);
|
StatsObserverJni(JNIEnv* jni, const JavaRef<jobject>& j_observer);
|
||||||
|
~StatsObserverJni() override;
|
||||||
|
|
||||||
void OnComplete(const StatsReports& reports) override;
|
void OnComplete(const StatsReports& reports) override;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user