Enable cpplint in pc/
Enable cpplint check in the PRESUBMIT for pc/ and fix all existing warnings. Bug: webrtc:5583 Change-Id: If39994692ab6f6f3c83c74f23850f02fdfe810e8 Reviewed-on: https://webrtc-review.googlesource.com/16540 Commit-Queue: Steve Anton <steveanton@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20482}
This commit is contained in:
parent
ef1140eec0
commit
36b29d1df3
@ -30,7 +30,6 @@ CPPLINT_BLACKLIST = [
|
||||
'modules/utility',
|
||||
'modules/video_capture',
|
||||
'p2p',
|
||||
'pc',
|
||||
'rtc_base',
|
||||
'sdk/android/src/jni',
|
||||
'sdk/objc',
|
||||
|
||||
@ -525,7 +525,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
|
||||
class ScopedCallThread {
|
||||
public:
|
||||
template <class FunctorT>
|
||||
ScopedCallThread(const FunctorT& functor)
|
||||
explicit ScopedCallThread(const FunctorT& functor)
|
||||
: thread_(rtc::Thread::Create()),
|
||||
task_(new rtc::FunctorMessageHandler<void, FunctorT>(functor)) {
|
||||
thread_->Start();
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include "pc/channelmanager.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "media/base/device.h"
|
||||
#include "media/base/rtpdataengine.h"
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "pc/currentspeakermonitor.h"
|
||||
#include "pc/audiomonitor.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
|
||||
@ -180,7 +180,7 @@ bool DataChannel::Init(const InternalDataChannelInit& config) {
|
||||
case webrtc::InternalDataChannelInit::kAcker:
|
||||
handshake_state_ = kHandshakeShouldSendAck;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
// Try to connect to the transport in case the transport channel already
|
||||
// exists.
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "pc/datachannel.h"
|
||||
#include "pc/sctputils.h"
|
||||
|
||||
@ -80,7 +80,7 @@ srtp_err_status_t external_hmac_alloc(srtp_auth_t** a,
|
||||
return srtp_err_status_alloc_fail;
|
||||
|
||||
// Set pointers
|
||||
*a = (srtp_auth_t *)pointer;
|
||||
*a = reinterpret_cast<srtp_auth_t*>(pointer);
|
||||
// |external_hmac| is const and libsrtp expects |type| to be non-const.
|
||||
// const conversion is required. |external_hmac| is constant because we don't
|
||||
// want to increase global count in Chrome.
|
||||
@ -95,7 +95,8 @@ srtp_err_status_t external_hmac_alloc(srtp_auth_t** a,
|
||||
|
||||
srtp_err_status_t external_hmac_dealloc(srtp_auth_t* a) {
|
||||
// Zeroize entire state
|
||||
memset((uint8_t *)a, 0, sizeof(ExternalHmacContext) + sizeof(srtp_auth_t));
|
||||
memset(reinterpret_cast<uint8_t*>(a), 0,
|
||||
sizeof(ExternalHmacContext) + sizeof(srtp_auth_t));
|
||||
|
||||
// Free memory
|
||||
delete[] a;
|
||||
|
||||
@ -2430,9 +2430,9 @@ const DataContentDescription* GetFirstDataContentDescription(
|
||||
// Non-const versions of the above functions.
|
||||
//
|
||||
|
||||
ContentInfo* GetFirstMediaContent(ContentInfos& contents,
|
||||
ContentInfo* GetFirstMediaContent(ContentInfos* contents,
|
||||
MediaType media_type) {
|
||||
for (ContentInfo& content : contents) {
|
||||
for (ContentInfo& content : *contents) {
|
||||
if (IsMediaContentOfType(&content, media_type)) {
|
||||
return &content;
|
||||
}
|
||||
@ -2440,15 +2440,15 @@ ContentInfo* GetFirstMediaContent(ContentInfos& contents,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ContentInfo* GetFirstAudioContent(ContentInfos& contents) {
|
||||
ContentInfo* GetFirstAudioContent(ContentInfos* contents) {
|
||||
return GetFirstMediaContent(contents, MEDIA_TYPE_AUDIO);
|
||||
}
|
||||
|
||||
ContentInfo* GetFirstVideoContent(ContentInfos& contents) {
|
||||
ContentInfo* GetFirstVideoContent(ContentInfos* contents) {
|
||||
return GetFirstMediaContent(contents, MEDIA_TYPE_VIDEO);
|
||||
}
|
||||
|
||||
ContentInfo* GetFirstDataContent(ContentInfos& contents) {
|
||||
ContentInfo* GetFirstDataContent(ContentInfos* contents) {
|
||||
return GetFirstMediaContent(contents, MEDIA_TYPE_DATA);
|
||||
}
|
||||
|
||||
@ -2458,7 +2458,7 @@ static ContentInfo* GetFirstMediaContent(SessionDescription* sdesc,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GetFirstMediaContent(sdesc->contents(), media_type);
|
||||
return GetFirstMediaContent(&sdesc->contents(), media_type);
|
||||
}
|
||||
|
||||
ContentInfo* GetFirstAudioContent(SessionDescription* sdesc) {
|
||||
|
||||
@ -618,10 +618,10 @@ const DataContentDescription* GetFirstDataContentDescription(
|
||||
const SessionDescription* sdesc);
|
||||
// Non-const versions of the above functions.
|
||||
// Useful when modifying an existing description.
|
||||
ContentInfo* GetFirstMediaContent(ContentInfos& contents, MediaType media_type);
|
||||
ContentInfo* GetFirstAudioContent(ContentInfos& contents);
|
||||
ContentInfo* GetFirstVideoContent(ContentInfos& contents);
|
||||
ContentInfo* GetFirstDataContent(ContentInfos& contents);
|
||||
ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type);
|
||||
ContentInfo* GetFirstAudioContent(ContentInfos* contents);
|
||||
ContentInfo* GetFirstVideoContent(ContentInfos* contents);
|
||||
ContentInfo* GetFirstDataContent(ContentInfos* contents);
|
||||
ContentInfo* GetFirstAudioContent(SessionDescription* sdesc);
|
||||
ContentInfo* GetFirstVideoContent(SessionDescription* sdesc);
|
||||
ContentInfo* GetFirstDataContent(SessionDescription* sdesc);
|
||||
|
||||
@ -256,7 +256,16 @@ std::vector<MediaDescriptionOptions>::iterator FindFirstMediaDescriptionByMid(
|
||||
return std::find_if(
|
||||
opts->media_description_options.begin(),
|
||||
opts->media_description_options.end(),
|
||||
[mid](const MediaDescriptionOptions& t) { return t.mid == mid; });
|
||||
[&mid](const MediaDescriptionOptions& t) { return t.mid == mid; });
|
||||
}
|
||||
|
||||
std::vector<MediaDescriptionOptions>::const_iterator
|
||||
FindFirstMediaDescriptionByMid(const std::string& mid,
|
||||
const MediaSessionOptions& opts) {
|
||||
return std::find_if(
|
||||
opts.media_description_options.begin(),
|
||||
opts.media_description_options.end(),
|
||||
[&mid](const MediaDescriptionOptions& t) { return t.mid == mid; });
|
||||
}
|
||||
|
||||
// Add a media section to the |session_options|.
|
||||
@ -402,7 +411,7 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
|
||||
}
|
||||
|
||||
void TestTransportInfo(bool offer,
|
||||
MediaSessionOptions& options,
|
||||
const MediaSessionOptions& options,
|
||||
bool has_current_desc) {
|
||||
const std::string current_audio_ufrag = "current_audio_ufrag";
|
||||
const std::string current_audio_pwd = "current_audio_pwd";
|
||||
@ -448,7 +457,7 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
|
||||
ti_audio->description.ice_pwd.size());
|
||||
}
|
||||
auto media_desc_options_it =
|
||||
FindFirstMediaDescriptionByMid("audio", &options);
|
||||
FindFirstMediaDescriptionByMid("audio", options);
|
||||
EXPECT_EQ(
|
||||
media_desc_options_it->transport_options.enable_ice_renomination,
|
||||
GetIceRenomination(ti_audio));
|
||||
@ -476,7 +485,7 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
|
||||
}
|
||||
}
|
||||
auto media_desc_options_it =
|
||||
FindFirstMediaDescriptionByMid("video", &options);
|
||||
FindFirstMediaDescriptionByMid("video", options);
|
||||
EXPECT_EQ(
|
||||
media_desc_options_it->transport_options.enable_ice_renomination,
|
||||
GetIceRenomination(ti_video));
|
||||
@ -503,7 +512,7 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
|
||||
}
|
||||
}
|
||||
auto media_desc_options_it =
|
||||
FindFirstMediaDescriptionByMid("data", &options);
|
||||
FindFirstMediaDescriptionByMid("data", options);
|
||||
EXPECT_EQ(
|
||||
media_desc_options_it->transport_options.enable_ice_renomination,
|
||||
GetIceRenomination(ti_data));
|
||||
|
||||
@ -25,7 +25,7 @@ static typename V::iterator FindTrack(V* vector,
|
||||
}
|
||||
}
|
||||
return it;
|
||||
};
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<MediaStream> MediaStream::Create(
|
||||
const std::string& label) {
|
||||
|
||||
@ -206,8 +206,8 @@ template <class SENDER,
|
||||
class SENDERS,
|
||||
class RECEIVERS>
|
||||
void SetChannelOnSendersAndReceivers(CHANNEL* channel,
|
||||
SENDERS& senders,
|
||||
RECEIVERS& receivers,
|
||||
const SENDERS& senders,
|
||||
const RECEIVERS& receivers,
|
||||
cricket::MediaType media_type) {
|
||||
for (auto& sender : senders) {
|
||||
if (sender->media_type() == media_type) {
|
||||
|
||||
@ -184,7 +184,7 @@ std::unique_ptr<webrtc::AudioDecoder> CreateForwardingMockDecoder(
|
||||
std::unique_ptr<webrtc::AudioDecoder> real_decoder) {
|
||||
class ForwardingMockDecoder : public StrictMock<webrtc::MockAudioDecoder> {
|
||||
public:
|
||||
ForwardingMockDecoder(std::unique_ptr<AudioDecoder> decoder)
|
||||
explicit ForwardingMockDecoder(std::unique_ptr<AudioDecoder> decoder)
|
||||
: decoder_(std::move(decoder)) {}
|
||||
|
||||
private:
|
||||
|
||||
@ -106,7 +106,7 @@ PeerConnectionFactory::PeerConnectionFactory(
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Currently there is no way creating an external adm in
|
||||
// TODO(deadbeef): Currently there is no way to create an external adm in
|
||||
// libjingle source tree. So we can 't currently assert if this is NULL.
|
||||
// RTC_DCHECK(default_adm != NULL);
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
|
||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
|
||||
PeerConnectionObserver* observer) override;
|
||||
|
||||
virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
|
||||
rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
|
||||
const PeerConnectionInterface::RTCConfiguration& configuration,
|
||||
std::unique_ptr<cricket::PortAllocator> allocator,
|
||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
|
||||
@ -60,13 +60,13 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
|
||||
rtc::scoped_refptr<MediaStreamInterface>
|
||||
CreateLocalMediaStream(const std::string& label) override;
|
||||
|
||||
virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
|
||||
rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
|
||||
const cricket::AudioOptions& options) override;
|
||||
// Deprecated, use version without constraints.
|
||||
rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
|
||||
const MediaConstraintsInterface* constraints) override;
|
||||
|
||||
virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
|
||||
rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
|
||||
std::unique_ptr<cricket::VideoCapturer> capturer) override;
|
||||
// This version supports filtering on width, height and frame rate.
|
||||
// For the "constraints=null" case, use the version without constraints.
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/jsepsessiondescription.h"
|
||||
#include "media/base/fakevideocapturer.h"
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/peerconnectioninterface.h"
|
||||
#include "pc/test/mockpeerconnectionobservers.h"
|
||||
|
||||
@ -56,15 +56,16 @@ class RTCStatsReportTraceListener {
|
||||
}
|
||||
|
||||
private:
|
||||
static void AddTraceEventHandler(char phase,
|
||||
const unsigned char* category_enabled,
|
||||
const char* name,
|
||||
unsigned long long id,
|
||||
int num_args,
|
||||
const char** arg_names,
|
||||
const unsigned char* arg_types,
|
||||
const unsigned long long* arg_values,
|
||||
unsigned char flags) {
|
||||
static void AddTraceEventHandler(
|
||||
char phase,
|
||||
const unsigned char* category_enabled,
|
||||
const char* name,
|
||||
unsigned long long id, // NOLINT(runtime/int)
|
||||
int num_args,
|
||||
const char** arg_names,
|
||||
const unsigned char* arg_types,
|
||||
const unsigned long long* arg_values, // NOLINT(runtime/int)
|
||||
unsigned char flags) {
|
||||
RTC_DCHECK(traced_report_);
|
||||
EXPECT_STREQ("webrtc_stats",
|
||||
reinterpret_cast<const char*>(category_enabled));
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/jsepsessiondescription.h"
|
||||
@ -181,9 +182,8 @@ class FakeAudioTrackForStats
|
||||
return audio_track_stats;
|
||||
}
|
||||
|
||||
FakeAudioTrackForStats(const std::string& id)
|
||||
: MediaStreamTrack<AudioTrackInterface>(id) {
|
||||
}
|
||||
explicit FakeAudioTrackForStats(const std::string& id)
|
||||
: MediaStreamTrack<AudioTrackInterface>(id) {}
|
||||
|
||||
std::string kind() const override {
|
||||
return MediaStreamTrackInterface::kAudioKind;
|
||||
@ -209,9 +209,8 @@ class FakeVideoTrackForStats
|
||||
return video_track;
|
||||
}
|
||||
|
||||
FakeVideoTrackForStats(const std::string& id)
|
||||
: MediaStreamTrack<VideoTrackInterface>(id) {
|
||||
}
|
||||
explicit FakeVideoTrackForStats(const std::string& id)
|
||||
: MediaStreamTrack<VideoTrackInterface>(id) {}
|
||||
|
||||
std::string kind() const override {
|
||||
return MediaStreamTrackInterface::kVideoKind;
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
|
||||
#include "pc/rtpreceiver.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "api/mediastreamtrackproxy.h"
|
||||
#include "api/videosourceproxy.h"
|
||||
#include "pc/audiotrack.h"
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/mediastreaminterface.h"
|
||||
#include "api/rtpreceiverinterface.h"
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
|
||||
#include "pc/rtpsender.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "api/mediastreaminterface.h"
|
||||
#include "pc/localaudiosource.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/mediastreaminterface.h"
|
||||
#include "api/rtpsenderinterface.h"
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include "pc/sdputils.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "api/jsepsessiondescription.h"
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "api/jsep.h"
|
||||
#include "p2p/base/sessiondescription.h"
|
||||
|
||||
@ -21,21 +21,21 @@ using cricket::CS_REMOTE;
|
||||
|
||||
namespace rtc {
|
||||
|
||||
static const std::string kTestKeyParams1 =
|
||||
static const char kTestKeyParams1[] =
|
||||
"inline:WVNfX19zZW1jdGwgKCkgewkyMjA7fQp9CnVubGVz";
|
||||
static const std::string kTestKeyParams2 =
|
||||
static const char kTestKeyParams2[] =
|
||||
"inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR";
|
||||
static const std::string kTestKeyParams3 =
|
||||
static const char kTestKeyParams3[] =
|
||||
"inline:1234X19zZW1jdGwgKCkgewkyMjA7fQp9CnVubGVz";
|
||||
static const std::string kTestKeyParams4 =
|
||||
static const char kTestKeyParams4[] =
|
||||
"inline:4567QCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR";
|
||||
static const std::string kTestKeyParamsGcm1 =
|
||||
static const char kTestKeyParamsGcm1[] =
|
||||
"inline:e166KFlKzJsGW0d5apX+rrI05vxbrvMJEzFI14aTDCa63IRTlLK4iH66uOI=";
|
||||
static const std::string kTestKeyParamsGcm2 =
|
||||
static const char kTestKeyParamsGcm2[] =
|
||||
"inline:6X0oCd55zfz4VgtOwsuqcFq61275PDYN5uwuu3p7ZUHbfUY2FMpdP4m2PEo=";
|
||||
static const std::string kTestKeyParamsGcm3 =
|
||||
static const char kTestKeyParamsGcm3[] =
|
||||
"inline:YKlABGZWMgX32xuMotrG0v0T7G83veegaVzubQ==";
|
||||
static const std::string kTestKeyParamsGcm4 =
|
||||
static const char kTestKeyParamsGcm4[] =
|
||||
"inline:gJ6tWoUym2v+/F6xjr7xaxiS3QbJJozl3ZD/0A==";
|
||||
static const cricket::CryptoParams kTestCryptoParams1(
|
||||
1, "AES_CM_128_HMAC_SHA1_80", kTestKeyParams1, "");
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include "pc/srtptransport.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "media/base/rtputils.h"
|
||||
#include "pc/rtptransport.h"
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "pc/rtptransportinternal.h"
|
||||
#include "pc/srtpfilter.h"
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "pc/srtptransport.h"
|
||||
|
||||
#include "media/base/fakertp.h"
|
||||
@ -141,14 +143,14 @@ class SrtpTransportTest : public testing::Test, public sigslot::has_slots<> {
|
||||
TestRtpAuthParams(srtp_transport1_.get(), cipher_suite_name);
|
||||
} else {
|
||||
ASSERT_TRUE(last_recv_packet2_.data());
|
||||
EXPECT_TRUE(
|
||||
memcmp(last_recv_packet2_.data(), original_rtp_data, rtp_len) == 0);
|
||||
EXPECT_EQ(0,
|
||||
memcmp(last_recv_packet2_.data(), original_rtp_data, rtp_len));
|
||||
// Get the encrypted packet from underneath packet transport and verify
|
||||
// the data is actually encrypted.
|
||||
auto fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
|
||||
srtp_transport1_->rtp_packet_transport());
|
||||
EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
original_rtp_data, rtp_len) == 0);
|
||||
EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
original_rtp_data, rtp_len));
|
||||
}
|
||||
|
||||
// Do the same thing in the opposite direction;
|
||||
@ -158,12 +160,12 @@ class SrtpTransportTest : public testing::Test, public sigslot::has_slots<> {
|
||||
TestRtpAuthParams(srtp_transport2_.get(), cipher_suite_name);
|
||||
} else {
|
||||
ASSERT_TRUE(last_recv_packet1_.data());
|
||||
EXPECT_TRUE(
|
||||
memcmp(last_recv_packet1_.data(), original_rtp_data, rtp_len) == 0);
|
||||
EXPECT_EQ(0,
|
||||
memcmp(last_recv_packet1_.data(), original_rtp_data, rtp_len));
|
||||
auto fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
|
||||
srtp_transport2_->rtp_packet_transport());
|
||||
EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
original_rtp_data, rtp_len) == 0);
|
||||
EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
original_rtp_data, rtp_len));
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,25 +188,23 @@ class SrtpTransportTest : public testing::Test, public sigslot::has_slots<> {
|
||||
ASSERT_TRUE(srtp_transport1_->SendRtcpPacket(&rtcp_packet1to2, options,
|
||||
cricket::PF_SRTP_BYPASS));
|
||||
ASSERT_TRUE(last_recv_packet2_.data());
|
||||
EXPECT_TRUE(memcmp(last_recv_packet2_.data(), rtcp_packet_data, rtcp_len) ==
|
||||
0);
|
||||
EXPECT_EQ(0, memcmp(last_recv_packet2_.data(), rtcp_packet_data, rtcp_len));
|
||||
// Get the encrypted packet from underneath packet transport and verify the
|
||||
// data is actually encrypted.
|
||||
auto fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
|
||||
srtp_transport1_->rtp_packet_transport());
|
||||
EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
rtcp_packet_data, rtcp_len) == 0);
|
||||
EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
rtcp_packet_data, rtcp_len));
|
||||
|
||||
// Do the same thing in the opposite direction;
|
||||
ASSERT_TRUE(srtp_transport2_->SendRtcpPacket(&rtcp_packet2to1, options,
|
||||
cricket::PF_SRTP_BYPASS));
|
||||
ASSERT_TRUE(last_recv_packet1_.data());
|
||||
EXPECT_TRUE(memcmp(last_recv_packet1_.data(), rtcp_packet_data, rtcp_len) ==
|
||||
0);
|
||||
EXPECT_EQ(0, memcmp(last_recv_packet1_.data(), rtcp_packet_data, rtcp_len));
|
||||
fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
|
||||
srtp_transport2_->rtp_packet_transport());
|
||||
EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
rtcp_packet_data, rtcp_len) == 0);
|
||||
EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
rtcp_packet_data, rtcp_len));
|
||||
}
|
||||
|
||||
void TestSendRecvPacket(bool enable_external_auth,
|
||||
@ -267,14 +267,13 @@ class SrtpTransportTest : public testing::Test, public sigslot::has_slots<> {
|
||||
ASSERT_TRUE(srtp_transport1_->SendRtpPacket(&rtp_packet1to2, options,
|
||||
cricket::PF_SRTP_BYPASS));
|
||||
ASSERT_TRUE(last_recv_packet2_.data());
|
||||
EXPECT_TRUE(memcmp(last_recv_packet2_.data(), original_rtp_data, rtp_len) ==
|
||||
0);
|
||||
EXPECT_EQ(0, memcmp(last_recv_packet2_.data(), original_rtp_data, rtp_len));
|
||||
// Get the encrypted packet from underneath packet transport and verify the
|
||||
// data and header extension are actually encrypted.
|
||||
auto fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
|
||||
srtp_transport1_->rtp_packet_transport());
|
||||
EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
original_rtp_data, rtp_len) == 0);
|
||||
EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
original_rtp_data, rtp_len));
|
||||
CompareHeaderExtensions(
|
||||
reinterpret_cast<const char*>(
|
||||
fake_rtp_packet_transport->last_sent_packet()->data()),
|
||||
@ -285,12 +284,11 @@ class SrtpTransportTest : public testing::Test, public sigslot::has_slots<> {
|
||||
ASSERT_TRUE(srtp_transport2_->SendRtpPacket(&rtp_packet2to1, options,
|
||||
cricket::PF_SRTP_BYPASS));
|
||||
ASSERT_TRUE(last_recv_packet1_.data());
|
||||
EXPECT_TRUE(memcmp(last_recv_packet1_.data(), original_rtp_data, rtp_len) ==
|
||||
0);
|
||||
EXPECT_EQ(0, memcmp(last_recv_packet1_.data(), original_rtp_data, rtp_len));
|
||||
fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
|
||||
srtp_transport2_->rtp_packet_transport());
|
||||
EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
original_rtp_data, rtp_len) == 0);
|
||||
EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
|
||||
original_rtp_data, rtp_len));
|
||||
CompareHeaderExtensions(
|
||||
reinterpret_cast<const char*>(
|
||||
fake_rtp_packet_transport->last_sent_packet()->data()),
|
||||
|
||||
@ -74,13 +74,14 @@ StatsReport* AddTrackReport(StatsCollection* reports,
|
||||
}
|
||||
|
||||
template <class TrackVector>
|
||||
void CreateTrackReports(const TrackVector& tracks, StatsCollection* reports,
|
||||
TrackIdMap& track_ids) {
|
||||
void CreateTrackReports(const TrackVector& tracks,
|
||||
StatsCollection* reports,
|
||||
TrackIdMap* track_ids) {
|
||||
for (const auto& track : tracks) {
|
||||
const std::string& track_id = track->id();
|
||||
StatsReport* report = AddTrackReport(reports, track_id);
|
||||
RTC_DCHECK(report != nullptr);
|
||||
track_ids[track_id] = report;
|
||||
(*track_ids)[track_id] = report;
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,10 +464,10 @@ void StatsCollector::AddStream(MediaStreamInterface* stream) {
|
||||
RTC_DCHECK(pc_->signaling_thread()->IsCurrent());
|
||||
RTC_DCHECK(stream != NULL);
|
||||
|
||||
CreateTrackReports<AudioTrackVector>(stream->GetAudioTracks(),
|
||||
&reports_, track_ids_);
|
||||
CreateTrackReports<VideoTrackVector>(stream->GetVideoTracks(),
|
||||
&reports_, track_ids_);
|
||||
CreateTrackReports<AudioTrackVector>(stream->GetAudioTracks(), &reports_,
|
||||
&track_ids_);
|
||||
CreateTrackReports<VideoTrackVector>(stream->GetVideoTracks(), &reports_,
|
||||
&track_ids_);
|
||||
}
|
||||
|
||||
void StatsCollector::AddLocalAudioTrack(AudioTrackInterface* audio_track,
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/mediastreaminterface.h"
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "pc/statscollector.h"
|
||||
|
||||
|
||||
@ -164,7 +164,7 @@ class FakeAudioCaptureModule
|
||||
// exposed in which case the burden of proper instantiation would be put on
|
||||
// the creator of a FakeAudioCaptureModule instance. To create an instance of
|
||||
// this class use the Create(..) API.
|
||||
explicit FakeAudioCaptureModule();
|
||||
FakeAudioCaptureModule();
|
||||
// The destructor is protected because it is reference counted and should not
|
||||
// be deleted directly.
|
||||
virtual ~FakeAudioCaptureModule();
|
||||
@ -201,11 +201,11 @@ class FakeAudioCaptureModule
|
||||
// Callback for playout and recording.
|
||||
webrtc::AudioTransport* audio_callback_;
|
||||
|
||||
bool recording_; // True when audio is being pushed from the instance.
|
||||
bool playing_; // True when audio is being pulled by the instance.
|
||||
bool recording_; // True when audio is being pushed from the instance.
|
||||
bool playing_; // True when audio is being pulled by the instance.
|
||||
|
||||
bool play_is_initialized_; // True when the instance is ready to pull audio.
|
||||
bool rec_is_initialized_; // True when the instance is ready to push audio.
|
||||
bool play_is_initialized_; // True when the instance is ready to pull audio.
|
||||
bool rec_is_initialized_; // True when the instance is ready to push audio.
|
||||
|
||||
// Input to and output from RecordedDataIsAvailable(..) makes it possible to
|
||||
// modify the current mic level. The implementation does not care about the
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef PC_TEST_FAKEDATACHANNELPROVIDER_H_
|
||||
#define PC_TEST_FAKEDATACHANNELPROVIDER_H_
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "pc/datachannel.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ namespace webrtc {
|
||||
|
||||
class FakeVideoTrackRenderer : public cricket::FakeVideoRenderer {
|
||||
public:
|
||||
FakeVideoTrackRenderer(VideoTrackInterface* video_track)
|
||||
explicit FakeVideoTrackRenderer(VideoTrackInterface* video_track)
|
||||
: video_track_(video_track) {
|
||||
video_track_->AddOrUpdateSink(this, rtc::VideoSinkWants());
|
||||
}
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef PC_TEST_MOCK_DATACHANNEL_H_
|
||||
#define PC_TEST_MOCK_DATACHANNEL_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "pc/datachannel.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#ifndef PC_TEST_MOCK_PEERCONNECTION_H_
|
||||
#define PC_TEST_MOCK_PEERCONNECTION_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "call/call.h"
|
||||
|
||||
@ -28,10 +28,11 @@ class MockWebRtcSession : public webrtc::WebRtcSession {
|
||||
// http://crbug.com/428099.
|
||||
explicit MockWebRtcSession(cricket::ChannelManager* channel_manager,
|
||||
const cricket::MediaConfig& media_config)
|
||||
: WebRtcSession(nullptr /* Call */,
|
||||
: WebRtcSession(
|
||||
nullptr, // call
|
||||
channel_manager,
|
||||
media_config,
|
||||
nullptr, // event_log
|
||||
nullptr, // event_log
|
||||
rtc::Thread::Current(),
|
||||
rtc::Thread::Current(),
|
||||
rtc::Thread::Current(),
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/datachannelinterface.h"
|
||||
#include "api/jsepicecandidate.h"
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "p2p/base/fakeportallocator.h"
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#define PC_TEST_PEERCONNECTIONTESTWRAPPER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "api/peerconnectioninterface.h"
|
||||
#include "api/test/fakeconstraints.h"
|
||||
@ -52,7 +53,7 @@ class PeerConnectionTestWrapper
|
||||
void OnRemoveStream(
|
||||
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override {}
|
||||
void OnDataChannel(
|
||||
rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) override ;
|
||||
rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) override;
|
||||
void OnRenegotiationNeeded() override {}
|
||||
void OnIceConnectionChange(
|
||||
webrtc::PeerConnectionInterface::IceConnectionState new_state) override {}
|
||||
|
||||
@ -76,7 +76,7 @@ static const char kFireFoxSdpOffer[] =
|
||||
"a=candidate:5 2 UDP 1694302206 74.95.2.170 45468 typ srflx raddr"
|
||||
" 10.0.254.2 rport 61232\r\n"
|
||||
#endif
|
||||
;
|
||||
; // NOLINT(whitespace/semicolon)
|
||||
|
||||
// Audio SDP with a limited set of audio codecs.
|
||||
static const char kAudioSdp[] =
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/mediaconstraintsinterface.h"
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/test/fakeconstraints.h"
|
||||
|
||||
@ -8,11 +8,11 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "pc/videotrack.h"
|
||||
#include "rtc_base/refcountedobject.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
VideoTrack::VideoTrack(const std::string& label,
|
||||
|
||||
@ -15,7 +15,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
@ -174,7 +176,7 @@ static const char kNewLine = '\n';
|
||||
static const char kReturn = '\r';
|
||||
static const char kLineBreak[] = "\r\n";
|
||||
|
||||
// TODO: Generate the Session and Time description
|
||||
// TODO(deadbeef): Generate the Session and Time description
|
||||
// instead of hardcoding.
|
||||
static const char kSessionVersion[] = "v=0";
|
||||
// RFC 4566
|
||||
@ -675,7 +677,7 @@ static int GetCandidatePreferenceFromType(const std::string& type) {
|
||||
// likely to work, typically IPv4 relay.
|
||||
// RFC 5245
|
||||
// The value of |component_id| currently supported are 1 (RTP) and 2 (RTCP).
|
||||
// TODO: Decide the default destination in webrtcsession and
|
||||
// TODO(deadbeef): Decide the default destination in webrtcsession and
|
||||
// pass it down via SessionDescription.
|
||||
static void GetDefaultDestination(
|
||||
const std::vector<Candidate>& candidates,
|
||||
@ -1179,7 +1181,8 @@ bool ParseExtmap(const std::string& line,
|
||||
bool encrypted = false;
|
||||
if (uri == RtpExtension::kEncryptHeaderExtensionsUri) {
|
||||
// RFC 6904
|
||||
// a=extmap:<value["/"<direction>] urn:ietf:params:rtp-hdrext:encrypt <URI> <extensionattributes>
|
||||
// a=extmap:<value["/"<direction>] urn:ietf:params:rtp-hdrext:encrypt <URI>
|
||||
// <extensionattributes>
|
||||
const size_t expected_min_fields_encrypted = expected_min_fields + 1;
|
||||
if (fields.size() < expected_min_fields_encrypted) {
|
||||
return ParseFailedExpectMinFieldNum(line, expected_min_fields_encrypted,
|
||||
@ -1207,7 +1210,7 @@ void BuildMediaDescription(const ContentInfo* content_info,
|
||||
if (content_info == NULL || message == NULL) {
|
||||
return;
|
||||
}
|
||||
// TODO: Rethink if we should use sprintfn instead of stringstream.
|
||||
// TODO(deadbeef): Rethink if we should use sprintfn instead of stringstream.
|
||||
// According to the style guide, streams should only be used for logging.
|
||||
// http://google-styleguide.googlecode.com/svn/
|
||||
// trunk/cppguide.xml?showone=Streams#Streams
|
||||
@ -2768,7 +2771,7 @@ bool ParseContent(const std::string& message,
|
||||
}
|
||||
|
||||
if (!IsLineType(line, kLineTypeAttributes)) {
|
||||
// TODO: Handle other lines if needed.
|
||||
// TODO(deadbeef): Handle other lines if needed.
|
||||
LOG(LS_INFO) << "Ignored line: " << line;
|
||||
continue;
|
||||
}
|
||||
@ -2892,7 +2895,7 @@ bool ParseContent(const std::string& message,
|
||||
} else if (HasAttribute(line, kAttributeXGoogleFlag)) {
|
||||
// Experimental attribute. Conference mode activates more aggressive
|
||||
// AEC and NS settings.
|
||||
// TODO: expose API to set these directly.
|
||||
// TODO(deadbeef): expose API to set these directly.
|
||||
std::string flag_value;
|
||||
if (!GetValue(line, kAttributeXGoogleFlag, &flag_value, error)) {
|
||||
return false;
|
||||
|
||||
@ -2598,7 +2598,7 @@ TEST_F(WebRtcSdpTest, DeserializeSdpWithCorruptedSctpDataChannels) {
|
||||
// No crash is a pass.
|
||||
}
|
||||
|
||||
void MutateJsepSctpPort(JsepSessionDescription& jdesc,
|
||||
void MutateJsepSctpPort(JsepSessionDescription* jdesc,
|
||||
const SessionDescription& desc) {
|
||||
// take our pre-built session description and change the SCTP port.
|
||||
cricket::SessionDescription* mutant = desc.Copy();
|
||||
@ -2611,7 +2611,7 @@ void MutateJsepSctpPort(JsepSessionDescription& jdesc,
|
||||
dcdesc->set_codecs(codecs);
|
||||
|
||||
// note: mutant's owned by jdesc now.
|
||||
ASSERT_TRUE(jdesc.Initialize(mutant, kSessionId, kSessionVersion));
|
||||
ASSERT_TRUE(jdesc->Initialize(mutant, kSessionId, kSessionVersion));
|
||||
mutant = NULL;
|
||||
}
|
||||
|
||||
@ -2621,7 +2621,7 @@ TEST_F(WebRtcSdpTest, DeserializeSdpWithSctpDataChannelAndUnusualPort) {
|
||||
|
||||
// First setup the expected JsepSessionDescription.
|
||||
JsepSessionDescription jdesc(kDummyString);
|
||||
MutateJsepSctpPort(jdesc, desc_);
|
||||
MutateJsepSctpPort(&jdesc, desc_);
|
||||
|
||||
// Then get the deserialized JsepSessionDescription.
|
||||
std::string sdp_with_data = kSdpString;
|
||||
@ -2641,7 +2641,7 @@ TEST_F(WebRtcSdpTest,
|
||||
AddSctpDataChannel(use_sctpmap);
|
||||
|
||||
JsepSessionDescription jdesc(kDummyString);
|
||||
MutateJsepSctpPort(jdesc, desc_);
|
||||
MutateJsepSctpPort(&jdesc, desc_);
|
||||
|
||||
// We need to test the deserialized JsepSessionDescription from
|
||||
// kSdpSctpDataChannelStringWithSctpPort for
|
||||
|
||||
@ -1872,7 +1872,7 @@ bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content,
|
||||
RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n,
|
||||
this, content->name, transport_name))) {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
} else {
|
||||
bool require_rtcp_mux =
|
||||
rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire;
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#ifndef PC_WEBRTCSESSION_H_
|
||||
#define PC_WEBRTCSESSION_H_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
@ -10,7 +10,10 @@
|
||||
|
||||
#include "pc/webrtcsessiondescriptionfactory.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/jsep.h"
|
||||
#include "api/jsepsessiondescription.h"
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
#define PC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
|
||||
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
|
||||
#include "api/peerconnectioninterface.h"
|
||||
#include "p2p/base/transportdescriptionfactory.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user