From ab2610ffd97c936b3eb3cc75f4ccf363e9c88511 Mon Sep 17 00:00:00 2001 From: "mflodman@webrtc.org" Date: Fri, 29 Jun 2012 10:05:28 +0000 Subject: [PATCH] Removed the last lint warnings in video_engine. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/670006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2468 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/video_engine/stream_synchronization.h | 2 +- src/video_engine/vie_base_impl.cc | 4 +-- src/video_engine/vie_channel_manager.cc | 33 +++++++-------------- src/video_engine/vie_channel_manager.h | 19 +++++------- src/video_engine/vie_frame_provider_base.cc | 1 - src/video_engine/vie_remb_unittest.cc | 28 +++++++---------- src/video_engine/vie_shared_data.cc | 20 ++++++------- src/video_engine/vie_sync_module.cc | 12 ++++---- 8 files changed, 47 insertions(+), 72 deletions(-) diff --git a/src/video_engine/stream_synchronization.h b/src/video_engine/stream_synchronization.h index 5a88383ab..6da592165 100644 --- a/src/video_engine/stream_synchronization.h +++ b/src/video_engine/stream_synchronization.h @@ -11,7 +11,7 @@ #ifndef WEBRTC_VIDEO_ENGINE_STREAM_SYNCHRONIZATION_H_ #define WEBRTC_VIDEO_ENGINE_STREAM_SYNCHRONIZATION_H_ -#include "typedefs.h" +#include "typedefs.h" // NOLINT namespace webrtc { diff --git a/src/video_engine/vie_base_impl.cc b/src/video_engine/vie_base_impl.cc index a90d02bb5..744e9a1be 100644 --- a/src/video_engine/vie_base_impl.cc +++ b/src/video_engine/vie_base_impl.cc @@ -113,7 +113,7 @@ int ViEBaseImpl::CreateChannel(int& video_channel) { // NOLINT return -1; } - if (shared_data_.channel_manager()->CreateChannel(video_channel) == -1) { + if (shared_data_.channel_manager()->CreateChannel(&video_channel) == -1) { WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_.instance_id()), "%s: Could not create channel", __FUNCTION__); video_channel = -1; @@ -439,7 +439,7 @@ int ViEBaseImpl::CreateChannel(int& video_channel, // NOLINT return -1; } - if (shared_data_.channel_manager()->CreateChannel(video_channel, + if (shared_data_.channel_manager()->CreateChannel(&video_channel, original_channel, sender) == -1) { WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_.instance_id()), diff --git a/src/video_engine/vie_channel_manager.cc b/src/video_engine/vie_channel_manager.cc index 6769a82f3..e29fadc4e 100644 --- a/src/video_engine/vie_channel_manager.cc +++ b/src/video_engine/vie_channel_manager.cc @@ -10,7 +10,7 @@ #include "video_engine/vie_channel_manager.h" -#include "engine_configurations.h" +#include "engine_configurations.h" // NOLINT #include "modules/rtp_rtcp/interface/rtp_rtcp.h" #include "modules/utility/interface/process_thread.h" #include "system_wrappers/interface/critical_section_wrapper.h" @@ -27,7 +27,7 @@ namespace webrtc { ViEChannelManager::ViEChannelManager( int engine_id, int number_of_cores, - ViEPerformanceMonitor& vie_performance_monitor, + ViEPerformanceMonitor* vie_performance_monitor, const OverUseDetectorOptions& options) : channel_id_critsect_(CriticalSectionWrapper::CreateCriticalSection()), engine_id_(engine_id), @@ -74,12 +74,12 @@ ViEChannelManager::~ViEChannelManager() { } void ViEChannelManager::SetModuleProcessThread( - ProcessThread& module_process_thread) { + ProcessThread* module_process_thread) { assert(!module_process_thread_); - module_process_thread_ = &module_process_thread; + module_process_thread_ = module_process_thread; } -int ViEChannelManager::CreateChannel(int& channel_id) { +int ViEChannelManager::CreateChannel(int* channel_id) { CriticalSectionScoped cs(*channel_id_critsect_); // Get a new channel id. @@ -112,13 +112,13 @@ int ViEChannelManager::CreateChannel(int& channel_id) { return -1; } - channel_id = new_channel_id; - group->AddChannel(channel_id); + *channel_id = new_channel_id; + group->AddChannel(*channel_id); channel_groups_.push_back(group); return 0; } -int ViEChannelManager::CreateChannel(int& channel_id, +int ViEChannelManager::CreateChannel(int* channel_id, int original_channel, bool sender) { CriticalSectionScoped cs(*channel_id_critsect_); @@ -167,8 +167,8 @@ int ViEChannelManager::CreateChannel(int& channel_id, return -1; } - channel_id = new_channel_id; - channel_group->AddChannel(channel_id); + *channel_id = new_channel_id; + channel_group->AddChannel(*channel_id); return 0; } @@ -371,19 +371,6 @@ ViEChannel* ViEChannelManager::ViEChannelPtr(int channel_id) const { return it->second; } -void ViEChannelManager::GetViEChannels(MapWrapper& channel_map) { - CriticalSectionScoped cs(*channel_id_critsect_); - if (channel_map.Size() == 0) { - return; - } - - // Add all items to 'channelMap'. - for (ChannelMap::iterator it = channel_map_.begin(); it != channel_map_.end(); - ++it) { - channel_map.Insert(it->first, it->second); - } -} - ViEEncoder* ViEChannelManager::ViEEncoderPtr(int video_channel_id) const { CriticalSectionScoped cs(*channel_id_critsect_); EncoderMap::const_iterator it = vie_encoder_map_.find(video_channel_id); diff --git a/src/video_engine/vie_channel_manager.h b/src/video_engine/vie_channel_manager.h index c2a06507a..d0a5d57e2 100644 --- a/src/video_engine/vie_channel_manager.h +++ b/src/video_engine/vie_channel_manager.h @@ -14,9 +14,9 @@ #include #include -#include "engine_configurations.h" +#include "engine_configurations.h" // NOLINT #include "system_wrappers/interface/scoped_ptr.h" -#include "typedefs.h" +#include "typedefs.h" // NOLINT #include "video_engine/vie_channel_group.h" #include "video_engine/vie_defines.h" #include "video_engine/vie_manager_base.h" @@ -43,19 +43,19 @@ class ViEChannelManager: private ViEManagerBase { public: ViEChannelManager(int engine_id, int number_of_cores, - ViEPerformanceMonitor& vie_performance_monitor, + ViEPerformanceMonitor* vie_performance_monitor, const OverUseDetectorOptions& options); ~ViEChannelManager(); - void SetModuleProcessThread(ProcessThread& module_process_thread); + void SetModuleProcessThread(ProcessThread* module_process_thread); - // Creates a new channel. 'channelId' will be the id of the created channel. - int CreateChannel(int& channel_id); + // Creates a new channel. 'channel_id' will be the id of the created channel. + int CreateChannel(int* channel_id); // Creates a new channel grouped with |original_channel|. The new channel // will get its own |ViEEncoder| if |sender| is set to true. It will be a // receive only channel, without an own |ViEEncoder| if |sender| is false. - int CreateChannel(int& channel_id, int original_channel, bool sender); + int CreateChannel(int* channel_id, int original_channel, bool sender); // Deletes a channel. int DeleteChannel(int channel_id); @@ -82,12 +82,9 @@ class ViEChannelManager: private ViEManagerBase { RemoteBitrateEstimator* remote_bitrate_estimator); // Used by ViEChannelScoped, forcing a manager user to use scoped. - // Returns a pointer to the channel with id 'channelId'. + // Returns a pointer to the channel with id 'channel_id'. ViEChannel* ViEChannelPtr(int channel_id) const; - // Adds all channels to channel_map. - void GetViEChannels(MapWrapper& channel_map); - // Methods used by ViECaptureScoped and ViEEncoderScoped. // Gets the ViEEncoder used as input for video_channel_id ViEEncoder* ViEEncoderPtr(int video_channel_id) const; diff --git a/src/video_engine/vie_frame_provider_base.cc b/src/video_engine/vie_frame_provider_base.cc index 005cd9b3e..134f5c340 100644 --- a/src/video_engine/vie_frame_provider_base.cc +++ b/src/video_engine/vie_frame_provider_base.cc @@ -193,5 +193,4 @@ int ViEFrameProviderBase::NumberOfRegisteredFrameCallbacks() { CriticalSectionScoped cs(provider_cs_.get()); return frame_callbacks_.size(); } - } // namespac webrtc diff --git a/src/video_engine/vie_remb_unittest.cc b/src/video_engine/vie_remb_unittest.cc index 83723af63..f48a988d9 100644 --- a/src/video_engine/vie_remb_unittest.cc +++ b/src/video_engine/vie_remb_unittest.cc @@ -49,8 +49,7 @@ class ViERembTest : public ::testing::Test { scoped_ptr vie_remb_; }; -TEST_F(ViERembTest, OneModuleTestForSendingRemb) -{ +TEST_F(ViERembTest, OneModuleTestForSendingRemb) { MockRtpRtcp rtp; vie_remb_->AddReceiveChannel(&rtp); vie_remb_->AddRembSender(&rtp); @@ -78,8 +77,7 @@ TEST_F(ViERembTest, OneModuleTestForSendingRemb) vie_remb_->RemoveRembSender(&rtp); } -TEST_F(ViERembTest, LowerEstimateToSendRemb) -{ +TEST_F(ViERembTest, LowerEstimateToSendRemb) { MockRtpRtcp rtp; vie_remb_->AddReceiveChannel(&rtp); vie_remb_->AddRembSender(&rtp); @@ -100,8 +98,7 @@ TEST_F(ViERembTest, LowerEstimateToSendRemb) vie_remb_->Process(); } -TEST_F(ViERembTest, VerifyCombinedBitrateEstimate) -{ +TEST_F(ViERembTest, VerifyCombinedBitrateEstimate) { MockRtpRtcp rtp_0; MockRtpRtcp rtp_1; vie_remb_->AddReceiveChannel(&rtp_0); @@ -133,8 +130,7 @@ TEST_F(ViERembTest, VerifyCombinedBitrateEstimate) vie_remb_->RemoveReceiveChannel(&rtp_1); } -TEST_F(ViERembTest, NoRembForIncreasedBitrate) -{ +TEST_F(ViERembTest, NoRembForIncreasedBitrate) { MockRtpRtcp rtp_0; MockRtpRtcp rtp_1; vie_remb_->AddReceiveChannel(&rtp_0); @@ -170,8 +166,8 @@ TEST_F(ViERembTest, NoRembForIncreasedBitrate) // Decresing the estimate less than 3% shouldn't trigger a new callback. int lower_estimate = bitrate_estimate[0] * 98 / 100; vie_remb_->OnReceiveBitrateChanged(ssrc[0], lower_estimate); - EXPECT_CALL(rtp_0, SetREMBData(_, _, _)) - .Times(0); + EXPECT_CALL(rtp_0, SetREMBData(_, _, _)) + .Times(0); vie_remb_->Process(); vie_remb_->RemoveReceiveChannel(&rtp_1); @@ -179,8 +175,7 @@ TEST_F(ViERembTest, NoRembForIncreasedBitrate) vie_remb_->RemoveRembSender(&rtp_0); } -TEST_F(ViERembTest, ChangeSendRtpModule) -{ +TEST_F(ViERembTest, ChangeSendRtpModule) { MockRtpRtcp rtp_0; MockRtpRtcp rtp_1; vie_remb_->AddReceiveChannel(&rtp_0); @@ -225,8 +220,7 @@ TEST_F(ViERembTest, ChangeSendRtpModule) vie_remb_->RemoveReceiveChannel(&rtp_1); } -TEST_F(ViERembTest, OnlyOneRembForDoubleProcess) -{ +TEST_F(ViERembTest, OnlyOneRembForDoubleProcess) { MockRtpRtcp rtp; unsigned int bitrate_estimate = 456; unsigned int ssrc[] = { 1234 }; @@ -252,8 +246,7 @@ TEST_F(ViERembTest, OnlyOneRembForDoubleProcess) vie_remb_->RemoveRembSender(&rtp); } -TEST_F(ViERembTest, NoOnReceivedBitrateChangedCall) -{ +TEST_F(ViERembTest, NoOnReceivedBitrateChangedCall) { MockRtpRtcp rtp; EXPECT_CALL(rtp, RemoteSSRC()) .WillRepeatedly(Return(1234)); @@ -273,8 +266,7 @@ TEST_F(ViERembTest, NoOnReceivedBitrateChangedCall) // Only register receiving modules and make sure we fallback to trigger a REMB // packet on this one. -TEST_F(ViERembTest, NoSendingRtpModule) -{ +TEST_F(ViERembTest, NoSendingRtpModule) { MockRtpRtcp rtp; vie_remb_->AddReceiveChannel(&rtp); diff --git a/src/video_engine/vie_shared_data.cc b/src/video_engine/vie_shared_data.cc index 6dd610bb9..a39557892 100644 --- a/src/video_engine/vie_shared_data.cc +++ b/src/video_engine/vie_shared_data.cc @@ -8,14 +8,14 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "cpu_info.h" -#include "process_thread.h" -#include "trace.h" -#include "vie_channel_manager.h" -#include "vie_defines.h" -#include "vie_input_manager.h" -#include "vie_render_manager.h" -#include "vie_shared_data.h" +#include "modules/utility/interface/process_thread.h" +#include "system_wrappers/interface/cpu_info.h" +#include "system_wrappers/interface/trace.h" +#include "video_engine/vie_channel_manager.h" +#include "video_engine/vie_defines.h" +#include "video_engine/vie_input_manager.h" +#include "video_engine/vie_render_manager.h" +#include "video_engine/vie_shared_data.h" namespace webrtc { @@ -29,14 +29,14 @@ ViESharedData::ViESharedData() over_use_detector_options_(), vie_performance_monitor_(ViEPerformanceMonitor(instance_id_)), channel_manager_(*new ViEChannelManager(instance_id_, number_cores_, - vie_performance_monitor_, + &vie_performance_monitor_, over_use_detector_options_)), input_manager_(*new ViEInputManager(instance_id_)), render_manager_(*new ViERenderManager(instance_id_)), module_process_thread_(ProcessThread::CreateProcessThread()), last_error_(0) { Trace::CreateTrace(); - channel_manager_.SetModuleProcessThread(*module_process_thread_); + channel_manager_.SetModuleProcessThread(module_process_thread_); input_manager_.SetModuleProcessThread(module_process_thread_); module_process_thread_->Start(); } diff --git a/src/video_engine/vie_sync_module.cc b/src/video_engine/vie_sync_module.cc index 01aa5d22e..84752a9bd 100644 --- a/src/video_engine/vie_sync_module.cc +++ b/src/video_engine/vie_sync_module.cc @@ -8,14 +8,14 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "vie_sync_module.h" +#include "video_engine/vie_sync_module.h" -#include "critical_section_wrapper.h" -#include "rtp_rtcp.h" -#include "trace.h" -#include "video_coding.h" -#include "voe_video_sync.h" +#include "modules/rtp_rtcp/interface/rtp_rtcp.h" +#include "modules/video_coding/main/interface/video_coding.h" +#include "system_wrappers/interface/critical_section_wrapper.h" +#include "system_wrappers/interface/trace.h" #include "video_engine/stream_synchronization.h" +#include "voice_engine/main/interface/voe_video_sync.h" namespace webrtc {