From cc774a69cb0c1fcd5f9f4c77388e9d6190434350 Mon Sep 17 00:00:00 2001 From: "henrike@webrtc.org" Date: Thu, 11 Sep 2014 22:45:54 +0000 Subject: [PATCH] Mark all virtual overrides in the hierarchies of RtpDump and VCMPacketizationCallback as such. This will make further changes to these classes safer by ensuring that the compile breaks if the base class changes and not all overrides are fixed. This also marks all other such overrides in the affected files. BUG=none TEST=none R=henrike@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/19319004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7161 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/utility/source/rtp_dump_impl.h | 9 +++--- webrtc/modules/utility/source/video_coder.h | 6 ++-- .../main/source/video_sender_unittest.cc | 15 ++++++---- .../video_coding/main/test/normal_test.h | 22 +++++++------- webrtc/video_engine/vie_encoder.h | 30 ++++++++++--------- 5 files changed, 45 insertions(+), 37 deletions(-) diff --git a/webrtc/modules/utility/source/rtp_dump_impl.h b/webrtc/modules/utility/source/rtp_dump_impl.h index ff3f07cec..0b721322e 100644 --- a/webrtc/modules/utility/source/rtp_dump_impl.h +++ b/webrtc/modules/utility/source/rtp_dump_impl.h @@ -22,10 +22,11 @@ public: RtpDumpImpl(); virtual ~RtpDumpImpl(); - virtual int32_t Start(const char* fileNameUTF8); - virtual int32_t Stop(); - virtual bool IsActive() const; - virtual int32_t DumpPacket(const uint8_t* packet, uint16_t packetLength); + virtual int32_t Start(const char* fileNameUTF8) OVERRIDE; + virtual int32_t Stop() OVERRIDE; + virtual bool IsActive() const OVERRIDE; + virtual int32_t DumpPacket(const uint8_t* packet, + uint16_t packetLength) OVERRIDE; private: // Return the system time in ms. inline uint32_t GetTimeInMS() const; diff --git a/webrtc/modules/utility/source/video_coder.h b/webrtc/modules/utility/source/video_coder.h index 8e4344be1..03aa51114 100644 --- a/webrtc/modules/utility/source/video_coder.h +++ b/webrtc/modules/utility/source/video_coder.h @@ -43,11 +43,11 @@ public: private: // VCMReceiveCallback function. // Note: called by VideoCodingModule when decoding finished. - int32_t FrameToRender(I420VideoFrame& videoFrame); + virtual int32_t FrameToRender(I420VideoFrame& videoFrame) OVERRIDE; // VCMPacketizationCallback function. // Note: called by VideoCodingModule when encoding finished. - int32_t SendData( + virtual int32_t SendData( FrameType /*frameType*/, uint8_t /*payloadType*/, uint32_t /*timeStamp*/, @@ -55,7 +55,7 @@ private: const uint8_t* payloadData, uint32_t payloadSize, const RTPFragmentationHeader& /* fragmentationHeader*/, - const RTPVideoHeader* rtpTypeHdr); + const RTPVideoHeader* rtpTypeHdr) OVERRIDE; VideoCodingModule* _vcm; I420VideoFrame* _decodedVideo; diff --git a/webrtc/modules/video_coding/main/source/video_sender_unittest.cc b/webrtc/modules/video_coding/main/source/video_sender_unittest.cc index 0b8193b21..6bc8b80d8 100644 --- a/webrtc/modules/video_coding/main/source/video_sender_unittest.cc +++ b/webrtc/modules/video_coding/main/source/video_sender_unittest.cc @@ -70,7 +70,10 @@ MATCHER_P(MatchesVp8StreamInfo, expected, "") { class EmptyFrameGenerator : public FrameGenerator { public: - I420VideoFrame* NextFrame() OVERRIDE { frame_.ResetSize(); return &frame_; } + virtual I420VideoFrame* NextFrame() OVERRIDE { + frame_.ResetSize(); + return &frame_; + } private: I420VideoFrame frame_; @@ -90,7 +93,7 @@ class PacketizationCallback : public VCMPacketizationCallback { const uint8_t* payload_data, uint32_t payload_size, const RTPFragmentationHeader& fragmentation_header, - const RTPVideoHeader* rtp_video_header) { + const RTPVideoHeader* rtp_video_header) OVERRIDE { assert(rtp_video_header); frame_data_.push_back(FrameData(payload_size, *rtp_video_header)); return 0; @@ -172,7 +175,7 @@ class TestVideoSender : public ::testing::Test { // a special case (e.g. frame rate in media optimization). TestVideoSender() : clock_(1000), packetization_callback_(&clock_) {} - virtual void SetUp() { + virtual void SetUp() OVERRIDE { sender_.reset(new VideoSender(&clock_, &post_encode_callback_)); EXPECT_EQ(0, sender_->InitializeSender()); EXPECT_EQ(0, sender_->RegisterTransportCallback(&packetization_callback_)); @@ -198,7 +201,7 @@ class TestVideoSenderWithMockEncoder : public TestVideoSender { static const int kNumberOfLayers = 3; static const int kUnusedPayloadType = 10; - virtual void SetUp() { + virtual void SetUp() OVERRIDE { TestVideoSender::SetUp(); generator_.reset(new EmptyFrameGenerator()); EXPECT_EQ( @@ -221,7 +224,7 @@ class TestVideoSenderWithMockEncoder : public TestVideoSender { EXPECT_EQ(0, sender_->RegisterSendCodec(&settings_, 1, 1200)); } - virtual void TearDown() { sender_.reset(); } + virtual void TearDown() OVERRIDE { sender_.reset(); } void ExpectIntraRequest(int stream) { if (stream == -1) { @@ -314,7 +317,7 @@ class TestVideoSenderWithVp8 : public TestVideoSender { TestVideoSenderWithVp8() : codec_bitrate_kbps_(300), available_bitrate_kbps_(1000) {} - virtual void SetUp() { + virtual void SetUp() OVERRIDE { TestVideoSender::SetUp(); const char* input_video = "foreman_cif"; diff --git a/webrtc/modules/video_coding/main/test/normal_test.h b/webrtc/modules/video_coding/main/test/normal_test.h index 28a37c457..63e66b323 100644 --- a/webrtc/modules/video_coding/main/test/normal_test.h +++ b/webrtc/modules/video_coding/main/test/normal_test.h @@ -32,15 +32,15 @@ class VCMNTEncodeCompleteCallback : public webrtc::VCMPacketizationCallback void RegisterTransportCallback(webrtc::VCMPacketizationCallback* transport); // process encoded data received from the encoder, // pass stream to the VCMReceiver module - int32_t - SendData(const webrtc::FrameType frameType, - const uint8_t payloadType, - const 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, + const 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; // Register exisitng VCM. // Currently - encode and decode with the same vcm module. @@ -73,8 +73,10 @@ public: _currentHeight(0) {} virtual ~VCMNTDecodeCompleCallback(); void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback); + // will 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; diff --git a/webrtc/video_engine/vie_encoder.h b/webrtc/video_engine/vie_encoder.h index 781e27029..e2e691e05 100644 --- a/webrtc/video_engine/vie_encoder.h +++ b/webrtc/video_engine/vie_encoder.h @@ -96,13 +96,13 @@ class ViEEncoder virtual void DeliverFrame(int id, I420VideoFrame* video_frame, int num_csrcs = 0, - const uint32_t CSRC[kRtpCsrcSize] = NULL); - virtual void DelayChanged(int id, int frame_delay); + const uint32_t CSRC[kRtpCsrcSize] = NULL) OVERRIDE; + virtual void DelayChanged(int id, int frame_delay) OVERRIDE; virtual int GetPreferedFrameSettings(int* width, int* height, - int* frame_rate); + int* frame_rate) OVERRIDE; - virtual void ProviderDestroyed(int id) { + virtual void ProviderDestroyed(int id) OVERRIDE { return; } @@ -129,7 +129,7 @@ class ViEEncoder const uint8_t* payload_data, uint32_t payload_size, const RTPFragmentationHeader& fragmentation_header, - const RTPVideoHeader* rtp_video_hdr); + const RTPVideoHeader* rtp_video_hdr) OVERRIDE; // Implements VideoProtectionCallback. virtual int ProtectionRequest( @@ -137,18 +137,20 @@ class ViEEncoder 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; // Implements VideoSendStatisticsCallback. virtual int32_t SendStatistics(const uint32_t bit_rate, - const uint32_t frame_rate); + const uint32_t frame_rate) OVERRIDE; + int32_t RegisterCodecObserver(ViEEncoderObserver* observer); // Implements RtcpIntraFrameObserver. - virtual void OnReceivedIntraFrameRequest(uint32_t ssrc); - virtual void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id); - virtual void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id); - virtual void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc); + virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) OVERRIDE; + virtual void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) OVERRIDE; + virtual void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) OVERRIDE; + virtual void OnLocalSsrcChanged(uint32_t old_ssrc, + uint32_t new_ssrc) OVERRIDE; // Sets SSRCs for all streams. bool SetSsrcs(const std::list& ssrcs); @@ -159,15 +161,15 @@ class ViEEncoder int32_t RegisterEffectFilter(ViEEffectFilter* effect_filter); // Enables recording of debugging information. - virtual int StartDebugRecording(const char* fileNameUTF8); + int StartDebugRecording(const char* fileNameUTF8); // Disables recording of debugging information. - virtual int StopDebugRecording(); + int StopDebugRecording(); // Lets the sender suspend video when the rate drops below // |threshold_bps|, and turns back on when the rate goes back up above // |threshold_bps| + |window_bps|. - virtual void SuspendBelowMinBitrate(); + void SuspendBelowMinBitrate(); // New-style callbacks, used by VideoSendStream. void RegisterPreEncodeCallback(I420FrameCallback* pre_encode_callback);