diff --git a/webrtc/modules/rtp_rtcp/source/byte_io.h b/webrtc/modules/rtp_rtcp/source/byte_io.h index d8903b8483..c69c178078 100644 --- a/webrtc/modules/rtp_rtcp/source/byte_io.h +++ b/webrtc/modules/rtp_rtcp/source/byte_io.h @@ -51,17 +51,14 @@ namespace webrtc { // platform that doesn't use two's complement, implement conversion to/from // wire format. -namespace { -inline void AssertTwosComplement() { - // Assume the if any one signed integer type is two's complement, then all - // other will be too. - static_assert( - (-1 & 0x03) == 0x03, - "Only two's complement representation of signed integers supported."); -} +// Assume the if any one signed integer type is two's complement, then all +// other will be too. +static_assert( + (-1 & 0x03) == 0x03, + "Only two's complement representation of signed integers supported."); + // Plain const char* won't work for static_assert, use #define instead. #define kSizeErrorMsg "Byte size must be less than or equal to data type size." -} // Utility class for getting the unsigned equivalent of a signed type. template diff --git a/webrtc/modules/rtp_rtcp/source/fec_private_tables_bursty.h b/webrtc/modules/rtp_rtcp/source/fec_private_tables_bursty.h index 6105ae1d24..0b39908bb1 100644 --- a/webrtc/modules/rtp_rtcp/source/fec_private_tables_bursty.h +++ b/webrtc/modules/rtp_rtcp/source/fec_private_tables_bursty.h @@ -27,7 +27,8 @@ #include "webrtc/typedefs.h" -namespace { +namespace webrtc { +namespace fec_private_tables { const uint8_t kMaskBursty1_1[2] = { 0x80, 0x00 @@ -756,5 +757,6 @@ const uint8_t** kPacketMaskBurstyTbl[12] = { kPacketMaskBursty12 }; -} // namespace +} // namespace fec_private_tables +} // namespace webrtc #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_PRIVATE_TABLES_BURSTY_H_ diff --git a/webrtc/modules/rtp_rtcp/source/fec_private_tables_random.h b/webrtc/modules/rtp_rtcp/source/fec_private_tables_random.h index a2d1886957..295d749873 100644 --- a/webrtc/modules/rtp_rtcp/source/fec_private_tables_random.h +++ b/webrtc/modules/rtp_rtcp/source/fec_private_tables_random.h @@ -17,7 +17,8 @@ #include "webrtc/typedefs.h" -namespace { +namespace webrtc { +namespace fec_private_tables { const uint8_t kMaskRandom10_1[2] = { 0xff, 0xc0 @@ -24518,5 +24519,6 @@ const uint8_t** kPacketMaskRandomTbl[48] = { kPacketMaskRandom48 }; -} // namespace +} // namespace fec_private_tables +} // namespace webrtc #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_PRIVATE_TABLES_RANDOM_H_ diff --git a/webrtc/modules/rtp_rtcp/source/fec_test_helper.h b/webrtc/modules/rtp_rtcp/source/fec_test_helper.h index a5de924c89..aacc2d1ecc 100644 --- a/webrtc/modules/rtp_rtcp/source/fec_test_helper.h +++ b/webrtc/modules/rtp_rtcp/source/fec_test_helper.h @@ -54,6 +54,6 @@ class FrameGenerator { uint16_t seq_num_; uint32_t timestamp_; }; -} +} // namespace webrtc #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ diff --git a/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.cc b/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.cc index f2fe43276d..fae59078b1 100644 --- a/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.cc +++ b/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.cc @@ -17,6 +17,8 @@ #include "webrtc/modules/rtp_rtcp/source/fec_private_tables_random.h" namespace { +using webrtc::fec_private_tables::kPacketMaskBurstyTbl; +using webrtc::fec_private_tables::kPacketMaskRandomTbl; // Allow for different modes of protection for packets in UEP case. enum ProtectionMode { diff --git a/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc b/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc index 89c91ea069..e7d8fd71a5 100644 --- a/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc @@ -24,7 +24,7 @@ #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "webrtc/transport.h" -using namespace webrtc; +namespace webrtc { const int kVideoNackListSize = 30; const uint32_t kTestSsrc = 3456; @@ -338,3 +338,5 @@ TEST_F(RtpRtcpRtxNackTest, RtxNack) { EXPECT_EQ(kTestNumberOfRtxPackets, transport_.count_rtx_ssrc_); EXPECT_TRUE(ExpectedPacketsReceived()); } + +} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc index 7eaeca1ea0..a639f7f7f5 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc @@ -21,10 +21,9 @@ #include "webrtc/test/null_transport.h" #include "webrtc/typedefs.h" +namespace webrtc { namespace { -using namespace webrtc; - class TestTransport : public Transport { public: TestTransport(RTCPReceiver* rtcp_receiver) : rtcp_receiver_(rtcp_receiver) {} @@ -130,3 +129,4 @@ TEST_F(RtcpFormatRembTest, TestCompund) { EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); } } // namespace +} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc index b914838109..e1721394f8 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc @@ -23,8 +23,13 @@ #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" namespace webrtc { -using namespace RTCPUtility; -using namespace RTCPHelp; +using RTCPHelp::RTCPPacketInformation; +using RTCPHelp::RTCPReceiveInformation; +using RTCPHelp::RTCPReportBlockInformation; +using RTCPUtility::kBtVoipMetric; +using RTCPUtility::RTCPCnameInformation; +using RTCPUtility::RTCPPacketReportBlockItem; +using RTCPUtility::RTCPPacketTypes; // The number of RTCP time intervals needed to trigger a timeout. const int kRrTimeoutIntervals = 3; diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc index 718990d10b..a5c0e28282 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc @@ -17,7 +17,7 @@ #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" namespace webrtc { -using namespace RTCPHelp; +namespace RTCPHelp { RTCPPacketInformation::RTCPPacketInformation() : rtcpPacketTypeFlags(0), @@ -190,4 +190,5 @@ void RTCPReceiveInformation::VerifyAndAllocateBoundingSet( const uint32_t minimumSize) { TmmbnBoundingSet.VerifyAndAllocateSet(minimumSize); } +} // namespace RTCPHelp } // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_utility.cc b/webrtc/modules/rtp_rtcp/source/rtcp_utility.cc index eb44a870ba..e19499612d 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_utility.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_utility.cc @@ -41,8 +41,8 @@ void NackStats::ReportRequest(uint16_t sequence_number) { uint32_t MidNtp(uint32_t ntp_sec, uint32_t ntp_frac) { return (ntp_sec << 16) + (ntp_frac >> 16); -} // end RTCPUtility } +} // namespace RTCPUtility // RTCPParserV2 : currently read only RTCPUtility::RTCPParserV2::RTCPParserV2(const uint8_t* rtcpData, diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_utility.h b/webrtc/modules/rtp_rtcp/source/rtcp_utility.h index e1f8737ec5..0b03ceb56e 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_utility.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_utility.h @@ -487,6 +487,6 @@ class RTCPPacketIterator { RtcpCommonHeader _header; }; -} // RTCPUtility +} // namespace RTCPUtility } // namespace webrtc #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_UTILITY_H_ diff --git a/webrtc/modules/rtp_rtcp/source/rtp_header_extension.h b/webrtc/modules/rtp_rtcp/source/rtp_header_extension.h index 969d6b2bdf..37966de6c2 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_header_extension.h +++ b/webrtc/modules/rtp_rtcp/source/rtp_header_extension.h @@ -112,7 +112,7 @@ class RtpHeaderExtensionMap { int32_t Register(const RTPExtensionType type, const uint8_t id, bool active); std::map extensionMap_; }; -} +} // namespace webrtc #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_ diff --git a/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator.cc b/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator.cc index 902fc92395..9721a7e9ac 100644 --- a/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator.cc +++ b/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator.cc @@ -265,4 +265,4 @@ size_t Vp8PartitionAggregator::CalcNumberOfFragments( return num_fragments; } -} // namespace +} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator.h b/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator.h index 4716dfb317..ccd22e5be2 100644 --- a/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator.h +++ b/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator.h @@ -132,6 +132,6 @@ class Vp8PartitionAggregator { RTC_DISALLOW_COPY_AND_ASSIGN(Vp8PartitionAggregator); }; -} // namespace +} // namespace webrtc #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_VP8_PARTITION_AGGREGATOR_H_ diff --git a/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator_unittest.cc b/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator_unittest.cc index 4650c94047..726d83ec50 100644 --- a/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator_unittest.cc @@ -209,4 +209,4 @@ TEST(Vp8PartitionAggregator, TestCalcNumberOfFragments) { 1600, kMTU, 1, 900, 1000)); } -} // namespace +} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc index d67d78d67a..e81813653b 100644 --- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc +++ b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc @@ -24,7 +24,10 @@ #include "webrtc/system_wrappers/include/event_wrapper.h" #include "webrtc/system_wrappers/include/tick_util.h" -using namespace webrtc; +using webrtc::CriticalSectionScoped; +using webrtc::CriticalSectionWrapper; +using webrtc::EventWrapper; +using webrtc::TickTime; #ifdef MATLAB MatlabEngine eng; diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h index 5a4813f9b0..7e3513403c 100644 --- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h +++ b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h @@ -21,9 +21,6 @@ class TestLoadGenerator; namespace webrtc { class CriticalSectionWrapper; class EventWrapper; -} - -using namespace webrtc; #define MAX_BITRATE_KBPS 50000 @@ -149,5 +146,5 @@ private: int64_t _lastTime; }; - +} // namespace webrtc #endif // WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_TESTSENDERRECEIVER_H_ diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc index d245d103b8..1d4d6d04a5 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc @@ -15,9 +15,8 @@ #include "webrtc/test/null_transport.h" -using namespace webrtc; - namespace webrtc { + void LoopBackTransport::SetSendModule(RtpRtcp* rtp_rtcp_module, RTPPayloadRegistry* payload_registry, RtpReceiver* receiver, @@ -77,7 +76,6 @@ int32_t TestRtpReceiver::OnReceivedPayloadData( payload_size_ = payload_size; return 0; } -} // namespace webrtc class RtpRtcpAPITest : public ::testing::Test { protected: @@ -188,3 +186,5 @@ TEST_F(RtpRtcpAPITest, RtxReceiver) { rtx_header.payloadType = 0; EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); } + +} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc index 5fd940dbcc..ffe6ccef7d 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc @@ -19,8 +19,8 @@ #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.h" -using namespace webrtc; - +namespace webrtc { +namespace { #define test_rate 64000u class VerifyingAudioReceiver : public NullRtpData { @@ -349,3 +349,6 @@ TEST_F(RtpRtcpAudioTest, DTMF) { module1->Process(); } } + +} // namespace +} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc index 8faa2dd4f4..620f576ec0 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc @@ -20,7 +20,8 @@ #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.h" #include "webrtc/modules/rtp_rtcp/test/testAPI/test_api.h" -using namespace webrtc; +namespace webrtc { +namespace { const uint64_t kTestPictureId = 12345678; const uint8_t kSliPictureId = 156; @@ -266,3 +267,6 @@ TEST_F(RtpRtcpRtcpTest, RemoteRTCPStatRemote) { EXPECT_EQ(test_sequence_number, report_blocks[0].extendedHighSeqNum); EXPECT_EQ(0u, report_blocks[0].fractionLost); } + +} // namespace +} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/test/testFec/average_residual_loss_xor_codes.h b/webrtc/modules/rtp_rtcp/test/testFec/average_residual_loss_xor_codes.h index 80e2310ac3..6c233bba17 100644 --- a/webrtc/modules/rtp_rtcp/test/testFec/average_residual_loss_xor_codes.h +++ b/webrtc/modules/rtp_rtcp/test/testFec/average_residual_loss_xor_codes.h @@ -10,7 +10,7 @@ #ifndef WEBRTC_MODULES_RTP_RTCP_TEST_TESTFEC_AVERAGE_RESIDUAL_LOSS_XOR_CODES_H_ #define WEBRTC_MODULES_RTP_RTCP_TEST_TESTFEC_AVERAGE_RESIDUAL_LOSS_XOR_CODES_H_ -namespace { +namespace webrtc { // Maximum number of media packets allowed in this test. The burst mask types // are currently defined up to (kMaxMediaPacketsTest, kMaxMediaPacketsTest). @@ -187,5 +187,5 @@ const float kMaxResidualLossBurstyMask[kNumberCodes] = { 0.009657f }; -} // namespace +} // namespace webrtc #endif // WEBRTC_MODULES_RTP_RTCP_TEST_TESTFEC_AVERAGE_RESIDUAL_LOSS_XOR_CODES_H_ diff --git a/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc b/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc index a8eafdd27e..e84b511b4f 100644 --- a/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc +++ b/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc @@ -22,7 +22,6 @@ #include #include "testing/gtest/include/gtest/gtest.h" -#include "webrtc/modules/rtp_rtcp/source/fec_private_tables_bursty.h" #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" #include "webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h" @@ -32,7 +31,11 @@ //#define VERBOSE_OUTPUT namespace webrtc { +namespace fec_private_tables { +extern const uint8_t** kPacketMaskBurstyTbl[12]; +} namespace test { +using fec_private_tables::kPacketMaskBurstyTbl; void ReceivePackets( ForwardErrorCorrection::ReceivedPacketList* toDecodeList, @@ -94,10 +97,6 @@ TEST(FecTest, FecTest) { const FecMaskType kMaskTypes[] = { kFecMaskRandom, kFecMaskBursty }; const int kNumFecMaskTypes = sizeof(kMaskTypes) / sizeof(*kMaskTypes); - // TODO(pbos): Fix this. Hack to prevent a warning - // ('-Wunneeded-internal-declaration') from clang. - (void) kPacketMaskBurstyTbl; - // Maximum number of media packets allowed for the mask type. const uint16_t kMaxMediaPackets[] = {kMaxNumberMediaPackets, sizeof(kPacketMaskBurstyTbl) / sizeof(*kPacketMaskBurstyTbl)}; diff --git a/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc b/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc index 843a7f77f5..e46c9b8684 100644 --- a/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc +++ b/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc @@ -59,13 +59,6 @@ enum { kMaxNumberMediaPackets = 48 }; // Maximum number of media packets allowed for each mask type. const uint16_t kMaxMediaPackets[] = {kMaxNumberMediaPackets, 12}; -// Maximum number of media packets allowed in this test. The burst mask types -// are currently defined up to (k=12,m=12). -const int kMaxMediaPacketsTest = 12; - -// Maximum number of FEC codes considered in this test. -const int kNumberCodes = kMaxMediaPacketsTest * (kMaxMediaPacketsTest + 1) / 2; - // Maximum gap size for characterizing the consecutiveness of the loss. const int kMaxGapSize = 2 * kMaxMediaPacketsTest;