From 3cefbc99f4cc2db744cb130ca629768401a59eb4 Mon Sep 17 00:00:00 2001 From: "xians@webrtc.org" Date: Fri, 10 Oct 2014 09:42:53 +0000 Subject: [PATCH] Mark all virtual overrides in the hierarchy of Transport as virtual + OVERRIDE. This also marks all virtual overrides of other classes in the same files. This will make a subsequent change I intend to do safer, where I'll change the argument types of the base Transport functions, by breaking the compile if I miss any overrides. This also highlighted a number of unused functions. I've removed some of these. TBR=mflodman@webrtc.org, pkasting@chromium.org BUG=none TEST=none Review URL: https://webrtc-codereview.appspot.com/28709004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7421 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/media/webrtc/webrtcvideoengine.h | 71 ++++++----- talk/media/webrtc/webrtcvoiceengine.h | 24 ++-- .../rtp_rtcp/source/nack_rtx_unittest.cc | 12 +- .../source/rtcp_format_remb_unittest.cc | 10 +- .../rtp_rtcp/source/rtcp_receiver_unittest.cc | 12 +- .../rtp_rtcp/source/rtcp_sender_unittest.cc | 10 +- .../rtp_rtcp/source/rtp_rtcp_impl_unittest.cc | 14 ++- .../rtp_rtcp/source/rtp_sender_unittest.cc | 15 +-- .../test/BWEStandAlone/TestSenderReceiver.cc | 17 --- .../test/BWEStandAlone/TestSenderReceiver.h | 11 -- .../modules/rtp_rtcp/test/testAPI/test_api.h | 6 +- .../rtp_rtcp/test/testAPI/test_api_audio.cc | 34 +---- .../main/test/generic_codec_test.h | 22 ++-- .../video_coding/main/test/mt_test_common.h | 2 +- .../video_coding/main/test/test_callbacks.h | 52 ++++---- webrtc/video/transport_adapter.h | 10 +- .../auto_test/automated/vie_network_test.cc | 10 +- .../include/tb_external_transport.h | 4 +- webrtc/video_engine/vie_sender.h | 4 +- webrtc/voice_engine/channel.cc | 117 ------------------ webrtc/voice_engine/channel.h | 113 +++++++---------- .../mock/mock_voe_connection_observer.h | 28 ----- webrtc/voice_engine/include/voe_network.h | 13 -- .../android/android_test/jni/android_test.cc | 4 +- .../auto_test/fakes/fake_external_transport.h | 6 +- .../fixtures/after_initialization_fixture.h | 4 +- .../auto_test/standard/rtp_rtcp_extensions.cc | 10 +- .../voice_engine/test/win_test/WinTestDlg.cc | 28 +---- .../voice_engine/test/win_test/WinTestDlg.h | 2 - 29 files changed, 222 insertions(+), 443 deletions(-) delete mode 100644 webrtc/voice_engine/include/mock/mock_voe_connection_observer.h diff --git a/talk/media/webrtc/webrtcvideoengine.h b/talk/media/webrtc/webrtcvideoengine.h index 7a3651ba4..68eea71c3 100644 --- a/talk/media/webrtc/webrtcvideoengine.h +++ b/talk/media/webrtc/webrtcvideoengine.h @@ -206,10 +206,12 @@ class WebRtcVideoEngine : public sigslot::has_slots<>, bool VerifyApt(const VideoCodec& in, int expected_apt) const; // webrtc::TraceCallback implementation. - virtual void Print(webrtc::TraceLevel level, const char* trace, int length); + virtual void Print(webrtc::TraceLevel level, + const char* trace, + int length) OVERRIDE; // WebRtcVideoEncoderFactory::Observer implementation. - virtual void OnCodecsAvailable(); + virtual void OnCodecsAvailable() OVERRIDE; rtc::Thread* worker_thread_; rtc::scoped_ptr vie_wrapper_; @@ -250,42 +252,44 @@ class WebRtcVideoMediaChannel : public rtc::MessageHandler, int GetDefaultChannelId() const { return default_channel_id_; } // VideoMediaChannel implementation - virtual bool SetRecvCodecs(const std::vector &codecs); - virtual bool SetSendCodecs(const std::vector &codecs); - virtual bool GetSendCodec(VideoCodec* send_codec); - virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format); - virtual bool SetRender(bool render); - virtual bool SetSend(bool send); + virtual bool SetRecvCodecs(const std::vector &codecs) OVERRIDE; + virtual bool SetSendCodecs(const std::vector &codecs) OVERRIDE; + virtual bool GetSendCodec(VideoCodec* send_codec) OVERRIDE; + virtual bool SetSendStreamFormat(uint32 ssrc, + const VideoFormat& format) OVERRIDE; + virtual bool SetRender(bool render) OVERRIDE; + virtual bool SetSend(bool send) OVERRIDE; - virtual bool AddSendStream(const StreamParams& sp); - virtual bool RemoveSendStream(uint32 ssrc); - virtual bool AddRecvStream(const StreamParams& sp); - virtual bool RemoveRecvStream(uint32 ssrc); - virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer); - virtual bool GetStats(const StatsOptions& options, VideoMediaInfo* info); - virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer); - virtual bool SendIntraFrame(); - virtual bool RequestIntraFrame(); + virtual bool AddSendStream(const StreamParams& sp) OVERRIDE; + virtual bool RemoveSendStream(uint32 ssrc) OVERRIDE; + virtual bool AddRecvStream(const StreamParams& sp) OVERRIDE; + virtual bool RemoveRecvStream(uint32 ssrc) OVERRIDE; + virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) OVERRIDE; + virtual bool GetStats(const StatsOptions& options, + VideoMediaInfo* info) OVERRIDE; + virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) OVERRIDE; + virtual bool SendIntraFrame() OVERRIDE; + virtual bool RequestIntraFrame() OVERRIDE; virtual void OnPacketReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time); + const rtc::PacketTime& packet_time) OVERRIDE; virtual void OnRtcpReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time); - virtual void OnReadyToSend(bool ready); - virtual bool MuteStream(uint32 ssrc, bool on); + const rtc::PacketTime& packet_time) OVERRIDE; + virtual void OnReadyToSend(bool ready) OVERRIDE; + virtual bool MuteStream(uint32 ssrc, bool on) OVERRIDE; virtual bool SetRecvRtpHeaderExtensions( - const std::vector& extensions); + const std::vector& extensions) OVERRIDE; virtual bool SetSendRtpHeaderExtensions( - const std::vector& extensions); - virtual int GetRtpSendTimeExtnId() const; - virtual bool SetMaxSendBandwidth(int bps); - virtual bool SetOptions(const VideoOptions &options); - virtual bool GetOptions(VideoOptions *options) const { + const std::vector& extensions) OVERRIDE; + virtual int GetRtpSendTimeExtnId() const OVERRIDE; + virtual bool SetMaxSendBandwidth(int bps) OVERRIDE; + virtual bool SetOptions(const VideoOptions &options) OVERRIDE; + virtual bool GetOptions(VideoOptions *options) const OVERRIDE { *options = options_; return true; } - virtual void SetInterface(NetworkInterface* iface); - virtual void UpdateAspectRatio(int ratio_w, int ratio_h); + virtual void SetInterface(NetworkInterface* iface) OVERRIDE; + virtual void UpdateAspectRatio(int ratio_w, int ratio_h) OVERRIDE; // Public functions for use by tests and other specialized code. uint32 send_ssrc() const { return 0; } @@ -302,12 +306,15 @@ class WebRtcVideoMediaChannel : public rtc::MessageHandler, void OnLocalFrameFormat(VideoCapturer* capturer, const VideoFormat* format) { } - virtual void OnMessage(rtc::Message* msg); + // rtc::MessageHandler: + virtual void OnMessage(rtc::Message* msg) OVERRIDE; protected: int GetLastEngineError() { return engine()->GetLastEngineError(); } - virtual int SendPacket(int channel, const void* data, int len); - virtual int SendRTCPPacket(int channel, const void* data, int len); + + // webrtc::Transport: + virtual int SendPacket(int channel, const void* data, int len) OVERRIDE; + virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE; // Checks the current bitrate estimate and modifies the bitrates // accordingly, including converting kAutoBandwidth to the correct defaults. diff --git a/talk/media/webrtc/webrtcvoiceengine.h b/talk/media/webrtc/webrtcvoiceengine.h index 5d71612b0..8d762d43c 100644 --- a/talk/media/webrtc/webrtcvoiceengine.h +++ b/talk/media/webrtc/webrtcvoiceengine.h @@ -68,8 +68,9 @@ class WebRtcSoundclipStream : public webrtc::InStream { : mem_(buf, len), loop_(true) { } void set_loop(bool loop) { loop_ = loop; } - virtual int Read(void* buf, int len); - virtual int Rewind(); + + virtual int Read(void* buf, int len) OVERRIDE; + virtual int Rewind() OVERRIDE; private: rtc::MemoryStream mem_; @@ -79,7 +80,7 @@ class WebRtcSoundclipStream : public webrtc::InStream { // WebRtcMonitorStream is used to monitor a stream coming from WebRtc. // For now we just dump the data. class WebRtcMonitorStream : public webrtc::OutStream { - virtual bool Write(const void *buf, int len) { + virtual bool Write(const void *buf, int len) OVERRIDE { return true; } }; @@ -156,7 +157,7 @@ class WebRtcVoiceEngine int16_t audio10ms[], int length, int sampling_freq, - bool is_stereo); + bool is_stereo) OVERRIDE; // For tracking WebRtc channels. Needed because we have to pause them // all when switching devices. @@ -207,8 +208,15 @@ class WebRtcVoiceEngine // allows us to selectively turn on and off different options easily // at any time. bool ApplyOptions(const AudioOptions& options); - virtual void Print(webrtc::TraceLevel level, const char* trace, int length); - virtual void CallbackOnError(int channel, int errCode); + + // webrtc::TraceCallback: + virtual void Print(webrtc::TraceLevel level, + const char* trace, + int length) OVERRIDE; + + // webrtc::VoiceEngineObserver: + virtual void CallbackOnError(int channel, int errCode) OVERRIDE; + // Given the device type, name, and id, find device id. Return true and // set the output parameter rtc_id if successful. bool FindWebRtcAudioDeviceId( @@ -306,7 +314,7 @@ class WebRtcMediaChannel : public T, public webrtc::Transport { protected: // implements Transport interface - virtual int SendPacket(int channel, const void *data, int len) { + virtual int SendPacket(int channel, const void *data, int len) OVERRIDE { rtc::Buffer packet(data, len, kMaxRtpPacketLen); if (!T::SendPacket(&packet)) { return -1; @@ -314,7 +322,7 @@ class WebRtcMediaChannel : public T, public webrtc::Transport { return len; } - virtual int SendRTCPPacket(int channel, const void *data, int len) { + virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE { rtc::Buffer packet(data, len, kMaxRtpPacketLen); return T::SendRtcp(&packet) ? len : -1; } diff --git a/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc b/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc index b30791c6d..b852205cc 100644 --- a/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc @@ -41,7 +41,7 @@ class VerifyingRtxReceiver : public NullRtpData virtual int32_t OnReceivedPayloadData( const uint8_t* data, const uint16_t size, - const webrtc::WebRtcRTPHeader* rtp_header) { + const webrtc::WebRtcRTPHeader* rtp_header) OVERRIDE { if (!sequence_numbers_.empty()) EXPECT_EQ(kTestSsrc, rtp_header->header.ssrc); sequence_numbers_.push_back(rtp_header->header.sequenceNumber); @@ -56,7 +56,7 @@ class TestRtpFeedback : public NullRtpFeedback { virtual ~TestRtpFeedback() {} virtual void OnIncomingSSRCChanged(const int32_t id, - const uint32_t ssrc) { + const uint32_t ssrc) OVERRIDE { rtp_rtcp_->SetRemoteSSRC(ssrc); } @@ -95,7 +95,7 @@ class RtxLoopBackTransport : public webrtc::Transport { packet_loss_ = 0; } - virtual int SendPacket(int channel, const void *data, int len) { + virtual int SendPacket(int channel, const void *data, int len) OVERRIDE { count_++; const unsigned char* ptr = static_cast(data); uint32_t ssrc = (ptr[8] << 24) + (ptr[9] << 16) + (ptr[10] << 8) + ptr[11]; @@ -146,7 +146,7 @@ class RtxLoopBackTransport : public webrtc::Transport { return len; } - virtual int SendRTCPPacket(int channel, const void *data, int len) { + virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE { if (module_->IncomingRtcpPacket((const uint8_t*)data, len) == 0) { return len; } @@ -175,7 +175,7 @@ class RtpRtcpRtxNackTest : public ::testing::Test { fake_clock(123456) {} ~RtpRtcpRtxNackTest() {} - virtual void SetUp() { + virtual void SetUp() OVERRIDE { RtpRtcp::Configuration configuration; configuration.id = kTestId; configuration.audio = false; @@ -280,7 +280,7 @@ class RtpRtcpRtxNackTest : public ::testing::Test { receiver_.sequence_numbers_.sort(); } - virtual void TearDown() { + virtual void TearDown() OVERRIDE { delete rtp_rtcp_module_; } 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 5e580a34b..c055fd487 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc @@ -30,12 +30,14 @@ class TestTransport : public Transport { rtcp_receiver_(rtcp_receiver) { } - virtual int SendPacket(int /*channel*/, const void* /*data*/, int /*len*/) { + virtual int SendPacket(int /*channel*/, + const void* /*data*/, + int /*len*/) OVERRIDE { return -1; } virtual int SendRTCPPacket(int /*channel*/, const void *packet, - int packetLength) { + int packetLength) OVERRIDE { RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet, (int32_t)packetLength, true); // Allow non-compound RTCP @@ -71,8 +73,8 @@ class RtcpFormatRembTest : public ::testing::Test { system_clock_, kMimdControl, kRemoteBitrateEstimatorMinBitrateBps)) {} - virtual void SetUp(); - virtual void TearDown(); + virtual void SetUp() OVERRIDE; + virtual void TearDown() OVERRIDE; OverUseDetectorOptions over_use_detector_options_; Clock* system_clock_; diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc index 6ae89544f..b3a9d0934 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc @@ -39,20 +39,24 @@ class TestTransport : public Transport, void SetRTCPReceiver(RTCPReceiver* rtcp_receiver) { rtcp_receiver_ = rtcp_receiver; } - virtual int SendPacket(int /*ch*/, const void* /*data*/, int /*len*/) { + virtual int SendPacket(int /*ch*/, + const void* /*data*/, + int /*len*/) OVERRIDE { ADD_FAILURE(); // FAIL() gives a compile error. return -1; } // Injects an RTCP packet into the receiver. - virtual int SendRTCPPacket(int /* ch */, const void *packet, int packet_len) { + virtual int SendRTCPPacket(int /* ch */, + const void *packet, + int packet_len) OVERRIDE { ADD_FAILURE(); return 0; } virtual int OnReceivedPayloadData(const uint8_t* payloadData, const uint16_t payloadSize, - const WebRtcRTPHeader* rtpHeader) { + const WebRtcRTPHeader* rtpHeader) OVERRIDE { ADD_FAILURE(); return 0; } @@ -818,7 +822,7 @@ TEST_F(RtcpReceiverTest, Callbacks) { virtual ~RtcpCallbackImpl() {} virtual void StatisticsUpdated(const RtcpStatistics& statistics, - uint32_t ssrc) { + uint32_t ssrc) OVERRIDE { stats_ = statistics; ssrc_ = ssrc; } diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc index b8d53953a..44d4a2b72 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc @@ -227,11 +227,15 @@ class TestTransport : public Transport, void SetRTCPReceiver(RTCPReceiver* rtcp_receiver) { rtcp_receiver_ = rtcp_receiver; } - virtual int SendPacket(int /*ch*/, const void* /*data*/, int /*len*/) { + virtual int SendPacket(int /*ch*/, + const void* /*data*/, + int /*len*/) OVERRIDE { return -1; } - virtual int SendRTCPPacket(int /*ch*/, const void *packet, int packet_len) { + virtual int SendRTCPPacket(int /*ch*/, + const void *packet, + int packet_len) OVERRIDE { RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet, (int32_t)packet_len, true); // Allow non-compound RTCP @@ -263,7 +267,7 @@ class TestTransport : public Transport, virtual int OnReceivedPayloadData(const uint8_t* payloadData, const uint16_t payloadSize, - const WebRtcRTPHeader* rtpHeader) { + const WebRtcRTPHeader* rtpHeader) OVERRIDE { return 0; } RTCPReceiver* rtcp_receiver_; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc index 9486abd11..4868b71ff 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -39,10 +39,10 @@ class RtcpRttStatsTestImpl : public RtcpRttStats { RtcpRttStatsTestImpl() : rtt_ms_(0) {} virtual ~RtcpRttStatsTestImpl() {} - virtual void OnRttUpdate(uint32_t rtt_ms) { + virtual void OnRttUpdate(uint32_t rtt_ms) OVERRIDE { rtt_ms_ = rtt_ms; } - virtual uint32_t LastProcessedRtt() const { + virtual uint32_t LastProcessedRtt() const OVERRIDE { return rtt_ms_; } uint32_t rtt_ms_; @@ -65,7 +65,7 @@ class SendTransport : public Transport, clock_ = clock; delay_ms_ = delay_ms; } - virtual int SendPacket(int /*ch*/, const void* data, int len) { + virtual int SendPacket(int /*ch*/, const void* data, int len) OVERRIDE { RTPHeader header; scoped_ptr parser(RtpHeaderParser::Create()); EXPECT_TRUE(parser->Parse(static_cast(data), @@ -75,7 +75,7 @@ class SendTransport : public Transport, last_rtp_header_ = header; return len; } - virtual int SendRTCPPacket(int /*ch*/, const void *data, int len) { + virtual int SendRTCPPacket(int /*ch*/, const void *data, int len) OVERRIDE { if (clock_) { clock_->AdvanceTimeMilliseconds(delay_ms_); } @@ -348,7 +348,7 @@ class RtpSendingTestTransport : public Transport { public: void ResetCounters() { bytes_received_.clear(); } - virtual int SendPacket(int channel, const void* data, int length) { + virtual int SendPacket(int channel, const void* data, int length) OVERRIDE { RTPHeader header; scoped_ptr parser(RtpHeaderParser::Create()); EXPECT_TRUE(parser->Parse(static_cast(data), @@ -359,7 +359,9 @@ class RtpSendingTestTransport : public Transport { return length; } - virtual int SendRTCPPacket(int channel, const void* data, int length) { + virtual int SendRTCPPacket(int channel, + const void* data, + int length) OVERRIDE { return length; } diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc index 7b62d0b8b..9c6a7207d 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc @@ -64,14 +64,14 @@ class LoopbackTransportTest : public webrtc::Transport { public: LoopbackTransportTest() : packets_sent_(0), last_sent_packet_len_(0), total_bytes_sent_(0) {} - virtual int SendPacket(int channel, const void *data, int len) { + virtual int SendPacket(int channel, const void *data, int len) OVERRIDE { packets_sent_++; memcpy(last_sent_packet_, data, len); last_sent_packet_len_ = len; total_bytes_sent_ += static_cast(len); return len; } - virtual int SendRTCPPacket(int channel, const void *data, int len) { + virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE { return -1; } int packets_sent_; @@ -93,7 +93,7 @@ class RtpSenderTest : public ::testing::Test { SendPacket(_, _, _, _, _, _)).WillRepeatedly(testing::Return(true)); } - virtual void SetUp() { + virtual void SetUp() OVERRIDE { rtp_sender_.reset(new RTPSender(0, false, &fake_clock_, &transport_, NULL, &mock_paced_sender_, NULL, NULL, NULL)); rtp_sender_->SetSequenceNumber(kSeqNum); @@ -799,7 +799,7 @@ TEST_F(RtpSenderTest, FrameCountCallbacks) { virtual void FrameCountUpdated(FrameType frame_type, uint32_t frame_count, - const unsigned int ssrc) { + const unsigned int ssrc) OVERRIDE { ++num_calls_; ssrc_ = ssrc; switch (frame_type) { @@ -859,7 +859,8 @@ TEST_F(RtpSenderTest, BitrateCallbacks) { : BitrateStatisticsObserver(), num_calls_(0), ssrc_(0), bitrate_() {} virtual ~TestCallback() {} - virtual void Notify(const BitrateStatistics& stats, uint32_t ssrc) { + virtual void Notify(const BitrateStatistics& stats, + uint32_t ssrc) OVERRIDE { ++num_calls_; ssrc_ = ssrc; bitrate_ = stats; @@ -923,7 +924,7 @@ class RtpSenderAudioTest : public RtpSenderTest { protected: RtpSenderAudioTest() {} - virtual void SetUp() { + virtual void SetUp() OVERRIDE { payload_ = kAudioPayload; rtp_sender_.reset(new RTPSender(0, true, &fake_clock_, &transport_, NULL, &mock_paced_sender_, NULL, NULL, NULL)); @@ -939,7 +940,7 @@ TEST_F(RtpSenderTest, StreamDataCountersCallbacks) { virtual ~TestCallback() {} virtual void DataCountersUpdated(const StreamDataCounters& counters, - uint32_t ssrc) { + uint32_t ssrc) OVERRIDE { ssrc_ = ssrc; counters_ = counters; } diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc index aca467533..a536ebcc2 100644 --- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc +++ b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc @@ -46,7 +46,6 @@ _payloadType(0), _loadGenerator(NULL), _isSender(false), _isReceiver(false), -_timeOut(false), _sendRecCB(NULL), _lastBytesReceived(0), _lastTime(-1) @@ -290,22 +289,6 @@ int32_t TestSenderReceiver::SetPacketTimeout(const uint32_t timeoutMS) } -void TestSenderReceiver::OnPacketTimeout(const int32_t id) -{ - CriticalSectionScoped lock(_critSect); - - _timeOut = true; -} - - -void TestSenderReceiver::OnReceivedPacket(const int32_t id, - const RtpRtcpPacketType packetType) -{ - // do nothing - //printf("OnReceivedPacket\n"); - -} - int32_t TestSenderReceiver::OnReceivedPayloadData(const uint8_t* payloadData, const uint16_t payloadSize, const webrtc::WebRtcRTPHeader* rtpHeader) diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h index ade827e2f..3968e65ae 100644 --- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h +++ b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h @@ -68,8 +68,6 @@ public: int32_t SetPacketTimeout(const uint32_t timeoutMS); - bool timeOutTriggered () { return (_timeOut); }; - // Inherited from RtpFeedback virtual int32_t OnInitializeDecoder( const int32_t id, @@ -81,14 +79,6 @@ public: return 0; } - virtual void OnPacketTimeout(const int32_t id); - - virtual void OnReceivedPacket(const int32_t id, - const RtpRtcpPacketType packetType); - - virtual void OnPeriodicDeadOrAlive(const int32_t id, - const RTPAliveType alive) {}; - virtual void OnIncomingSSRCChanged(const int32_t id, const uint32_t SSRC) OVERRIDE {} @@ -159,7 +149,6 @@ private: TestLoadGenerator* _loadGenerator; bool _isSender; bool _isReceiver; - bool _timeOut; SendRecCB * _sendRecCB; uint32_t _lastBytesReceived; int64_t _lastTime; diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.h b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.h index 1c6b88385..bd9d197b6 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.h +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.h @@ -43,7 +43,7 @@ class LoopBackTransport : public webrtc::Transport { void DropEveryNthPacket(int n) { _packetLoss = n; } - virtual int SendPacket(int channel, const void *data, int len) { + virtual int SendPacket(int channel, const void *data, int len) OVERRIDE { _count++; if (_packetLoss > 0) { if ((_count % _packetLoss) == 0) { @@ -70,7 +70,7 @@ class LoopBackTransport : public webrtc::Transport { } return len; } - virtual int SendRTCPPacket(int channel, const void *data, int len) { + virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE { if (_rtpRtcpModule->IncomingRtcpPacket((const uint8_t*)data, len) < 0) { return -1; } @@ -91,7 +91,7 @@ class TestRtpReceiver : public NullRtpData { virtual int32_t OnReceivedPayloadData( const uint8_t* payloadData, const uint16_t payloadSize, - const webrtc::WebRtcRTPHeader* rtpHeader) { + const webrtc::WebRtcRTPHeader* rtpHeader) OVERRIDE { EXPECT_LE(payloadSize, sizeof(_payloadData)); memcpy(_payloadData, payloadData, payloadSize); memcpy(&_rtpHeader, rtpHeader, sizeof(_rtpHeader)); 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 8ae4c55ef..0832f63a9 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc @@ -28,7 +28,7 @@ class VerifyingAudioReceiver : public NullRtpData { virtual int32_t OnReceivedPayloadData( const uint8_t* payloadData, const uint16_t payloadSize, - const webrtc::WebRtcRTPHeader* rtpHeader) { + const webrtc::WebRtcRTPHeader* rtpHeader) OVERRIDE { if (rtpHeader->header.payloadType == 98 || rtpHeader->header.payloadType == 99) { EXPECT_EQ(4, payloadSize); @@ -67,7 +67,7 @@ class RTPCallback : public NullRtpFeedback { const char payloadName[RTP_PAYLOAD_NAME_SIZE], const int frequency, const uint8_t channels, - const uint32_t rate) { + const uint32_t rate) OVERRIDE { if (payloadType == 96) { EXPECT_EQ(test_rate, rate) << "The rate should be 64K for this payloadType"; @@ -76,28 +76,6 @@ class RTPCallback : public NullRtpFeedback { } }; -class AudioFeedback : public NullRtpAudioFeedback { - virtual void OnReceivedTelephoneEvent(const int32_t id, - const uint8_t event, - const bool end) { - static uint8_t expectedEvent = 0; - - if (end) { - uint8_t oldEvent = expectedEvent-1; - if (expectedEvent == 32) { - oldEvent = 15; - } - EXPECT_EQ(oldEvent, event); - } else { - EXPECT_EQ(expectedEvent, event); - expectedEvent++; - } - if (expectedEvent == 16) { - expectedEvent = 32; - } - } -}; - class RtpRtcpAudioTest : public ::testing::Test { protected: RtpRtcpAudioTest() : fake_clock(123456) { @@ -110,8 +88,8 @@ class RtpRtcpAudioTest : public ::testing::Test { } ~RtpRtcpAudioTest() {} - virtual void SetUp() { - audioFeedback = new AudioFeedback(); + virtual void SetUp() OVERRIDE { + audioFeedback = new NullRtpAudioFeedback(); data_receiver1 = new VerifyingAudioReceiver(); data_receiver2 = new VerifyingAudioReceiver(); rtp_callback = new RTPCallback(); @@ -155,7 +133,7 @@ class RtpRtcpAudioTest : public ::testing::Test { rtp_receiver1_.get(), receive_statistics1_.get()); } - virtual void TearDown() { + virtual void TearDown() OVERRIDE { delete module1; delete module2; delete transport1; @@ -179,7 +157,7 @@ class RtpRtcpAudioTest : public ::testing::Test { VerifyingAudioReceiver* data_receiver2; LoopBackTransport* transport1; LoopBackTransport* transport2; - AudioFeedback* audioFeedback; + NullRtpAudioFeedback* audioFeedback; RTPCallback* rtp_callback; uint32_t test_ssrc; uint32_t test_timestamp; diff --git a/webrtc/modules/video_coding/main/test/generic_codec_test.h b/webrtc/modules/video_coding/main/test/generic_codec_test.h index 9f53e9a2d..841662aad 100644 --- a/webrtc/modules/video_coding/main/test/generic_codec_test.h +++ b/webrtc/modules/video_coding/main/test/generic_codec_test.h @@ -75,8 +75,8 @@ class RTPSendCallback_SizeTest : public webrtc::Transport public: // constructor input: (receive side) rtp module to send encoded data to RTPSendCallback_SizeTest() : _maxPayloadSize(0), _payloadSizeSum(0), _nPackets(0) {} - virtual int SendPacket(int channel, const void *data, int len); - virtual int SendRTCPPacket(int channel, const void *data, int len) {return 0;} + virtual int SendPacket(int channel, const void *data, int len) OVERRIDE; + virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE {return 0;} void SetMaxPayloadSize(uint32_t maxPayloadSize); void Reset(); float AveragePayloadSize() const; @@ -90,15 +90,15 @@ class VCMEncComplete_KeyReqTest : public webrtc::VCMPacketizationCallback { public: VCMEncComplete_KeyReqTest(webrtc::VideoCodingModule &vcm) : _vcm(vcm), _seqNo(0), _timeStamp(0) {} - int32_t SendData( - const webrtc::FrameType frameType, - const uint8_t payloadType, - uint32_t timeStamp, - int64_t capture_time_ms, - const uint8_t* payloadData, - const uint32_t payloadSize, - const webrtc::RTPFragmentationHeader& fragmentationHeader, - const webrtc::RTPVideoHeader* videoHdr); + virtual int32_t SendData( + const webrtc::FrameType frameType, + const uint8_t payloadType, + uint32_t timeStamp, + int64_t capture_time_ms, + const uint8_t* payloadData, + const uint32_t payloadSize, + const webrtc::RTPFragmentationHeader& fragmentationHeader, + const webrtc::RTPVideoHeader* videoHdr) OVERRIDE; private: webrtc::VideoCodingModule& _vcm; uint16_t _seqNo; diff --git a/webrtc/modules/video_coding/main/test/mt_test_common.h b/webrtc/modules/video_coding/main/test/mt_test_common.h index 08813a0de..be6d9ea64 100644 --- a/webrtc/modules/video_coding/main/test/mt_test_common.h +++ b/webrtc/modules/video_coding/main/test/mt_test_common.h @@ -52,7 +52,7 @@ class TransportCallback:public RTPSendCompleteCallback // Add packets to list // Incorporate network conditions - delay and packet loss // Actual transmission will occur on a separate thread - int SendPacket(int channel, const void *data, int len); + virtual int SendPacket(int channel, const void *data, int len) OVERRIDE; // Send to the receiver packets which are ready to be submitted int TransportPackets(); }; diff --git a/webrtc/modules/video_coding/main/test/test_callbacks.h b/webrtc/modules/video_coding/main/test/test_callbacks.h index e6543f085..608d185e3 100644 --- a/webrtc/modules/video_coding/main/test/test_callbacks.h +++ b/webrtc/modules/video_coding/main/test/test_callbacks.h @@ -44,14 +44,14 @@ public: void RegisterTransportCallback(VCMPacketizationCallback* transport); // Process encoded data received from the encoder, pass stream to the // VCMReceiver module - int32_t SendData(const FrameType frameType, - const uint8_t payloadType, - const uint32_t timeStamp, - int64_t capture_time_ms, - const uint8_t* payloadData, - const uint32_t payloadSize, - const RTPFragmentationHeader& fragmentationHeader, - const RTPVideoHeader* videoHdr); + virtual int32_t SendData(const FrameType frameType, + const uint8_t payloadType, + const uint32_t timeStamp, + int64_t capture_time_ms, + const uint8_t* payloadData, + const uint32_t payloadSize, + const RTPFragmentationHeader& fragmentationHeader, + const RTPVideoHeader* videoHdr) OVERRIDE; // Register exisitng VCM. Currently - encode and decode under same module. void RegisterReceiverVCM(VideoCodingModule *vcm) {_VCMReceiver = vcm;} // Return size of last encoded frame data (all frames in the sequence) @@ -101,14 +101,14 @@ public: virtual ~VCMRTPEncodeCompleteCallback() {} // Process encoded data received from the encoder, pass stream to the // RTP module - int32_t SendData(const FrameType frameType, - const uint8_t payloadType, - const uint32_t timeStamp, - int64_t capture_time_ms, - const uint8_t* payloadData, - const uint32_t payloadSize, - const RTPFragmentationHeader& fragmentationHeader, - const RTPVideoHeader* videoHdr); + virtual int32_t SendData(const FrameType frameType, + const uint8_t payloadType, + const uint32_t timeStamp, + int64_t capture_time_ms, + const uint8_t* payloadData, + const uint32_t payloadSize, + const RTPFragmentationHeader& fragmentationHeader, + const RTPVideoHeader* videoHdr) OVERRIDE; // Return size of last encoded frame. Value good for one call // (resets to zero after call to inform test of frame drop) float EncodedBytes(); @@ -144,7 +144,7 @@ public: _decodedFile(decodedFile), _decodedBytes(0) {} virtual ~VCMDecodeCompleteCallback() {} // Write decoded frame into file - int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame); + virtual int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame) OVERRIDE; int32_t DecodedBytes(); private: FILE* _decodedFile; @@ -165,9 +165,9 @@ public: void SetRtpModule(RtpRtcp* rtp_module) { _rtp = rtp_module; } // Send Packet to receive side RTP module - virtual int SendPacket(int channel, const void *data, int len); + virtual int SendPacket(int channel, const void *data, int len) OVERRIDE; // Send RTCP Packet to receive side RTP module - virtual int SendRTCPPacket(int channel, const void *data, int len); + virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE; // Set percentage of channel loss in the network void SetLossPct(double lossPct); // Set average size of burst loss @@ -209,8 +209,8 @@ class PacketRequester: public VCMPacketRequestCallback public: PacketRequester(RtpRtcp& rtp) : _rtp(rtp) {} - int32_t ResendPackets(const uint16_t* sequenceNumbers, - uint16_t length); + virtual int32_t ResendPackets(const uint16_t* sequenceNumbers, + uint16_t length) OVERRIDE; private: webrtc::RtpRtcp& _rtp; }; @@ -219,7 +219,7 @@ private: class KeyFrameReqTest: public VCMFrameTypeCallback { public: - int32_t RequestKeyFrame(); + virtual int32_t RequestKeyFrame() OVERRIDE; }; @@ -228,8 +228,8 @@ class SendStatsTest: public webrtc::VCMSendStatisticsCallback { public: SendStatsTest() : _framerate(15), _bitrate(500) {} - int32_t SendStatistics(const uint32_t bitRate, - const uint32_t frameRate); + virtual int32_t SendStatistics(const uint32_t bitRate, + const uint32_t frameRate) OVERRIDE; void set_framerate(uint32_t frameRate) {_framerate = frameRate;} void set_bitrate(uint32_t bitrate) {_bitrate = bitrate;} private: @@ -245,12 +245,12 @@ public: VideoProtectionCallback(); virtual ~VideoProtectionCallback(); void RegisterRtpModule(RtpRtcp* rtp) {_rtp = rtp;} - int32_t ProtectionRequest( + virtual int32_t ProtectionRequest( const FecProtectionParams* delta_fec_params, const FecProtectionParams* key_fec_params, uint32_t* sent_video_rate_bps, uint32_t* sent_nack_rate_bps, - uint32_t* sent_fec_rate_bps); + uint32_t* sent_fec_rate_bps) OVERRIDE; FecProtectionParams DeltaFecParameters() const; FecProtectionParams KeyFecParameters() const; private: diff --git a/webrtc/video/transport_adapter.h b/webrtc/video/transport_adapter.h index f7cba1df0..a9a72e167 100644 --- a/webrtc/video/transport_adapter.h +++ b/webrtc/video/transport_adapter.h @@ -21,10 +21,12 @@ class TransportAdapter : public webrtc::Transport { public: explicit TransportAdapter(newapi::Transport* transport); - virtual int SendPacket(int /*channel*/, const void* packet, int length) - OVERRIDE; - virtual int SendRTCPPacket(int /*channel*/, const void* packet, int length) - OVERRIDE; + virtual int SendPacket(int /*channel*/, + const void* packet, + int length) OVERRIDE; + virtual int SendRTCPPacket(int /*channel*/, + const void* packet, + int length) OVERRIDE; void Enable(); void Disable(); diff --git a/webrtc/video_engine/test/auto_test/automated/vie_network_test.cc b/webrtc/video_engine/test/auto_test/automated/vie_network_test.cc index a2d060e7d..206d05552 100644 --- a/webrtc/video_engine/test/auto_test/automated/vie_network_test.cc +++ b/webrtc/video_engine/test/auto_test/automated/vie_network_test.cc @@ -25,11 +25,13 @@ class RtcpCollectorTransport : public webrtc::Transport { RtcpCollectorTransport() : packets_() {} virtual ~RtcpCollectorTransport() {} - virtual int SendPacket(int /*channel*/, const void* /*data*/, int /*len*/) { + virtual int SendPacket(int /*channel*/, + const void* /*data*/, + int /*len*/) OVERRIDE { EXPECT_TRUE(false); return 0; } - virtual int SendRTCPPacket(int channel, const void* data, int len) { + virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE { const uint8_t* buf = static_cast(data); webrtc::RtpUtility::RtpHeaderParser parser(buf, len); if (parser.RTCP()) { @@ -105,13 +107,13 @@ class ViENetworkTest : public testing::Test { ViENetworkTest() : vie_("ViENetworkTest"), channel_(-1), transport() {} virtual ~ViENetworkTest() {} - virtual void SetUp() { + virtual void SetUp() OVERRIDE { EXPECT_EQ(0, vie_.base->CreateChannel(channel_)); EXPECT_EQ(0, vie_.rtp_rtcp->SetRembStatus(channel_, false, true)); EXPECT_EQ(0, vie_.network->RegisterSendTransport(channel_, transport)); } - virtual void TearDown() { + virtual void TearDown() OVERRIDE { EXPECT_EQ(0, vie_.network->DeregisterSendTransport(channel_)); } diff --git a/webrtc/video_engine/test/libvietest/include/tb_external_transport.h b/webrtc/video_engine/test/libvietest/include/tb_external_transport.h index 541b5cd52..b4518a3fb 100644 --- a/webrtc/video_engine/test/libvietest/include/tb_external_transport.h +++ b/webrtc/video_engine/test/libvietest/include/tb_external_transport.h @@ -85,8 +85,8 @@ public: TbExternalTransport::SsrcChannelMap* receive_channels); ~TbExternalTransport(void); - virtual int SendPacket(int channel, const void *data, int len); - virtual int SendRTCPPacket(int channel, const void *data, int len); + virtual int SendPacket(int channel, const void *data, int len) OVERRIDE; + virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE; // Should only be called before/after traffic is being processed. // Only one observer can be set (multiple calls will overwrite each other). diff --git a/webrtc/video_engine/vie_sender.h b/webrtc/video_engine/vie_sender.h index 1eecc06c7..f910cb1af 100644 --- a/webrtc/video_engine/vie_sender.h +++ b/webrtc/video_engine/vie_sender.h @@ -40,8 +40,8 @@ class ViESender: public Transport { int StopRTPDump(); // Implements Transport. - virtual int SendPacket(int vie_id, const void* data, int len); - virtual int SendRTCPPacket(int vie_id, const void* data, int len); + virtual int SendPacket(int vie_id, const void* data, int len) OVERRIDE; + virtual int SendRTCPPacket(int vie_id, const void* data, int len) OVERRIDE; private: const int32_t channel_id_; diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index c52fd9841..58e0055de 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -395,116 +395,6 @@ Channel::OnInitializeDecoder( return 0; } -void -Channel::OnPacketTimeout(int32_t id) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::OnPacketTimeout(id=%d)", id); - - CriticalSectionScoped cs(_callbackCritSectPtr); - if (_voiceEngineObserverPtr) - { - if (channel_state_.Get().receiving || _externalTransport) - { - int32_t channel = VoEChannelId(id); - assert(channel == _channelId); - // Ensure that next OnReceivedPacket() callback will trigger - // a VE_PACKET_RECEIPT_RESTARTED callback. - _rtpPacketTimedOut = true; - // Deliver callback to the observer - WEBRTC_TRACE(kTraceInfo, kTraceVoice, - VoEId(_instanceId,_channelId), - "Channel::OnPacketTimeout() => " - "CallbackOnError(VE_RECEIVE_PACKET_TIMEOUT)"); - _voiceEngineObserverPtr->CallbackOnError(channel, - VE_RECEIVE_PACKET_TIMEOUT); - } - } -} - -void -Channel::OnReceivedPacket(int32_t id, - RtpRtcpPacketType packetType) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::OnReceivedPacket(id=%d, packetType=%d)", - id, packetType); - - assert(VoEChannelId(id) == _channelId); - - // Notify only for the case when we have restarted an RTP session. - if (_rtpPacketTimedOut && (kPacketRtp == packetType)) - { - CriticalSectionScoped cs(_callbackCritSectPtr); - if (_voiceEngineObserverPtr) - { - int32_t channel = VoEChannelId(id); - assert(channel == _channelId); - // Reset timeout mechanism - _rtpPacketTimedOut = false; - // Deliver callback to the observer - WEBRTC_TRACE(kTraceInfo, kTraceVoice, - VoEId(_instanceId,_channelId), - "Channel::OnPacketTimeout() =>" - " CallbackOnError(VE_PACKET_RECEIPT_RESTARTED)"); - _voiceEngineObserverPtr->CallbackOnError( - channel, - VE_PACKET_RECEIPT_RESTARTED); - } - } -} - -void -Channel::OnPeriodicDeadOrAlive(int32_t id, - RTPAliveType alive) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::OnPeriodicDeadOrAlive(id=%d, alive=%d)", id, alive); - - { - CriticalSectionScoped cs(&_callbackCritSect); - if (!_connectionObserver) - return; - } - - int32_t channel = VoEChannelId(id); - assert(channel == _channelId); - - // Use Alive as default to limit risk of false Dead detections - bool isAlive(true); - - // Always mark the connection as Dead when the module reports kRtpDead - if (kRtpDead == alive) - { - isAlive = false; - } - - // It is possible that the connection is alive even if no RTP packet has - // been received for a long time since the other side might use VAD/DTX - // and a low SID-packet update rate. - if ((kRtpNoRtp == alive) && channel_state_.Get().playing) - { - // Detect Alive for all NetEQ states except for the case when we are - // in PLC_CNG state. - // PLC_CNG <=> background noise only due to long expand or error. - // Note that, the case where the other side stops sending during CNG - // state will be detected as Alive. Dead is is not set until after - // missing RTCP packets for at least twelve seconds (handled - // internally by the RTP/RTCP module). - isAlive = (_outputSpeechType != AudioFrame::kPLCCNG); - } - - // Send callback to the registered observer - if (_connectionObserver) - { - CriticalSectionScoped cs(&_callbackCritSect); - if (_connectionObserverPtr) - { - _connectionObserverPtr->OnPeriodicDeadOrAlive(channel, isAlive); - } - } -} - int32_t Channel::OnReceivedPayloadData(const uint8_t* payloadData, uint16_t payloadSize, @@ -862,7 +752,6 @@ Channel::Channel(int32_t channelId, _rtpDumpOut(*RtpDump::CreateRtpDump()), _outputAudioLevel(), _externalTransport(false), - _audioLevel_dBov(0), _inputFilePlayerPtr(NULL), _outputFilePlayerPtr(NULL), _outputFileRecorderPtr(NULL), @@ -902,7 +791,6 @@ Channel::Channel(int32_t channelId, _oldVadDecision(-1), _sendFrameType(0), _rtcpObserverPtr(NULL), - _externalPlayout(false), _externalMixing(false), _mixFileWithMicrophone(false), _rtcpObserver(false), @@ -915,11 +803,6 @@ Channel::Channel(int32_t channelId, _lastLocalTimeStamp(0), _lastPayloadType(0), _includeAudioLevelIndication(false), - _rtpPacketTimedOut(false), - _rtpPacketTimeOutIsEnabled(false), - _rtpTimeOutSeconds(0), - _connectionObserver(false), - _connectionObserverPtr(NULL), _outputSpeechType(AudioFrame::kNormalSpeech), vie_network_(NULL), video_channel_(-1), diff --git a/webrtc/voice_engine/channel.h b/webrtc/voice_engine/channel.h index bbc286ba3..1c2fc4ac8 100644 --- a/webrtc/voice_engine/channel.h +++ b/webrtc/voice_engine/channel.h @@ -351,83 +351,69 @@ public: void SetVideoEngineBWETarget(ViENetwork* vie_network, int video_channel); // From AudioPacketizationCallback in the ACM - int32_t SendData(FrameType frameType, - uint8_t payloadType, - uint32_t timeStamp, - const uint8_t* payloadData, - uint16_t payloadSize, - const RTPFragmentationHeader* fragmentation); + virtual int32_t SendData( + FrameType frameType, + uint8_t payloadType, + uint32_t timeStamp, + const uint8_t* payloadData, + uint16_t payloadSize, + const RTPFragmentationHeader* fragmentation) OVERRIDE; + // From ACMVADCallback in the ACM - int32_t InFrameType(int16_t frameType); + virtual int32_t InFrameType(int16_t frameType) OVERRIDE; int32_t OnRxVadDetected(int vadDecision); // From RtpData in the RTP/RTCP module - int32_t OnReceivedPayloadData(const uint8_t* payloadData, - uint16_t payloadSize, - const WebRtcRTPHeader* rtpHeader); - - bool OnRecoveredPacket(const uint8_t* packet, int packet_length); + virtual int32_t OnReceivedPayloadData( + const uint8_t* payloadData, + uint16_t payloadSize, + const WebRtcRTPHeader* rtpHeader) OVERRIDE; + virtual bool OnRecoveredPacket(const uint8_t* packet, + int packet_length) OVERRIDE; // From RtpFeedback in the RTP/RTCP module - int32_t OnInitializeDecoder( - int32_t id, - int8_t payloadType, - const char payloadName[RTP_PAYLOAD_NAME_SIZE], - int frequency, - uint8_t channels, - uint32_t rate); - - void OnPacketTimeout(int32_t id); - - void OnReceivedPacket(int32_t id, RtpRtcpPacketType packetType); - - void OnPeriodicDeadOrAlive(int32_t id, - RTPAliveType alive); - - void OnIncomingSSRCChanged(int32_t id, - uint32_t ssrc); - - void OnIncomingCSRCChanged(int32_t id, - uint32_t CSRC, bool added); - - void ResetStatistics(uint32_t ssrc); + virtual int32_t OnInitializeDecoder( + int32_t id, + int8_t payloadType, + const char payloadName[RTP_PAYLOAD_NAME_SIZE], + int frequency, + uint8_t channels, + uint32_t rate) OVERRIDE; + virtual void OnIncomingSSRCChanged(int32_t id, + uint32_t ssrc) OVERRIDE; + virtual void OnIncomingCSRCChanged(int32_t id, + uint32_t CSRC, bool added) OVERRIDE; + virtual void ResetStatistics(uint32_t ssrc) OVERRIDE; // From RtcpFeedback in the RTP/RTCP module - void OnApplicationDataReceived(int32_t id, - uint8_t subType, - uint32_t name, - uint16_t length, - const uint8_t* data); + virtual void OnApplicationDataReceived(int32_t id, + uint8_t subType, + uint32_t name, + uint16_t length, + const uint8_t* data) OVERRIDE; // From RtpAudioFeedback in the RTP/RTCP module - void OnReceivedTelephoneEvent(int32_t id, - uint8_t event, - bool endOfEvent); - - void OnPlayTelephoneEvent(int32_t id, - uint8_t event, - uint16_t lengthMs, - uint8_t volume); + virtual void OnPlayTelephoneEvent(int32_t id, + uint8_t event, + uint16_t lengthMs, + uint8_t volume) OVERRIDE; // From Transport (called by the RTP/RTCP module) - int SendPacket(int /*channel*/, const void *data, int len); - int SendRTCPPacket(int /*channel*/, const void *data, int len); + virtual int SendPacket(int /*channel*/, const void *data, int len) OVERRIDE; + virtual int SendRTCPPacket(int /*channel*/, + const void *data, + int len) OVERRIDE; // From MixerParticipant - int32_t GetAudioFrame(int32_t id, AudioFrame& audioFrame); - int32_t NeededFrequency(int32_t id); - - // From MonitorObserver - void OnPeriodicProcess(); + virtual int32_t GetAudioFrame(int32_t id, AudioFrame& audioFrame) OVERRIDE; + virtual int32_t NeededFrequency(int32_t id) OVERRIDE; // From FileCallback - void PlayNotification(int32_t id, - uint32_t durationMs); - void RecordNotification(int32_t id, - uint32_t durationMs); - void PlayFileEnded(int32_t id); - void RecordFileEnded(int32_t id); + virtual void PlayNotification(int32_t id, uint32_t durationMs) OVERRIDE; + virtual void RecordNotification(int32_t id, uint32_t durationMs) OVERRIDE; + virtual void PlayFileEnded(int32_t id) OVERRIDE; + virtual void RecordFileEnded(int32_t id) OVERRIDE; uint32_t InstanceId() const { @@ -530,7 +516,6 @@ private: scoped_ptr mono_recording_audio_; // Downsamples to the codec rate if necessary. PushResampler input_resampler_; - uint8_t _audioLevel_dBov; FilePlayer* _inputFilePlayerPtr; FilePlayer* _outputFilePlayerPtr; FileRecorder* _outputFileRecorderPtr; @@ -582,7 +567,6 @@ private: int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise VoERTCPObserver* _rtcpObserverPtr; // VoEBase - bool _externalPlayout; bool _externalMixing; bool _mixFileWithMicrophone; bool _rtcpObserver; @@ -599,11 +583,6 @@ private: int8_t _lastPayloadType; bool _includeAudioLevelIndication; // VoENetwork - bool _rtpPacketTimedOut; - bool _rtpPacketTimeOutIsEnabled; - uint32_t _rtpTimeOutSeconds; - bool _connectionObserver; - VoEConnectionObserver* _connectionObserverPtr; AudioFrame::SpeechType _outputSpeechType; ViENetwork* vie_network_; int video_channel_; diff --git a/webrtc/voice_engine/include/mock/mock_voe_connection_observer.h b/webrtc/voice_engine/include/mock/mock_voe_connection_observer.h deleted file mode 100644 index 232c54f76..000000000 --- a/webrtc/voice_engine/include/mock/mock_voe_connection_observer.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2012 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. - */ - -#ifndef MOCK_VOE_CONNECTION_OBSERVER_H_ -#define MOCK_VOE_CONNECTION_OBSERVER_H_ - -#include "webrtc/voice_engine/include/voe_network.h" - -#include "testing/gmock/include/gmock/gmock.h" - -namespace webrtc { - -class MockVoeConnectionObserver : public VoEConnectionObserver { - public: - MOCK_METHOD2(OnPeriodicDeadOrAlive, void(int channel, - bool alive)); -}; - -} - -#endif // MOCK_VOE_CONNECTION_OBSERVER_H_ diff --git a/webrtc/voice_engine/include/voe_network.h b/webrtc/voice_engine/include/voe_network.h index 4c55f13f1..67429755a 100644 --- a/webrtc/voice_engine/include/voe_network.h +++ b/webrtc/voice_engine/include/voe_network.h @@ -40,19 +40,6 @@ namespace webrtc { class VoiceEngine; -// VoEConnectionObserver -class WEBRTC_DLLEXPORT VoEConnectionObserver -{ -public: - // This method will be called peridically and deliver dead-or-alive - // notifications for a specified |channel| when the observer interface - // has been installed and activated. - virtual void OnPeriodicDeadOrAlive(int channel, bool alive) = 0; - -protected: - virtual ~VoEConnectionObserver() {} -}; - // VoENetwork class WEBRTC_DLLEXPORT VoENetwork { diff --git a/webrtc/voice_engine/test/android/android_test/jni/android_test.cc b/webrtc/voice_engine/test/android/android_test/jni/android_test.cc index 6b97d49ca..2f04cc57a 100644 --- a/webrtc/voice_engine/test/android/android_test/jni/android_test.cc +++ b/webrtc/voice_engine/test/android/android_test/jni/android_test.cc @@ -139,8 +139,8 @@ class my_transportation : public Transport netw(network) { } - int SendPacket(int channel,const void *data,int len); - int SendRTCPPacket(int channel, const void *data, int len); + virtual int SendPacket(int channel,const void *data,int len) OVERRIDE; + virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE; private: VoENetwork * netw; }; diff --git a/webrtc/voice_engine/test/auto_test/fakes/fake_external_transport.h b/webrtc/voice_engine/test/auto_test/fakes/fake_external_transport.h index 6d2c8285b..318afdaf6 100644 --- a/webrtc/voice_engine/test/auto_test/fakes/fake_external_transport.h +++ b/webrtc/voice_engine/test/auto_test/fakes/fake_external_transport.h @@ -23,8 +23,10 @@ class FakeExternalTransport : public webrtc::Transport { public: explicit FakeExternalTransport(webrtc::VoENetwork* ptr); virtual ~FakeExternalTransport(); - int SendPacket(int channel, const void *data, int len); - int SendRTCPPacket(int channel, const void *data, int len); + + virtual int SendPacket(int channel, const void *data, int len) OVERRIDE; + virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE; + void SetDelayStatus(bool enabled, unsigned int delayInMs = 100); webrtc::VoENetwork* my_network_; diff --git a/webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h b/webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h index 7e01820fd..3b3878a77 100644 --- a/webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h +++ b/webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h @@ -35,12 +35,12 @@ class LoopBackTransport : public webrtc::Transport { ~LoopBackTransport() { thread_->Stop(); } - virtual int SendPacket(int channel, const void* data, int len) { + virtual int SendPacket(int channel, const void* data, int len) OVERRIDE { StorePacket(Packet::Rtp, channel, data, len); return len; } - virtual int SendRTCPPacket(int channel, const void* data, int len) { + virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE { StorePacket(Packet::Rtcp, channel, data, len); return len; } diff --git a/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_extensions.cc b/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_extensions.cc index a678b13ad..2fc117b67 100644 --- a/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_extensions.cc +++ b/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_extensions.cc @@ -29,7 +29,7 @@ class ExtensionVerifyTransport : public webrtc::Transport { audio_level_id_(-1), absolute_sender_time_id_(-1) {} - virtual int SendPacket(int channel, const void* data, int len) { + virtual int SendPacket(int channel, const void* data, int len) OVERRIDE { webrtc::RTPHeader header; if (parser_->Parse(reinterpret_cast(data), static_cast(len), @@ -54,7 +54,7 @@ class ExtensionVerifyTransport : public webrtc::Transport { return len; } - virtual int SendRTCPPacket(int channel, const void* data, int len) { + virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE { return len; } @@ -93,12 +93,12 @@ class ExtensionVerifyTransport : public webrtc::Transport { class SendRtpRtcpHeaderExtensionsTest : public BeforeStreamingFixture { protected: - virtual void SetUp() { + virtual void SetUp() OVERRIDE { EXPECT_EQ(0, voe_network_->DeRegisterExternalTransport(channel_)); EXPECT_EQ(0, voe_network_->RegisterExternalTransport(channel_, verifying_transport_)); } - virtual void TearDown() { + virtual void TearDown() OVERRIDE { PausePlaying(); } @@ -176,7 +176,7 @@ class MockViENetwork : public webrtc::ViENetwork { class ReceiveRtpRtcpHeaderExtensionsTest : public BeforeStreamingFixture { protected: - virtual void SetUp() { + virtual void SetUp() OVERRIDE { EXPECT_EQ(0, voe_rtp_rtcp_->SetSendAbsoluteSenderTimeStatus(channel_, true, 11)); EXPECT_EQ(0, diff --git a/webrtc/voice_engine/test/win_test/WinTestDlg.cc b/webrtc/voice_engine/test/win_test/WinTestDlg.cc index 8b45e2748..4929ae4af 100644 --- a/webrtc/voice_engine/test/win_test/WinTestDlg.cc +++ b/webrtc/voice_engine/test/win_test/WinTestDlg.cc @@ -53,28 +53,6 @@ char* TcharToChar(TCHAR* str, int len) #endif } -// ---------------------------------------------------------------------------- -// VoEConnectionObserver -// ---------------------------------------------------------------------------- - -class ConnectionObserver : public VoEConnectionObserver -{ -public: - ConnectionObserver(); - virtual void OnPeriodicDeadOrAlive(int channel, bool alive); -}; - -ConnectionObserver::ConnectionObserver() -{ -} - -void ConnectionObserver::OnPeriodicDeadOrAlive(int channel, bool alive) -{ - CString str; - str.Format(_T("OnPeriodicDeadOrAlive(channel=%d) => alive=%d"), channel, alive); - OutputDebugString(str); -} - // ---------------------------------------------------------------------------- // VoiceEngineObserver // ---------------------------------------------------------------------------- @@ -151,8 +129,8 @@ class MyTransport : public Transport { public: MyTransport(VoENetwork* veNetwork); - virtual int SendPacket(int channel, const void *data, int len); - virtual int SendRTCPPacket(int channel, const void *data, int len); + virtual int SendPacket(int channel, const void *data, int len) OVERRIDE; + virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE; private: VoENetwork* _veNetworkPtr; }; @@ -1115,7 +1093,6 @@ CWinTestDlg::CWinTestDlg(CWnd* pParent /*=NULL*/) _veRtpRtcpPtr = VoERTP_RTCP::GetInterface(_vePtr); _transportPtr = new MyTransport(_veNetworkPtr); _externalMediaPtr = new MediaProcessImpl(); - _connectionObserverPtr = new ConnectionObserver(); _rxVadObserverPtr = new RxCallback(); } @@ -1131,7 +1108,6 @@ CWinTestDlg::CWinTestDlg(CWnd* pParent /*=NULL*/) CWinTestDlg::~CWinTestDlg() { - if (_connectionObserverPtr) delete _connectionObserverPtr; if (_externalMediaPtr) delete _externalMediaPtr; if (_transportPtr) delete _transportPtr; if (_rxVadObserverPtr) delete _rxVadObserverPtr; diff --git a/webrtc/voice_engine/test/win_test/WinTestDlg.h b/webrtc/voice_engine/test/win_test/WinTestDlg.h index c53c3cf77..a77988096 100644 --- a/webrtc/voice_engine/test/win_test/WinTestDlg.h +++ b/webrtc/voice_engine/test/win_test/WinTestDlg.h @@ -96,7 +96,6 @@ #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" class MediaProcessImpl; -class ConnectionObserver; class RxCallback; class MyTransport; @@ -161,7 +160,6 @@ private: MyTransport* _transportPtr; MediaProcessImpl* _externalMediaPtr; - ConnectionObserver* _connectionObserverPtr; RxCallback* _rxVadObserverPtr; private: