diff options
author | mikhal@chromium.org <mikhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-11 21:09:24 +0000 |
---|---|---|
committer | mikhal@chromium.org <mikhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-11 21:09:24 +0000 |
commit | e274e3478916e9f9202f77a265fbae945000799b (patch) | |
tree | c0f36a321c1796ba57f79ba41afbf9b3e19903d4 /media | |
parent | d59c871f7539b6eca037fd0c0ce07235186b1028 (diff) | |
download | chromium_src-e274e3478916e9f9202f77a265fbae945000799b.zip chromium_src-e274e3478916e9f9202f77a265fbae945000799b.tar.gz chromium_src-e274e3478916e9f9202f77a265fbae945000799b.tar.bz2 |
Cast: Refactoring Cast to Clang format
This cl is pure style-targeted refactoring.
No functional changes were made.
BUG=339176
Review URL: https://codereview.chromium.org/159413002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250503 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/cast/cast_config.cc | 10 | ||||
-rw-r--r-- | media/cast/cast_config.h | 6 | ||||
-rw-r--r-- | media/cast/cast_defines.h | 21 | ||||
-rw-r--r-- | media/cast/cast_environment.cc | 17 | ||||
-rw-r--r-- | media/cast/cast_receiver.h | 9 | ||||
-rw-r--r-- | media/cast/cast_receiver_impl.cc | 76 | ||||
-rw-r--r-- | media/cast/cast_receiver_impl.h | 2 | ||||
-rw-r--r-- | media/cast/cast_sender_impl.h | 2 |
8 files changed, 79 insertions, 64 deletions
diff --git a/media/cast/cast_config.cc b/media/cast/cast_config.cc index 55a3352..59655cf 100644 --- a/media/cast/cast_config.cc +++ b/media/cast/cast_config.cc @@ -22,8 +22,14 @@ VideoSenderConfig::VideoSenderConfig() max_number_of_video_buffers_used(kDefaultNumberOfVideoBuffers) {} AudioSenderConfig::AudioSenderConfig() - : rtcp_interval(kDefaultRtcpIntervalMs), - use_external_encoder(false) {} + : sender_ssrc(0), + incoming_feedback_ssrc(0), + rtcp_interval(kDefaultRtcpIntervalMs), + rtcp_mode(kRtcpReducedSize), + use_external_encoder(false), + frequency(0), + channels(0), + bitrate(0) {} AudioReceiverConfig::AudioReceiverConfig() : feedback_ssrc(0), diff --git a/media/cast/cast_config.h b/media/cast/cast_config.h index 33dfc22..61e9620 100644 --- a/media/cast/cast_config.h +++ b/media/cast/cast_config.h @@ -19,7 +19,7 @@ namespace media { namespace cast { enum RtcpMode { - kRtcpCompound, // Compound RTCP mode is described by RFC 4585. + kRtcpCompound, // Compound RTCP mode is described by RFC 4585. kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506. }; @@ -89,7 +89,7 @@ struct AudioReceiverConfig { int channels; transport::AudioCodec codec; - std::string aes_key; // Binary string of size kAesKeySize. + std::string aes_key; // Binary string of size kAesKeySize. std::string aes_iv_mask; // Binary string of size kAesKeySize. }; @@ -115,7 +115,7 @@ struct VideoReceiverConfig { bool decoder_faster_than_max_frame_rate; transport::VideoCodec codec; - std::string aes_key; // Binary string of size kAesKeySize. + std::string aes_key; // Binary string of size kAesKeySize. std::string aes_iv_mask; // Binary string of size kAesKeySize. }; diff --git a/media/cast/cast_defines.h b/media/cast/cast_defines.h index b8a7d95..fbae740 100644 --- a/media/cast/cast_defines.h +++ b/media/cast/cast_defines.h @@ -74,12 +74,12 @@ static const double kMagicFractionalUnit = 4.294967296E3; inline bool IsNewerFrameId(uint32 frame_id, uint32 prev_frame_id) { return (frame_id != prev_frame_id) && - static_cast<uint32>(frame_id - prev_frame_id) < 0x80000000; + static_cast<uint32>(frame_id - prev_frame_id) < 0x80000000; } inline bool IsNewerRtpTimestamp(uint32 timestamp, uint32 prev_timestamp) { return (timestamp != prev_timestamp) && - static_cast<uint32>(timestamp - prev_timestamp) < 0x80000000; + static_cast<uint32>(timestamp - prev_timestamp) < 0x80000000; } inline bool IsOlderFrameId(uint32 frame_id, uint32 prev_frame_id) { @@ -88,7 +88,7 @@ inline bool IsOlderFrameId(uint32 frame_id, uint32 prev_frame_id) { inline bool IsNewerPacketId(uint16 packet_id, uint16 prev_packet_id) { return (packet_id != prev_packet_id) && - static_cast<uint16>(packet_id - prev_packet_id) < 0x8000; + static_cast<uint16>(packet_id - prev_packet_id) < 0x8000; } inline bool IsNewerSequenceNumber(uint16 sequence_number, @@ -126,7 +126,8 @@ inline void ConvertTimeTicksToNtp(const base::TimeTicks& time, base::TimeDelta elapsed_since_unix_epoch = time - base::TimeTicks::UnixEpoch(); - int64 ntp_time_us = elapsed_since_unix_epoch.InMicroseconds() + + int64 ntp_time_us = + elapsed_since_unix_epoch.InMicroseconds() + (kUnixEpochInNtpSeconds * base::Time::kMicrosecondsPerSecond); ConvertTimeToFractions(ntp_time_us, ntp_seconds, ntp_fractions); @@ -134,13 +135,13 @@ inline void ConvertTimeTicksToNtp(const base::TimeTicks& time, inline base::TimeTicks ConvertNtpToTimeTicks(uint32 ntp_seconds, uint32 ntp_fractions) { - int64 ntp_time_us = static_cast<int64>(ntp_seconds) * - base::Time::kMicrosecondsPerSecond + - static_cast<int64>(ntp_fractions) / kMagicFractionalUnit; + int64 ntp_time_us = + static_cast<int64>(ntp_seconds) * base::Time::kMicrosecondsPerSecond + + static_cast<int64>(ntp_fractions) / kMagicFractionalUnit; - base::TimeDelta elapsed_since_unix_epoch = - base::TimeDelta::FromMicroseconds(ntp_time_us - - (kUnixEpochInNtpSeconds * base::Time::kMicrosecondsPerSecond)); + base::TimeDelta elapsed_since_unix_epoch = base::TimeDelta::FromMicroseconds( + ntp_time_us - + (kUnixEpochInNtpSeconds * base::Time::kMicrosecondsPerSecond)); return base::TimeTicks::UnixEpoch() + elapsed_since_unix_epoch; } diff --git a/media/cast/cast_environment.cc b/media/cast/cast_environment.cc index 8efd6e6..9b1a569 100644 --- a/media/cast/cast_environment.cc +++ b/media/cast/cast_environment.cc @@ -61,10 +61,11 @@ bool CastEnvironment::PostTask(ThreadId identifier, return task_runner->PostTask(from_here, task); } -bool CastEnvironment::PostDelayedTask(ThreadId identifier, - const tracked_objects::Location& from_here, - const base::Closure& task, - base::TimeDelta delay) { +bool CastEnvironment::PostDelayedTask( + ThreadId identifier, + const tracked_objects::Location& from_here, + const base::Closure& task, + base::TimeDelta delay) { scoped_refptr<SingleThreadTaskRunner> task_runner = GetMessageSingleThreadTaskRunnerForThread(identifier); @@ -113,13 +114,11 @@ bool CastEnvironment::CurrentlyOn(ThreadId identifier) { } } -base::TickClock* CastEnvironment::Clock() const { - return clock_.get(); -} +base::TickClock* CastEnvironment::Clock() const { return clock_.get(); } LoggingImpl* CastEnvironment::Logging() { - DCHECK(CurrentlyOn(CastEnvironment::MAIN)) << - "Must be called from main thread"; + DCHECK(CurrentlyOn(CastEnvironment::MAIN)) + << "Must be called from main thread"; return logging_.get(); } diff --git a/media/cast/cast_receiver.h b/media/cast/cast_receiver.h index bb0d132..ec4f0d3 100644 --- a/media/cast/cast_receiver.h +++ b/media/cast/cast_receiver.h @@ -32,17 +32,16 @@ typedef base::Callback<void(scoped_ptr<PcmAudioFrame>, const base::TimeTicks&)> // Callback in which the encoded audio frame and play-out time will be returned. typedef base::Callback<void(scoped_ptr<transport::EncodedAudioFrame>, - const base::TimeTicks&)> AudioFrameEncodedCallback; + const base::TimeTicks&)> AudioFrameEncodedCallback; // Callback in which the raw frame and render time will be returned once // decoding is complete. typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame, - const base::TimeTicks&)> - VideoFrameDecodedCallback; + const base::TimeTicks&)> VideoFrameDecodedCallback; // Callback in which the encoded video frame and render time will be returned. typedef base::Callback<void(scoped_ptr<transport::EncodedVideoFrame>, - const base::TimeTicks&)> VideoFrameEncodedCallback; + const base::TimeTicks&)> VideoFrameEncodedCallback; // This Class is thread safe. class FrameReceiver : public base::RefCountedThreadSafe<FrameReceiver> { @@ -57,7 +56,7 @@ class FrameReceiver : public base::RefCountedThreadSafe<FrameReceiver> { virtual void GetRawVideoFrame(const VideoFrameDecodedCallback& callback) = 0; virtual void GetEncodedVideoFrame( - const VideoFrameEncodedCallback& callback) = 0; + const VideoFrameEncodedCallback& callback) = 0; protected: virtual ~FrameReceiver() {} diff --git a/media/cast/cast_receiver_impl.cc b/media/cast/cast_receiver_impl.cc index 33b13c3..cca6492 100644 --- a/media/cast/cast_receiver_impl.cc +++ b/media/cast/cast_receiver_impl.cc @@ -15,8 +15,8 @@ namespace cast { // The callback should not be used, as the receiver is using the external // transport. Implementation is required as the pacer is common to sender and // receiver. -static void DoNothingCastTransportStatus(transport::CastTransportStatus status) -{ +static void DoNothingCastTransportStatus( + transport::CastTransportStatus status) { NOTREACHED() << "Internal transport used in CastReceiver"; } // The video and audio receivers should only be called from the main thread. @@ -31,34 +31,44 @@ class LocalFrameReceiver : public FrameReceiver { audio_receiver_(audio_receiver), video_receiver_(video_receiver) {} - virtual void GetRawVideoFrame( - const VideoFrameDecodedCallback& callback) OVERRIDE { - cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, - base::Bind(&VideoReceiver::GetRawVideoFrame, - video_receiver_->AsWeakPtr(), callback)); + virtual void GetRawVideoFrame(const VideoFrameDecodedCallback& callback) + OVERRIDE { + cast_environment_->PostTask(CastEnvironment::MAIN, + FROM_HERE, + base::Bind(&VideoReceiver::GetRawVideoFrame, + video_receiver_->AsWeakPtr(), + callback)); } - virtual void GetEncodedVideoFrame( - const VideoFrameEncodedCallback& callback) OVERRIDE { - cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, - base::Bind(&VideoReceiver::GetEncodedVideoFrame, - video_receiver_->AsWeakPtr(), callback)); + virtual void GetEncodedVideoFrame(const VideoFrameEncodedCallback& callback) + OVERRIDE { + cast_environment_->PostTask(CastEnvironment::MAIN, + FROM_HERE, + base::Bind(&VideoReceiver::GetEncodedVideoFrame, + video_receiver_->AsWeakPtr(), + callback)); } - virtual void GetRawAudioFrame( - int number_of_10ms_blocks, - int desired_frequency, - const AudioFrameDecodedCallback& callback) OVERRIDE { - cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, base::Bind( - &AudioReceiver::GetRawAudioFrame, audio_receiver_->AsWeakPtr(), - number_of_10ms_blocks, desired_frequency, callback)); + virtual void GetRawAudioFrame(int number_of_10ms_blocks, + int desired_frequency, + const AudioFrameDecodedCallback& callback) + OVERRIDE { + cast_environment_->PostTask(CastEnvironment::MAIN, + FROM_HERE, + base::Bind(&AudioReceiver::GetRawAudioFrame, + audio_receiver_->AsWeakPtr(), + number_of_10ms_blocks, + desired_frequency, + callback)); } - virtual void GetCodedAudioFrame( - const AudioFrameEncodedCallback& callback) OVERRIDE { - cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, - base::Bind(&AudioReceiver::GetEncodedAudioFrame, - audio_receiver_->AsWeakPtr(), callback)); + virtual void GetCodedAudioFrame(const AudioFrameEncodedCallback& callback) + OVERRIDE { + cast_environment_->PostTask(CastEnvironment::MAIN, + FROM_HERE, + base::Bind(&AudioReceiver::GetEncodedAudioFrame, + audio_receiver_->AsWeakPtr(), + callback)); } protected: @@ -77,10 +87,8 @@ CastReceiver* CastReceiver::CreateCastReceiver( const AudioReceiverConfig& audio_config, const VideoReceiverConfig& video_config, transport::PacketSender* const packet_sender) { - return new CastReceiverImpl(cast_environment, - audio_config, - video_config, - packet_sender); + return new CastReceiverImpl( + cast_environment, audio_config, video_config, packet_sender); } CastReceiverImpl::CastReceiverImpl( @@ -99,8 +107,7 @@ CastReceiverImpl::CastReceiverImpl( &video_receiver_)), cast_environment_(cast_environment), ssrc_of_audio_sender_(audio_config.incoming_ssrc), - ssrc_of_video_sender_(video_config.incoming_ssrc) { -} + ssrc_of_video_sender_(video_config.incoming_ssrc) {} CastReceiverImpl::~CastReceiverImpl() {} @@ -123,12 +130,14 @@ void CastReceiverImpl::ReceivedPacket(scoped_ptr<Packet> packet) { ssrc_of_sender = Rtcp::GetSsrcOfSender(data, length); } if (ssrc_of_sender == ssrc_of_audio_sender_) { - cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, + cast_environment_->PostTask(CastEnvironment::MAIN, + FROM_HERE, base::Bind(&AudioReceiver::IncomingPacket, audio_receiver_.AsWeakPtr(), base::Passed(&packet))); } else if (ssrc_of_sender == ssrc_of_video_sender_) { - cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, + cast_environment_->PostTask(CastEnvironment::MAIN, + FROM_HERE, base::Bind(&VideoReceiver::IncomingPacket, video_receiver_.AsWeakPtr(), base::Passed(&packet))); @@ -139,8 +148,7 @@ void CastReceiverImpl::ReceivedPacket(scoped_ptr<Packet> packet) { } transport::PacketReceiverCallback CastReceiverImpl::packet_receiver() { - return base::Bind(&CastReceiverImpl::ReceivedPacket, - base::Unretained(this)); + return base::Bind(&CastReceiverImpl::ReceivedPacket, base::Unretained(this)); } scoped_refptr<FrameReceiver> CastReceiverImpl::frame_receiver() { diff --git a/media/cast/cast_receiver_impl.h b/media/cast/cast_receiver_impl.h index 99a584e..512b3bd 100644 --- a/media/cast/cast_receiver_impl.h +++ b/media/cast/cast_receiver_impl.h @@ -46,6 +46,8 @@ class CastReceiverImpl : public CastReceiver { scoped_refptr<CastEnvironment> cast_environment_; const uint32 ssrc_of_audio_sender_; const uint32 ssrc_of_video_sender_; + + DISALLOW_COPY_AND_ASSIGN(CastReceiverImpl); }; } // namespace cast diff --git a/media/cast/cast_sender_impl.h b/media/cast/cast_sender_impl.h index d0e2cdc..bfb4041 100644 --- a/media/cast/cast_sender_impl.h +++ b/media/cast/cast_sender_impl.h @@ -13,7 +13,7 @@ #include "media/cast/video_sender/video_sender.h" namespace media { - class VideoFrame; +class VideoFrame; } namespace media { |