summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-01 21:31:17 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-01 21:31:17 +0000
commit64582371e4e4988d9ea5292afa95c19072f3240b (patch)
tree1e3e52d2320193d364eaaae9ac09b27c0bc1ae02
parent46af73a283dfc4b4b8a5c3926a6730f18ec13867 (diff)
downloadchromium_src-64582371e4e4988d9ea5292afa95c19072f3240b.zip
chromium_src-64582371e4e4988d9ea5292afa95c19072f3240b.tar.gz
chromium_src-64582371e4e4988d9ea5292afa95c19072f3240b.tar.bz2
Fix code style and gyp files in cast to build cast_unittest
*.gypi should not be used for dependency directly. Renaming those files to *.gyp. Also style fixes to make compilers happy. This change is reland of r226264. TBR=acolwell Review URL: https://codereview.chromium.org/25544003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226305 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--build/all.gyp1
-rw-r--r--media/cast/audio_receiver/audio_decoder.cc9
-rw-r--r--media/cast/audio_receiver/audio_decoder.h12
-rw-r--r--media/cast/audio_receiver/audio_decoder_unittest.cc2
-rw-r--r--media/cast/audio_receiver/audio_receiver.cc4
-rw-r--r--media/cast/audio_receiver/audio_receiver_unittest.cc4
-rw-r--r--media/cast/audio_sender/audio_encoder.cc9
-rw-r--r--media/cast/audio_sender/audio_encoder.h10
-rw-r--r--media/cast/audio_sender/audio_encoder_unittest.cc2
-rw-r--r--media/cast/audio_sender/audio_sender.cc4
-rw-r--r--media/cast/audio_sender/audio_sender_unittest.cc2
-rw-r--r--media/cast/cast.gyp12
-rw-r--r--media/cast/cast_config.cc4
-rw-r--r--media/cast/cast_config.h5
-rw-r--r--media/cast/cast_receiver.gyp2
-rw-r--r--media/cast/cast_receiver.h4
-rw-r--r--media/cast/cast_sender.gyp2
-rw-r--r--media/cast/cast_sender.h4
-rw-r--r--media/cast/cast_sender_impl.cc20
-rw-r--r--media/cast/cast_sender_impl.h9
-rw-r--r--media/cast/cast_thread.cc8
-rw-r--r--media/cast/cast_thread.h5
-rw-r--r--media/cast/congestion_control/congestion_control.cc3
-rw-r--r--media/cast/congestion_control/congestion_control.h2
-rw-r--r--media/cast/framer/cast_message_builder_unittest.cc2
-rw-r--r--media/cast/framer/frame_buffer_unittest.cc4
-rw-r--r--media/cast/framer/framer_unittest.cc4
-rw-r--r--media/cast/pacing/mock_paced_packet_sender.cc17
-rw-r--r--media/cast/pacing/mock_paced_packet_sender.h3
-rw-r--r--media/cast/pacing/mock_packet_sender.cc17
-rw-r--r--media/cast/pacing/mock_packet_sender.h2
-rw-r--r--media/cast/pacing/paced_sender.cc10
-rw-r--r--media/cast/pacing/paced_sender.gyp2
-rw-r--r--media/cast/rtcp/mock_rtcp_receiver_feedback.cc23
-rw-r--r--media/cast/rtcp/mock_rtcp_receiver_feedback.h6
-rw-r--r--media/cast/rtcp/mock_rtcp_sender_feedback.cc17
-rw-r--r--media/cast/rtcp/mock_rtcp_sender_feedback.h3
-rw-r--r--media/cast/rtcp/rtcp_receiver_unittest.cc4
-rw-r--r--media/cast/rtcp/rtcp_sender.cc3
-rw-r--r--media/cast/rtcp/rtcp_sender_unittest.cc6
-rw-r--r--media/cast/rtcp/rtcp_unittest.cc6
-rw-r--r--media/cast/rtcp/test_rtcp_packet_builder.cc3
-rw-r--r--media/cast/rtcp/test_rtcp_packet_builder.h6
-rw-r--r--media/cast/rtp_common/mock_rtp_payload_feedback.cc17
-rw-r--r--media/cast/rtp_common/mock_rtp_payload_feedback.h3
-rw-r--r--media/cast/rtp_receiver/receiver_stats_unittest.cc2
-rw-r--r--media/cast/rtp_receiver/rtp_parser/rtp_parser.gyp (renamed from media/cast/rtp_receiver/rtp_parser/rtp_parser.gypi)1
-rw-r--r--media/cast/rtp_receiver/rtp_parser/rtp_parser_unittest.cc10
-rw-r--r--media/cast/rtp_receiver/rtp_parser/test/rtp_packet_builder.cc4
-rw-r--r--media/cast/rtp_receiver/rtp_receiver.gyp2
-rw-r--r--media/cast/rtp_sender/packet_storage/packet_storage.gyp (renamed from media/cast/rtp_sender/packet_storage/packet_storage.gypi)0
-rw-r--r--media/cast/rtp_sender/rtp_packetizer/rtp_packetizer.gyp (renamed from media/cast/rtp_sender/rtp_packetizer/rtp_packetizer.gypi)2
-rw-r--r--media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_config.cc21
-rw-r--r--media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_config.h10
-rw-r--r--media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_unittest.cc4
-rw-r--r--media/cast/rtp_sender/rtp_sender.gyp4
-rw-r--r--media/cast/video_receiver/codecs/vp8/vp8_decoder.cc2
-rw-r--r--media/cast/video_receiver/video_decoder.h7
-rw-r--r--media/cast/video_receiver/video_decoder_unittest.cc8
-rw-r--r--media/cast/video_receiver/video_receiver.cc6
-rw-r--r--media/cast/video_receiver/video_receiver_unittest.cc8
-rw-r--r--media/cast/video_sender/codecs/vp8/vp8_encoder.cc2
-rw-r--r--media/cast/video_sender/mock_video_encoder_controller.cc17
-rw-r--r--media/cast/video_sender/mock_video_encoder_controller.h3
-rw-r--r--media/cast/video_sender/video_encoder.cc10
-rw-r--r--media/cast/video_sender/video_encoder.h6
-rw-r--r--media/cast/video_sender/video_encoder_unittest.cc7
-rw-r--r--media/cast/video_sender/video_sender.cc2
-rw-r--r--media/cast/video_sender/video_sender_unittest.cc2
69 files changed, 324 insertions, 113 deletions
diff --git a/build/all.gyp b/build/all.gyp
index 8b9f488..4323061 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -41,6 +41,7 @@
'../gpu/tools/tools.gyp:*',
'../ipc/ipc.gyp:*',
'../jingle/jingle.gyp:*',
+ '../media/cast/cast.gyp:*',
'../media/media.gyp:*',
'../ppapi/ppapi.gyp:*',
'../ppapi/ppapi_internal.gyp:*',
diff --git a/media/cast/audio_receiver/audio_decoder.cc b/media/cast/audio_receiver/audio_decoder.cc
index 7adeb2d..b868b11 100644
--- a/media/cast/audio_receiver/audio_decoder.cc
+++ b/media/cast/audio_receiver/audio_decoder.cc
@@ -13,9 +13,9 @@ namespace cast {
AudioDecoder::AudioDecoder(scoped_refptr<CastThread> cast_thread,
const AudioReceiverConfig& audio_config)
- : cast_thread_(cast_thread),
- have_received_packets_(false) {
- audio_decoder_ = webrtc::AudioCodingModule::Create(0);
+ : audio_decoder_(webrtc::AudioCodingModule::Create(0)),
+ have_received_packets_(false),
+ cast_thread_(cast_thread) {
audio_decoder_->InitializeReceiver();
webrtc::CodecInst receive_codec;
@@ -49,7 +49,6 @@ AudioDecoder::AudioDecoder(scoped_refptr<CastThread> cast_thread,
}
AudioDecoder::~AudioDecoder() {
- webrtc::AudioCodingModule::Destroy(audio_decoder_);
}
bool AudioDecoder::GetRawAudioFrame(int number_of_10ms_blocks,
@@ -97,4 +96,4 @@ void AudioDecoder::IncomingParsedRtpPacket(const uint8* payload_data,
}
} // namespace cast
-} // namespace media \ No newline at end of file
+} // namespace media
diff --git a/media/cast/audio_receiver/audio_decoder.h b/media/cast/audio_receiver/audio_decoder.h
index 2f5f13a..bd84e37 100644
--- a/media/cast/audio_receiver/audio_decoder.h
+++ b/media/cast/audio_receiver/audio_decoder.h
@@ -25,8 +25,6 @@ class AudioDecoder : public base::RefCountedThreadSafe<AudioDecoder> {
explicit AudioDecoder(scoped_refptr<CastThread> cast_thread,
const AudioReceiverConfig& audio_config);
- virtual ~AudioDecoder();
-
// Extract a raw audio frame from the decoder.
// Set the number of desired 10ms blocks and frequency.
bool GetRawAudioFrame(int number_of_10ms_blocks,
@@ -39,9 +37,13 @@ class AudioDecoder : public base::RefCountedThreadSafe<AudioDecoder> {
int payload_size,
const RtpCastHeader& rtp_header);
+ protected:
+ virtual ~AudioDecoder();
+
private:
- // Can't use scoped_ptr due to protected constructor within webrtc.
- webrtc::AudioCodingModule* audio_decoder_;
+ friend class base::RefCountedThreadSafe<AudioDecoder>;
+
+ scoped_ptr<webrtc::AudioCodingModule> audio_decoder_;
bool have_received_packets_;
scoped_refptr<CastThread> cast_thread_;
@@ -51,4 +53,4 @@ class AudioDecoder : public base::RefCountedThreadSafe<AudioDecoder> {
} // namespace cast
} // namespace media
-#endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_DECODER_H_ \ No newline at end of file
+#endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_DECODER_H_
diff --git a/media/cast/audio_receiver/audio_decoder_unittest.cc b/media/cast/audio_receiver/audio_decoder_unittest.cc
index 09aa39a..8057225 100644
--- a/media/cast/audio_receiver/audio_decoder_unittest.cc
+++ b/media/cast/audio_receiver/audio_decoder_unittest.cc
@@ -19,7 +19,7 @@ class AudioDecoderTest : public ::testing::Test {
protected:
AudioDecoderTest() {}
- ~AudioDecoderTest() {}
+ virtual ~AudioDecoderTest() {}
virtual void SetUp() {
task_runner_ = new test::FakeTaskRunner(&testing_clock_);
diff --git a/media/cast/audio_receiver/audio_receiver.cc b/media/cast/audio_receiver/audio_receiver.cc
index ace8ffc..9d805c2 100644
--- a/media/cast/audio_receiver/audio_receiver.cc
+++ b/media/cast/audio_receiver/audio_receiver.cc
@@ -71,10 +71,6 @@ class LocalRtpAudioFeedback : public RtpPayloadFeedback {
audio_receiver_->CastFeedback(cast_message);
}
- virtual void RequestKeyFrame() OVERRIDE {
- DCHECK(false) << "Invalid callback";
- }
-
private:
AudioReceiver* audio_receiver_;
};
diff --git a/media/cast/audio_receiver/audio_receiver_unittest.cc b/media/cast/audio_receiver/audio_receiver_unittest.cc
index aa1295a..d9ac97a 100644
--- a/media/cast/audio_receiver/audio_receiver_unittest.cc
+++ b/media/cast/audio_receiver/audio_receiver_unittest.cc
@@ -52,10 +52,10 @@ class AudioReceiverTest : public ::testing::Test {
receiver_->set_clock(&testing_clock_);
}
- ~AudioReceiverTest() {}
+ virtual ~AudioReceiverTest() {}
virtual void SetUp() {
- payload_.assign(kPacketSize, 0);
+ payload_.assign(kPacketSize, 0);
// Always start with a key frame.
rtp_header_.is_key_frame = true;
rtp_header_.frame_id = 0;
diff --git a/media/cast/audio_sender/audio_encoder.cc b/media/cast/audio_sender/audio_encoder.cc
index 15517fa..8853e2a 100644
--- a/media/cast/audio_sender/audio_encoder.cc
+++ b/media/cast/audio_sender/audio_encoder.cc
@@ -35,7 +35,7 @@ class WebrtEncodedDataCallback : public webrtc::AudioPacketizationCallback {
uint32 timestamp,
const uint8* payload_data,
uint16 payload_size,
- const webrtc::RTPFragmentationHeader* /*fragmentation*/) {
+ const webrtc::RTPFragmentationHeader* /*fragmentation*/) OVERRIDE {
scoped_ptr<EncodedAudioFrame> audio_frame(new EncodedAudioFrame());
audio_frame->codec = codec_;
audio_frame->samples = timestamp - last_timestamp_;
@@ -110,7 +110,6 @@ AudioEncoder::AudioEncoder(scoped_refptr<CastThread> cast_thread,
}
AudioEncoder::~AudioEncoder() {
- webrtc::AudioCodingModule::Destroy(audio_encoder_);
}
// Called from main cast thread.
@@ -132,12 +131,12 @@ void AudioEncoder::EncodeAudioFrameThread(
const base::Closure release_callback) {
DCHECK(cast_thread_->CurrentlyOn(CastThread::AUDIO_ENCODER));
int samples_per_10ms = audio_frame->frequency / 100;
- int number_of_10ms_blocks = audio_frame->samples.size() /
+ size_t number_of_10ms_blocks = audio_frame->samples.size() /
(samples_per_10ms * audio_frame->channels);
DCHECK(webrtc::AudioFrame::kMaxDataSizeSamples > samples_per_10ms)
<< "webrtc sanity check failed";
- for (int i = 0; i < number_of_10ms_blocks; ++i) {
+ for (size_t i = 0; i < number_of_10ms_blocks; ++i) {
webrtc::AudioFrame webrtc_audio_frame;
webrtc_audio_frame.timestamp_ = timestamp_;
@@ -163,7 +162,7 @@ void AudioEncoder::EncodeAudioFrameThread(
// Not all insert of 10 ms will generate a callback with encoded data.
webrtc_encoder_callback_->SetEncodedCallbackInfo(recorded_time,
&frame_encoded_callback);
- for (int i = 0; i < number_of_10ms_blocks; ++i) {
+ for (size_t i = 0; i < number_of_10ms_blocks; ++i) {
audio_encoder_->Process();
}
}
diff --git a/media/cast/audio_sender/audio_encoder.h b/media/cast/audio_sender/audio_encoder.h
index 8aacb0b..3f4b918 100644
--- a/media/cast/audio_sender/audio_encoder.h
+++ b/media/cast/audio_sender/audio_encoder.h
@@ -30,8 +30,6 @@ class AudioEncoder : public base::RefCountedThreadSafe<AudioEncoder> {
AudioEncoder(scoped_refptr<CastThread> cast_thread,
const AudioSenderConfig& audio_config);
- virtual ~AudioEncoder();
-
// The audio_frame must be valid until the closure callback is called.
// The closure callback is called from the main cast thread as soon as
// the encoder is done with the frame; it does not mean that the encoded frame
@@ -41,7 +39,12 @@ class AudioEncoder : public base::RefCountedThreadSafe<AudioEncoder> {
const FrameEncodedCallback& frame_encoded_callback,
const base::Closure callback);
+ protected:
+ virtual ~AudioEncoder();
+
private:
+ friend class base::RefCountedThreadSafe<AudioEncoder>;
+
void EncodeAudioFrameThread(
const PcmAudioFrame* audio_frame,
const base::TimeTicks& recorded_time,
@@ -49,8 +52,7 @@ class AudioEncoder : public base::RefCountedThreadSafe<AudioEncoder> {
const base::Closure release_callback);
scoped_refptr<CastThread> cast_thread_;
- // Can't use scoped_ptr due to protected constructor within webrtc.
- webrtc::AudioCodingModule* audio_encoder_;
+ scoped_ptr<webrtc::AudioCodingModule> audio_encoder_;
scoped_ptr<WebrtEncodedDataCallback> webrtc_encoder_callback_;
uint32 timestamp_;
diff --git a/media/cast/audio_sender/audio_encoder_unittest.cc b/media/cast/audio_sender/audio_encoder_unittest.cc
index 0b17f98..4f2b73f9 100644
--- a/media/cast/audio_sender/audio_encoder_unittest.cc
+++ b/media/cast/audio_sender/audio_encoder_unittest.cc
@@ -45,7 +45,7 @@ class AudioEncoderTest : public ::testing::Test {
audio_encoder_ = new AudioEncoder(cast_thread_, audio_config);
}
- ~AudioEncoderTest() {}
+ virtual ~AudioEncoderTest() {}
base::SimpleTestTickClock testing_clock_;
scoped_refptr<test::FakeTaskRunner> task_runner_;
diff --git a/media/cast/audio_sender/audio_sender.cc b/media/cast/audio_sender/audio_sender.cc
index c48edb7..bffd9e3 100644
--- a/media/cast/audio_sender/audio_sender.cc
+++ b/media/cast/audio_sender/audio_sender.cc
@@ -22,10 +22,6 @@ class LocalRtcpAudioSenderFeedback : public RtcpSenderFeedback {
: audio_sender_(audio_sender) {
}
- virtual void OnReceivedSendReportRequest() OVERRIDE {
- DCHECK(false) << "Invalid callback";
- }
-
virtual void OnReceivedReportBlock(
const RtcpReportBlock& report_block) OVERRIDE {
DCHECK(false) << "Invalid callback";
diff --git a/media/cast/audio_sender/audio_sender_unittest.cc b/media/cast/audio_sender/audio_sender_unittest.cc
index 0b5e217..4774dd2 100644
--- a/media/cast/audio_sender/audio_sender_unittest.cc
+++ b/media/cast/audio_sender/audio_sender_unittest.cc
@@ -47,7 +47,7 @@ class AudioSenderTest : public ::testing::Test {
audio_sender_->set_clock(&testing_clock_);
}
- ~AudioSenderTest() {}
+ virtual ~AudioSenderTest() {}
base::SimpleTestTickClock testing_clock_;
MockPacedPacketSender mock_transport_;
diff --git a/media/cast/cast.gyp b/media/cast/cast.gyp
index 230a2e1..4315721 100644
--- a/media/cast/cast.gyp
+++ b/media/cast/cast.gyp
@@ -66,10 +66,20 @@
'framer/cast_message_builder_unittest.cc',
'framer/frame_buffer_unittest.cc',
'framer/framer_unittest.cc',
+ 'pacing/mock_packet_sender.cc',
+ 'pacing/mock_packet_sender.h',
+ 'pacing/mock_paced_packet_sender.cc',
+ 'pacing/mock_paced_packet_sender.h',
'pacing/paced_sender_unittest.cc',
+ 'rtcp/mock_rtcp_receiver_feedback.cc',
+ 'rtcp/mock_rtcp_receiver_feedback.h',
+ 'rtcp/mock_rtcp_sender_feedback.cc',
+ 'rtcp/mock_rtcp_sender_feedback.h',
'rtcp/rtcp_receiver_unittest.cc',
'rtcp/rtcp_sender_unittest.cc',
'rtcp/rtcp_unittest.cc',
+ 'rtp_common/mock_rtp_payload_feedback.cc',
+ 'rtp_common/mock_rtp_payload_feedback.h',
'rtp_receiver/receiver_stats_unittest.cc',
'rtp_receiver/rtp_parser/test/rtp_packet_builder.cc',
'rtp_receiver/rtp_parser/rtp_parser_unittest.cc',
@@ -80,6 +90,8 @@
'test/fake_task_runner.cc',
'video_receiver/video_decoder_unittest.cc',
'video_receiver/video_receiver_unittest.cc',
+ 'video_sender/mock_video_encoder_controller.cc',
+ 'video_sender/mock_video_encoder_controller.h',
'video_sender/video_encoder_unittest.cc',
'video_sender/video_sender_unittest.cc',
], # source
diff --git a/media/cast/cast_config.cc b/media/cast/cast_config.cc
index 97c7073..5448fbd 100644
--- a/media/cast/cast_config.cc
+++ b/media/cast/cast_config.cc
@@ -45,5 +45,9 @@ EncodedAudioFrame::~EncodedAudioFrame() {}
PcmAudioFrame::PcmAudioFrame() {}
PcmAudioFrame::~PcmAudioFrame() {}
+bool PacketSender::SendPacket(const std::vector<uint8>& packet) {
+ return SendPacket(&(packet[0]), static_cast<int>(packet.size()));
+}
+
} // namespace cast
} // namespace media
diff --git a/media/cast/cast_config.h b/media/cast/cast_config.h
index 988924a..276429a 100644
--- a/media/cast/cast_config.h
+++ b/media/cast/cast_config.h
@@ -176,6 +176,7 @@ class PacketSender {
public:
// All packets to be sent to the network will be delivered via this function.
virtual bool SendPacket(const uint8* packet, int length) = 0;
+ virtual bool SendPacket(const std::vector<uint8>& packet);
virtual ~PacketSender() {}
};
@@ -187,7 +188,11 @@ class PacketReceiver : public base::RefCountedThreadSafe<PacketReceiver> {
virtual void ReceivedPacket(const uint8* packet, int length,
const base::Closure callback) = 0;
+ protected:
virtual ~PacketReceiver() {}
+
+ private:
+ friend class base::RefCountedThreadSafe<PacketReceiver>;
};
class VideoEncoderController {
diff --git a/media/cast/cast_receiver.gyp b/media/cast/cast_receiver.gyp
index 539c41d..e4afb76 100644
--- a/media/cast/cast_receiver.gyp
+++ b/media/cast/cast_receiver.gyp
@@ -21,7 +21,7 @@
'cast_audio_receiver',
'cast_video_receiver',
'framer/framer.gyp:cast_framer',
- 'pacing/paced_sender.gyp:paced_sender',
+ 'pacing/paced_sender.gyp:cast_paced_sender',
],
},
],
diff --git a/media/cast/cast_receiver.h b/media/cast/cast_receiver.h
index a2eef76..a36a626 100644
--- a/media/cast/cast_receiver.h
+++ b/media/cast/cast_receiver.h
@@ -47,7 +47,11 @@ class FrameReceiver : public base::RefCountedThreadSafe<FrameReceiver>{
virtual void ReleaseCodedAudioFrame(uint8 frame_id) = 0;
+ protected:
virtual ~FrameReceiver() {}
+
+ private:
+ friend class base::RefCountedThreadSafe<FrameReceiver>;
};
// This Class is thread safe.
diff --git a/media/cast/cast_sender.gyp b/media/cast/cast_sender.gyp
index fe99f80..36027f6 100644
--- a/media/cast/cast_sender.gyp
+++ b/media/cast/cast_sender.gyp
@@ -25,7 +25,7 @@
'dependencies': [
'audio_sender',
'congestion_control',
- 'pacing/paced_sender.gyp:paced_sender',
+ 'pacing/paced_sender.gyp:cast_paced_sender',
'rtcp/rtcp.gyp:cast_rtcp',
'rtp_sender/rtp_sender.gyp:cast_rtp_sender',
'video_sender',
diff --git a/media/cast/cast_sender.h b/media/cast/cast_sender.h
index f4d3653..3fb7f32 100644
--- a/media/cast/cast_sender.h
+++ b/media/cast/cast_sender.h
@@ -56,7 +56,11 @@ class FrameInput : public base::RefCountedThreadSafe<PacketReceiver> {
const base::TimeTicks& recorded_time,
const base::Closure callback) = 0;
+ protected:
virtual ~FrameInput() {}
+
+ private:
+ friend class base::RefCountedThreadSafe<FrameInput>;
};
// This Class is thread safe.
diff --git a/media/cast/cast_sender_impl.cc b/media/cast/cast_sender_impl.cc
index 76f2f99..edefedd 100644
--- a/media/cast/cast_sender_impl.cc
+++ b/media/cast/cast_sender_impl.cc
@@ -55,7 +55,12 @@ class LocalFrameInput : public FrameInput {
audio_frame, recorded_time, callback));
}
+ protected:
+ virtual ~LocalFrameInput() {}
+
private:
+ friend class base::RefCountedThreadSafe<LocalFrameInput>;
+
scoped_refptr<CastThread> cast_thread_;
base::WeakPtr<AudioSender> audio_sender_;
base::WeakPtr<VideoSender> video_sender_;
@@ -100,8 +105,6 @@ class LocalCastSenderPacketReceiver : public PacketReceiver {
ssrc_of_audio_sender_(ssrc_of_audio_sender),
ssrc_of_video_sender_(ssrc_of_video_sender) {}
- virtual ~LocalCastSenderPacketReceiver() {}
-
virtual void ReceivedPacket(const uint8* packet,
int length,
const base::Closure callback) OVERRIDE {
@@ -132,7 +135,12 @@ class LocalCastSenderPacketReceiver : public PacketReceiver {
}
}
+ protected:
+ virtual ~LocalCastSenderPacketReceiver() {}
+
private:
+ friend class base::RefCountedThreadSafe<LocalCastSenderPacketReceiver>;
+
scoped_refptr<CastThread> cast_thread_;
base::WeakPtr<AudioSender> audio_sender_;
base::WeakPtr<VideoSender> video_sender_;
@@ -172,5 +180,13 @@ CastSenderImpl::CastSenderImpl(
CastSenderImpl::~CastSenderImpl() {}
+scoped_refptr<FrameInput> CastSenderImpl::frame_input() {
+ return frame_input_;
+}
+
+scoped_refptr<PacketReceiver> CastSenderImpl::packet_receiver() {
+ return packet_receiver_;
+}
+
} // namespace cast
} // namespace media
diff --git a/media/cast/cast_sender_impl.h b/media/cast/cast_sender_impl.h
index eb19caa..afbd40d0 100644
--- a/media/cast/cast_sender_impl.h
+++ b/media/cast/cast_sender_impl.h
@@ -32,13 +32,8 @@ class CastSenderImpl : public CastSender {
virtual ~CastSenderImpl();
- virtual scoped_refptr<FrameInput> frame_input() OVERRIDE {
- return frame_input_;
- }
-
- virtual scoped_refptr<PacketReceiver> packet_receiver() OVERRIDE {
- return packet_receiver_;
- }
+ virtual scoped_refptr<FrameInput> frame_input() OVERRIDE;
+ virtual scoped_refptr<PacketReceiver> packet_receiver() OVERRIDE;
private:
PacedSender pacer_;
diff --git a/media/cast/cast_thread.cc b/media/cast/cast_thread.cc
index e474468..5745fb3 100644
--- a/media/cast/cast_thread.cc
+++ b/media/cast/cast_thread.cc
@@ -25,6 +25,8 @@ CastThread::CastThread(
DCHECK(main_thread_proxy) << "Main thread required";
}
+CastThread::~CastThread() {}
+
bool CastThread::PostTask(ThreadId identifier,
const tracked_objects::Location& from_here,
const base::Closure& task) {
@@ -57,6 +59,9 @@ scoped_refptr<TaskRunner> CastThread::GetMessageTaskRunnerForThread(
return video_encode_thread_proxy_;
case CastThread::VIDEO_DECODER:
return video_decode_thread_proxy_;
+ default:
+ CHECK(false) << "Invalid Thread ID.";
+ return NULL;
}
}
@@ -73,7 +78,8 @@ bool CastThread::CurrentlyOn(ThreadId identifier) {
case CastThread::VIDEO_DECODER:
return video_decode_thread_proxy_->RunsTasksOnCurrentThread();
default:
- DCHECK(false) << "Wrong thread identifier";
+ CHECK(false) << "Wrong thread identifier";
+ return false;
}
}
diff --git a/media/cast/cast_thread.h b/media/cast/cast_thread.h
index 323f03d..e7ccbd9 100644
--- a/media/cast/cast_thread.h
+++ b/media/cast/cast_thread.h
@@ -54,7 +54,12 @@ class CastThread : public base::RefCountedThreadSafe<CastThread> {
bool CurrentlyOn(ThreadId identifier);
+ protected:
+ virtual ~CastThread();
+
private:
+ friend class base::RefCountedThreadSafe<CastThread>;
+
scoped_refptr<base::TaskRunner> GetMessageTaskRunnerForThread(
ThreadId identifier);
diff --git a/media/cast/congestion_control/congestion_control.cc b/media/cast/congestion_control/congestion_control.cc
index f8ca98c..791842a 100644
--- a/media/cast/congestion_control/congestion_control.cc
+++ b/media/cast/congestion_control/congestion_control.cc
@@ -37,6 +37,9 @@ CongestionControl::CongestionControl(float congestion_control_back_off,
DCHECK_GE(start_bitrate, min_bitrate_configured) << "Invalid config";
}
+CongestionControl::~CongestionControl() {
+}
+
bool CongestionControl::OnAck(base::TimeDelta rtt, uint32* new_bitrate) {
base::TimeTicks now = clock_->NowTicks();
diff --git a/media/cast/congestion_control/congestion_control.h b/media/cast/congestion_control/congestion_control.h
index f1b9b28..8da124a 100644
--- a/media/cast/congestion_control/congestion_control.h
+++ b/media/cast/congestion_control/congestion_control.h
@@ -21,7 +21,7 @@ class CongestionControl {
uint32 min_bitrate_configured,
uint32 start_bitrate);
- virtual ~CongestionControl() {}
+ virtual ~CongestionControl();
// Don't call OnAck if the same message contain a NACK.
// Returns true if the bitrate have changed.
diff --git a/media/cast/framer/cast_message_builder_unittest.cc b/media/cast/framer/cast_message_builder_unittest.cc
index f9bb066..faed860 100644
--- a/media/cast/framer/cast_message_builder_unittest.cc
+++ b/media/cast/framer/cast_message_builder_unittest.cc
@@ -83,7 +83,7 @@ class CastMessageBuilderTest : public ::testing::Test {
cast_msg_builder_->set_clock(&testing_clock_);
}
- ~CastMessageBuilderTest() {}
+ virtual ~CastMessageBuilderTest() {}
void SetFrameId(uint8 frame_id) {
rtp_header_.frame_id = frame_id;
diff --git a/media/cast/framer/frame_buffer_unittest.cc b/media/cast/framer/frame_buffer_unittest.cc
index 26998f5..fb14da3 100644
--- a/media/cast/framer/frame_buffer_unittest.cc
+++ b/media/cast/framer/frame_buffer_unittest.cc
@@ -12,9 +12,9 @@ class FrameBufferTest : public ::testing::Test {
protected:
FrameBufferTest() {}
- ~FrameBufferTest() {}
+ virtual ~FrameBufferTest() {}
- void SetUp() {
+ virtual void SetUp() {
payload_.assign(kIpPacketSize, 0);
// Build a default one packet frame - populate webrtc header.
diff --git a/media/cast/framer/framer_unittest.cc b/media/cast/framer/framer_unittest.cc
index 6f83706..9e5fd02 100644
--- a/media/cast/framer/framer_unittest.cc
+++ b/media/cast/framer/framer_unittest.cc
@@ -20,9 +20,9 @@ class FramerTest : public ::testing::Test {
framer_.set_clock(&testing_clock_);
}
- ~FramerTest() {}
+ virtual ~FramerTest() {}
- void SetUp() {
+ virtual void SetUp() {
// Build a default one packet frame - populate webrtc header.
rtp_header_.is_key_frame = false;
rtp_header_.frame_id = 0;
diff --git a/media/cast/pacing/mock_paced_packet_sender.cc b/media/cast/pacing/mock_paced_packet_sender.cc
new file mode 100644
index 0000000..2b79d9f
--- /dev/null
+++ b/media/cast/pacing/mock_paced_packet_sender.cc
@@ -0,0 +1,17 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/cast/pacing/mock_paced_packet_sender.h"
+
+namespace media {
+namespace cast {
+
+MockPacedPacketSender::MockPacedPacketSender() {
+}
+
+MockPacedPacketSender::~MockPacedPacketSender() {
+}
+
+} // namespace cast
+} // namespace media
diff --git a/media/cast/pacing/mock_paced_packet_sender.h b/media/cast/pacing/mock_paced_packet_sender.h
index 40d3e62..7d0914f 100644
--- a/media/cast/pacing/mock_paced_packet_sender.h
+++ b/media/cast/pacing/mock_paced_packet_sender.h
@@ -13,6 +13,9 @@ namespace cast {
class MockPacedPacketSender : public PacedPacketSender {
public:
+ MockPacedPacketSender();
+ virtual ~MockPacedPacketSender();
+
MOCK_METHOD2(SendPacket,
bool(const std::vector<uint8>& packet, int num_of_packets));
MOCK_METHOD2(ResendPacket,
diff --git a/media/cast/pacing/mock_packet_sender.cc b/media/cast/pacing/mock_packet_sender.cc
new file mode 100644
index 0000000..6c3fb44
--- /dev/null
+++ b/media/cast/pacing/mock_packet_sender.cc
@@ -0,0 +1,17 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/cast/pacing/mock_packet_sender.h"
+
+namespace media {
+namespace cast {
+
+MockPacketSender::MockPacketSender() {
+}
+
+MockPacketSender::~MockPacketSender() {
+}
+
+} // namespace cast
+} // namespace media
diff --git a/media/cast/pacing/mock_packet_sender.h b/media/cast/pacing/mock_packet_sender.h
index bad9bac..17e42bc 100644
--- a/media/cast/pacing/mock_packet_sender.h
+++ b/media/cast/pacing/mock_packet_sender.h
@@ -13,6 +13,8 @@ namespace cast {
class MockPacketSender : public PacketSender {
public:
+ MockPacketSender();
+ virtual ~MockPacketSender();
MOCK_METHOD2(SendPacket, bool(const uint8* packet, int length));
};
diff --git a/media/cast/pacing/paced_sender.cc b/media/cast/pacing/paced_sender.cc
index d2935f3..28f5131 100644
--- a/media/cast/pacing/paced_sender.cc
+++ b/media/cast/pacing/paced_sender.cc
@@ -42,7 +42,7 @@ bool PacedSender::SendPacket(const std::vector<uint8>& packet,
return true;
}
++packets_sent_in_burst_;
- return transport_->SendPacket(&(packet[0]), packet.size());
+ return transport_->SendPacket(packet);
}
bool PacedSender::ResendPacket(const std::vector<uint8>& packet,
@@ -60,12 +60,12 @@ bool PacedSender::ResendPacket(const std::vector<uint8>& packet,
return true;
}
++packets_sent_in_burst_;
- return transport_->SendPacket(&(packet[0]), packet.size());
+ return transport_->SendPacket(packet);
}
bool PacedSender::SendRtcpPacket(const std::vector<uint8>& packet) {
// We pass the RTCP packets straight through.
- return transport_->SendPacket(&(packet[0]), packet.size());
+ return transport_->SendPacket(packet);
}
void PacedSender::ScheduleNextSend() {
@@ -95,11 +95,11 @@ void PacedSender::SendStoredPacket() {
if (!resend_packet_list_.empty()) {
// Send our re-send packets first.
const std::vector<uint8>& packet = resend_packet_list_.front();
- transport_->SendPacket(&(packet[0]), packet.size());
+ transport_->SendPacket(packet);
resend_packet_list_.pop_front();
} else {
const std::vector<uint8>& packet = packet_list_.front();
- transport_->SendPacket(&(packet[0]), packet.size());
+ transport_->SendPacket(packet);
packet_list_.pop_front();
if (packet_list_.empty()) {
diff --git a/media/cast/pacing/paced_sender.gyp b/media/cast/pacing/paced_sender.gyp
index 53a1cdb..2cc7750 100644
--- a/media/cast/pacing/paced_sender.gyp
+++ b/media/cast/pacing/paced_sender.gyp
@@ -5,7 +5,7 @@
{
'targets': [
{
- 'target_name': 'paced_sender',
+ 'target_name': 'cast_paced_sender',
'type': 'static_library',
'include_dirs': [
'<(DEPTH)/',
diff --git a/media/cast/rtcp/mock_rtcp_receiver_feedback.cc b/media/cast/rtcp/mock_rtcp_receiver_feedback.cc
new file mode 100644
index 0000000..daaa1ad
--- /dev/null
+++ b/media/cast/rtcp/mock_rtcp_receiver_feedback.cc
@@ -0,0 +1,23 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/cast/rtcp/mock_rtcp_receiver_feedback.h"
+
+namespace media {
+namespace cast {
+
+MockRtcpReceiverFeedback::MockRtcpReceiverFeedback() {
+}
+
+MockRtcpReceiverFeedback::~MockRtcpReceiverFeedback() {
+}
+
+MockRtcpRttFeedback::MockRtcpRttFeedback() {
+}
+
+MockRtcpRttFeedback::~MockRtcpRttFeedback() {
+}
+
+} // namespace cast
+} // namespace media
diff --git a/media/cast/rtcp/mock_rtcp_receiver_feedback.h b/media/cast/rtcp/mock_rtcp_receiver_feedback.h
index 09e2cb4..acde056 100644
--- a/media/cast/rtcp/mock_rtcp_receiver_feedback.h
+++ b/media/cast/rtcp/mock_rtcp_receiver_feedback.h
@@ -15,6 +15,9 @@ namespace cast {
class MockRtcpReceiverFeedback : public RtcpReceiverFeedback {
public:
+ MockRtcpReceiverFeedback();
+ virtual ~MockRtcpReceiverFeedback();
+
MOCK_METHOD1(OnReceivedSenderReport,
void(const RtcpSenderInfo& remote_sender_info));
@@ -26,6 +29,9 @@ class MockRtcpReceiverFeedback : public RtcpReceiverFeedback {
class MockRtcpRttFeedback : public RtcpRttFeedback {
public:
+ MockRtcpRttFeedback();
+ virtual ~MockRtcpRttFeedback();
+
MOCK_METHOD3(OnReceivedDelaySinceLastReport,
void(uint32 media_ssrc,
uint32 last_report,
diff --git a/media/cast/rtcp/mock_rtcp_sender_feedback.cc b/media/cast/rtcp/mock_rtcp_sender_feedback.cc
new file mode 100644
index 0000000..65c6301
--- /dev/null
+++ b/media/cast/rtcp/mock_rtcp_sender_feedback.cc
@@ -0,0 +1,17 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/cast/rtcp/mock_rtcp_sender_feedback.h"
+
+namespace media {
+namespace cast {
+
+MockRtcpSenderFeedback::MockRtcpSenderFeedback() {
+}
+
+MockRtcpSenderFeedback::~MockRtcpSenderFeedback() {
+}
+
+} // namespace cast
+} // namespace media
diff --git a/media/cast/rtcp/mock_rtcp_sender_feedback.h b/media/cast/rtcp/mock_rtcp_sender_feedback.h
index 3947625..6d47a74 100644
--- a/media/cast/rtcp/mock_rtcp_sender_feedback.h
+++ b/media/cast/rtcp/mock_rtcp_sender_feedback.h
@@ -15,6 +15,9 @@ namespace cast {
class MockRtcpSenderFeedback : public RtcpSenderFeedback {
public:
+ MockRtcpSenderFeedback();
+ virtual ~MockRtcpSenderFeedback();
+
MOCK_METHOD1(OnReceivedReportBlock,
void(const RtcpReportBlock& report_block));
diff --git a/media/cast/rtcp/rtcp_receiver_unittest.cc b/media/cast/rtcp/rtcp_receiver_unittest.cc
index 5073944..b26bf80 100644
--- a/media/cast/rtcp/rtcp_receiver_unittest.cc
+++ b/media/cast/rtcp/rtcp_receiver_unittest.cc
@@ -74,9 +74,9 @@ class RtcpReceiverTest : public ::testing::Test {
kSourceSsrc)) {
}
- ~RtcpReceiverTest() {}
+ virtual ~RtcpReceiverTest() {}
- void SetUp() OVERRIDE {
+ virtual void SetUp() OVERRIDE {
EXPECT_CALL(mock_receiver_feedback_, OnReceivedSenderReport(_)).Times(0);
EXPECT_CALL(mock_receiver_feedback_,
OnReceiverReferenceTimeReport(_)).Times(0);
diff --git a/media/cast/rtcp/rtcp_sender.cc b/media/cast/rtcp/rtcp_sender.cc
index 89ea05e..7081466 100644
--- a/media/cast/rtcp/rtcp_sender.cc
+++ b/media/cast/rtcp/rtcp_sender.cc
@@ -25,7 +25,8 @@ RtcpSender::RtcpSender(PacedPacketSender* outgoing_transport,
: ssrc_(sending_ssrc),
c_name_(c_name),
transport_(outgoing_transport) {
- DCHECK_LT(c_name_.length(), kRtcpCnameSize) << "Invalid config";
+ DCHECK_LT(static_cast<int>(c_name_.length()),
+ kRtcpCnameSize) << "Invalid config";
}
RtcpSender::~RtcpSender() {}
diff --git a/media/cast/rtcp/rtcp_sender_unittest.cc b/media/cast/rtcp/rtcp_sender_unittest.cc
index b7daf37..b05f7bb 100644
--- a/media/cast/rtcp/rtcp_sender_unittest.cc
+++ b/media/cast/rtcp/rtcp_sender_unittest.cc
@@ -32,12 +32,12 @@ class TestRtcpTransport : public PacedPacketSender {
}
virtual bool SendPacket(const std::vector<uint8>& packet,
- int num_of_packets) {
+ int num_of_packets) OVERRIDE {
return false;
}
virtual bool ResendPacket(const std::vector<uint8>& packet,
- int num_of_packets) {
+ int num_of_packets) OVERRIDE {
return false;
}
@@ -228,7 +228,7 @@ TEST_F(RtcpSenderTest, RtcpReceiverReportWithCast) {
RtcpCastMessage cast_message(kMediaSsrc);
cast_message.ack_frame_id_ = kAckFrameId;
- std::set<uint16_t> missing_packets;
+ std::set<uint16> missing_packets;
cast_message.missing_frames_and_packets_[
kLostFrameId] = missing_packets;
diff --git a/media/cast/rtcp/rtcp_unittest.cc b/media/cast/rtcp/rtcp_unittest.cc
index dfcc6ea..645e7a4 100644
--- a/media/cast/rtcp/rtcp_unittest.cc
+++ b/media/cast/rtcp/rtcp_unittest.cc
@@ -96,9 +96,9 @@ class RtcpTest : public ::testing::Test {
base::TimeDelta::FromMilliseconds(kStartMillisecond));
}
- ~RtcpTest() {}
+ virtual ~RtcpTest() {}
- void SetUp() {
+ virtual void SetUp() {
EXPECT_CALL(mock_sender_feedback_, OnReceivedReportBlock(_)).Times(0);
EXPECT_CALL(mock_sender_feedback_, OnReceivedIntraFrameRequest()).Times(0);
EXPECT_CALL(mock_sender_feedback_, OnReceivedRpsi(_, _)).Times(0);
@@ -203,7 +203,7 @@ TEST_F(RtcpTest, BasicCast) {
rtcp.SetRemoteSSRC(kSenderSsrc);
RtcpCastMessage cast_message(kSenderSsrc);
cast_message.ack_frame_id_ = kAckFrameId;
- std::set<uint16_t> missing_packets;
+ std::set<uint16> missing_packets;
cast_message.missing_frames_and_packets_[
kLostFrameId] = missing_packets;
diff --git a/media/cast/rtcp/test_rtcp_packet_builder.cc b/media/cast/rtcp/test_rtcp_packet_builder.cc
index d6468e5..c3938bd 100644
--- a/media/cast/rtcp/test_rtcp_packet_builder.cc
+++ b/media/cast/rtcp/test_rtcp_packet_builder.cc
@@ -45,7 +45,8 @@ void TestRtcpPacketBuilder::AddSdesCname(uint32 sender_ssrc,
AddRtcpHeader(202, 1);
big_endian_writer_.WriteU32(sender_ssrc);
big_endian_writer_.WriteU8(1); // c_name.
- big_endian_writer_.WriteU8(c_name.size()); // c_name length in bytes.
+ big_endian_writer_.WriteU8(
+ static_cast<uint8>(c_name.size())); // c_name length in bytes.
for (size_t i = 0; i < c_name.size(); ++i) {
big_endian_writer_.WriteU8(c_name.c_str()[i]);
}
diff --git a/media/cast/rtcp/test_rtcp_packet_builder.h b/media/cast/rtcp/test_rtcp_packet_builder.h
index be93f0a..4c5cc89 100644
--- a/media/cast/rtcp/test_rtcp_packet_builder.h
+++ b/media/cast/rtcp/test_rtcp_packet_builder.h
@@ -13,6 +13,8 @@
namespace media {
namespace cast {
+// These values are arbitrary only for the purpose of testing.
+
// Sender report.
static const int kNtpHigh = 0x01020304;
static const int kNtpLow = 0x05060708;
@@ -32,7 +34,7 @@ static const int kLastRr = 0x34561234;
static const int kDelayLastRr = 1000;
// REMB.
-static const int kRembBitrate = 524286;
+static const int kRembBitrate = 52428;
// RPSI.
static const int kPayloadtype = 126;
@@ -90,5 +92,3 @@ class TestRtcpPacketBuilder {
} // namespace media
#endif // MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_
-
-
diff --git a/media/cast/rtp_common/mock_rtp_payload_feedback.cc b/media/cast/rtp_common/mock_rtp_payload_feedback.cc
new file mode 100644
index 0000000..28b0b02
--- /dev/null
+++ b/media/cast/rtp_common/mock_rtp_payload_feedback.cc
@@ -0,0 +1,17 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/cast/rtp_common/mock_rtp_payload_feedback.h"
+
+namespace media {
+namespace cast {
+
+MockRtpPayloadFeedback::MockRtpPayloadFeedback() {
+}
+
+MockRtpPayloadFeedback::~MockRtpPayloadFeedback() {
+}
+
+} // namespace cast
+} // namespace media
diff --git a/media/cast/rtp_common/mock_rtp_payload_feedback.h b/media/cast/rtp_common/mock_rtp_payload_feedback.h
index d962ff8..c054791 100644
--- a/media/cast/rtp_common/mock_rtp_payload_feedback.h
+++ b/media/cast/rtp_common/mock_rtp_payload_feedback.h
@@ -13,6 +13,9 @@ namespace cast {
class MockRtpPayloadFeedback : public RtpPayloadFeedback {
public:
+ MockRtpPayloadFeedback();
+ virtual ~MockRtpPayloadFeedback();
+
MOCK_METHOD1(CastFeedback,
void(const RtcpCastMessage& cast_feedback));
};
diff --git a/media/cast/rtp_receiver/receiver_stats_unittest.cc b/media/cast/rtp_receiver/receiver_stats_unittest.cc
index c6cf91a..f21e31e 100644
--- a/media/cast/rtp_receiver/receiver_stats_unittest.cc
+++ b/media/cast/rtp_receiver/receiver_stats_unittest.cc
@@ -30,7 +30,7 @@ class ReceiverStatsTest : public ::testing::Test {
start_time_ = testing_clock_.NowTicks();
delta_increments_ = base::TimeDelta::FromMilliseconds(kStdTimeIncrementMs);
}
- ~ReceiverStatsTest() {}
+ virtual ~ReceiverStatsTest() {}
virtual void SetUp() {
rtp_header_.webrtc.header.sequenceNumber = 0;
diff --git a/media/cast/rtp_receiver/rtp_parser/rtp_parser.gypi b/media/cast/rtp_receiver/rtp_parser/rtp_parser.gyp
index 0814e55..ade15ee 100644
--- a/media/cast/rtp_receiver/rtp_parser/rtp_parser.gypi
+++ b/media/cast/rtp_receiver/rtp_parser/rtp_parser.gyp
@@ -12,7 +12,6 @@
'<(DEPTH)/third_party/',
],
'sources': [
- 'rtp_parser_config.h',
'rtp_parser.cc',
'rtp_parser.h',
], # source
diff --git a/media/cast/rtp_receiver/rtp_parser/rtp_parser_unittest.cc b/media/cast/rtp_receiver/rtp_parser/rtp_parser_unittest.cc
index 71e6f50..7360429 100644
--- a/media/cast/rtp_receiver/rtp_parser/rtp_parser_unittest.cc
+++ b/media/cast/rtp_receiver/rtp_parser/rtp_parser_unittest.cc
@@ -27,15 +27,15 @@ class RtpDataTest : public RtpData {
expected_header_.reset(new RtpCastHeader());
}
- ~RtpDataTest() {}
+ virtual ~RtpDataTest() {}
void SetExpectedHeader(const RtpCastHeader& cast_header) {
memcpy(expected_header_.get(), &cast_header, sizeof(RtpCastHeader));
}
- void OnReceivedPayloadData(const uint8* payloadData,
- int payloadSize,
- const RtpCastHeader* rtpHeader) {
+ virtual void OnReceivedPayloadData(const uint8* payloadData,
+ int payloadSize,
+ const RtpCastHeader* rtpHeader) OVERRIDE {
VerifyCommonHeader(*rtpHeader);
VerifyCastHeader(*rtpHeader);
// TODO(mikhal): Add data verification.
@@ -69,7 +69,7 @@ class RtpParserTest : public ::testing::Test {
rtp_parser_.reset(new RtpParser(rtp_data_.get(), config_));
}
- ~RtpParserTest() {}
+ virtual ~RtpParserTest() {}
virtual void SetUp() {
cast_header_.InitRTPVideoHeaderCast();
diff --git a/media/cast/rtp_receiver/rtp_parser/test/rtp_packet_builder.cc b/media/cast/rtp_receiver/rtp_parser/test/rtp_packet_builder.cc
index 9f61d9b..d667dee 100644
--- a/media/cast/rtp_receiver/rtp_parser/test/rtp_packet_builder.cc
+++ b/media/cast/rtp_receiver/rtp_parser/test/rtp_packet_builder.cc
@@ -10,8 +10,8 @@
namespace media {
namespace cast {
-const int kCastRtpHeaderLength = 7;
-const int kGenericRtpHeaderLength = 12;
+const uint32 kCastRtpHeaderLength = 7;
+const uint32 kGenericRtpHeaderLength = 12;
RtpPacketBuilder::RtpPacketBuilder()
: is_key_(false),
diff --git a/media/cast/rtp_receiver/rtp_receiver.gyp b/media/cast/rtp_receiver/rtp_receiver.gyp
index c1d4d5a..7bc25c5 100644
--- a/media/cast/rtp_receiver/rtp_receiver.gyp
+++ b/media/cast/rtp_receiver/rtp_receiver.gyp
@@ -20,7 +20,7 @@
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/base/base.gyp:test_support_base',
- 'rtp_parser/rtp_parser.gypi:*',
+ 'rtp_parser/rtp_parser.gyp:*',
],
},
],
diff --git a/media/cast/rtp_sender/packet_storage/packet_storage.gypi b/media/cast/rtp_sender/packet_storage/packet_storage.gyp
index f691d9e..f691d9e 100644
--- a/media/cast/rtp_sender/packet_storage/packet_storage.gypi
+++ b/media/cast/rtp_sender/packet_storage/packet_storage.gyp
diff --git a/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer.gypi b/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer.gyp
index 09ceb3b..df10edad 100644
--- a/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer.gypi
+++ b/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer.gyp
@@ -15,6 +15,8 @@
'sources': [
'rtp_packetizer.cc',
'rtp_packetizer.h',
+ 'rtp_packetizer_config.cc',
+ 'rtp_packetizer_config.h',
], # source
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
diff --git a/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_config.cc b/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_config.cc
new file mode 100644
index 0000000..1e1d14c
--- /dev/null
+++ b/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_config.cc
@@ -0,0 +1,21 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_config.h"
+
+namespace media {
+namespace cast {
+
+RtpPacketizerConfig::RtpPacketizerConfig()
+ : ssrc(0),
+ max_payload_length(kIpPacketSize - 28), // Default is IP-v4/UDP.
+ audio(false),
+ frequency(8000),
+ payload_type(-1),
+ sequence_number(0),
+ rtp_timestamp(0) {
+}
+
+} // namespace cast
+} // namespace media
diff --git a/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_config.h b/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_config.h
index cd005d5..26208f5 100644
--- a/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_config.h
+++ b/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_config.h
@@ -12,15 +12,7 @@ namespace media {
namespace cast {
struct RtpPacketizerConfig {
- RtpPacketizerConfig() {
- ssrc = 0;
- max_payload_length = kIpPacketSize - 28; // Default is IP-v4/UDP.
- audio = false;
- frequency = 8000;
- payload_type = -1;
- sequence_number = 0;
- rtp_timestamp = 0;
- }
+ RtpPacketizerConfig();
// General.
bool audio;
diff --git a/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_unittest.cc b/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_unittest.cc
index bed7cba..b65271f 100644
--- a/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_unittest.cc
+++ b/media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_unittest.cc
@@ -102,9 +102,9 @@ class RtpPacketizerTest : public ::testing::Test {
new RtpPacketizer(transport_.get(), &packet_storage_, config_));
}
- ~RtpPacketizerTest() {}
+ virtual ~RtpPacketizerTest() {}
- void SetUp() {
+ virtual void SetUp() {
video_frame_.key_frame = false;
video_frame_.frame_id = kFrameId;
video_frame_.last_referenced_frame_id = kFrameId - 1;
diff --git a/media/cast/rtp_sender/rtp_sender.gyp b/media/cast/rtp_sender/rtp_sender.gyp
index 77722c9..ff85956 100644
--- a/media/cast/rtp_sender/rtp_sender.gyp
+++ b/media/cast/rtp_sender/rtp_sender.gyp
@@ -19,8 +19,8 @@
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/base/base.gyp:test_support_base',
- 'packet_storage/packet_storage.gypi:*',
- 'rtp_packetizer/rtp_packetizer.gypi:*',
+ 'packet_storage/packet_storage.gyp:*',
+ 'rtp_packetizer/rtp_packetizer.gyp:*',
],
},
],
diff --git a/media/cast/video_receiver/codecs/vp8/vp8_decoder.cc b/media/cast/video_receiver/codecs/vp8/vp8_decoder.cc
index 93d3eb5..c347018 100644
--- a/media/cast/video_receiver/codecs/vp8/vp8_decoder.cc
+++ b/media/cast/video_receiver/codecs/vp8/vp8_decoder.cc
@@ -35,7 +35,7 @@ bool Vp8Decoder::Decode(const EncodedVideoFrame& input_image,
vpx_image_t* img;
if (vpx_codec_decode(decoder_.get(),
input_image.data.data(),
- input_image.data.size(),
+ static_cast<unsigned int>(input_image.data.size()),
0,
1 /* real time*/)) {
return false;
diff --git a/media/cast/video_receiver/video_decoder.h b/media/cast/video_receiver/video_decoder.h
index abf1955..203683277 100644
--- a/media/cast/video_receiver/video_decoder.h
+++ b/media/cast/video_receiver/video_decoder.h
@@ -21,8 +21,6 @@ class VideoDecoder : public base::RefCountedThreadSafe<VideoDecoder>{
public:
VideoDecoder(scoped_refptr<CastThread> cast_thread,
const VideoReceiverConfig& video_config);
- ~VideoDecoder();
-
// Decode a video frame. Decoded (raw) frame will be returned in the
// frame_decoded_callback.
@@ -31,7 +29,12 @@ class VideoDecoder : public base::RefCountedThreadSafe<VideoDecoder>{
const VideoFrameDecodedCallback& frame_decoded_callback,
base::Closure frame_release_callback);
+ protected:
+ virtual ~VideoDecoder();
+
private:
+ friend class base::RefCountedThreadSafe<VideoDecoder>;
+
void DecodeFrame(const EncodedVideoFrame* encoded_frame,
const base::TimeTicks render_time,
const VideoFrameDecodedCallback& frame_decoded_callback);
diff --git a/media/cast/video_receiver/video_decoder_unittest.cc b/media/cast/video_receiver/video_decoder_unittest.cc
index c511681..e61c5c9 100644
--- a/media/cast/video_receiver/video_decoder_unittest.cc
+++ b/media/cast/video_receiver/video_decoder_unittest.cc
@@ -36,7 +36,13 @@ class TestVideoDecoderCallback :
}
int number_times_called() {return num_called_;}
+
+ protected:
+ virtual ~TestVideoDecoderCallback() {}
+
private:
+ friend class base::RefCountedThreadSafe<TestVideoDecoderCallback>;
+
int num_called_;
};
@@ -49,7 +55,7 @@ class VideoDecoderTest : public ::testing::Test {
video_decoder_callback_ = new TestVideoDecoderCallback();
}
- ~VideoDecoderTest() {}
+ virtual ~VideoDecoderTest() {}
virtual void SetUp() {
task_runner_ = new test::FakeTaskRunner(&testing_clock_);
cast_thread_ = new CastThread(task_runner_, NULL, NULL,
diff --git a/media/cast/video_receiver/video_receiver.cc b/media/cast/video_receiver/video_receiver.cc
index c9c7590..0d5428f 100644
--- a/media/cast/video_receiver/video_receiver.cc
+++ b/media/cast/video_receiver/video_receiver.cc
@@ -29,7 +29,7 @@ class LocalRtpVideoData : public RtpData {
time_updated_(false),
incoming_rtp_timestamp_(0) {
}
- ~LocalRtpVideoData() {}
+ virtual ~LocalRtpVideoData() {}
virtual void OnReceivedPayloadData(const uint8* payload_data,
int payload_size,
@@ -77,10 +77,6 @@ class LocalRtpVideoFeedback : public RtpPayloadFeedback {
video_receiver_->CastFeedback(cast_message);
}
- virtual void RequestKeyFrame() OVERRIDE {
- video_receiver_->RequestKeyFrame();
- }
-
private:
VideoReceiver* video_receiver_;
};
diff --git a/media/cast/video_receiver/video_receiver_unittest.cc b/media/cast/video_receiver/video_receiver_unittest.cc
index 00fc9bd..dc1d692 100644
--- a/media/cast/video_receiver/video_receiver_unittest.cc
+++ b/media/cast/video_receiver/video_receiver_unittest.cc
@@ -33,7 +33,13 @@ class TestVideoReceiverCallback :
++num_called_;
}
int number_times_called() { return num_called_;}
+
+ protected:
+ virtual ~TestVideoReceiverCallback() {}
+
private:
+ friend class base::RefCountedThreadSafe<TestVideoReceiverCallback>;
+
int num_called_;
};
@@ -65,7 +71,7 @@ class VideoReceiverTest : public ::testing::Test {
receiver_->set_clock(&testing_clock_);
}
- ~VideoReceiverTest() {}
+ virtual ~VideoReceiverTest() {}
virtual void SetUp() {
payload_.assign(kPacketSize, 0);
diff --git a/media/cast/video_sender/codecs/vp8/vp8_encoder.cc b/media/cast/video_sender/codecs/vp8/vp8_encoder.cc
index eaf6fbd..a0bdb1b 100644
--- a/media/cast/video_sender/codecs/vp8/vp8_encoder.cc
+++ b/media/cast/video_sender/codecs/vp8/vp8_encoder.cc
@@ -161,7 +161,7 @@ bool Vp8Encoder::Encode(const I420VideoFrame& input_image,
int total_size = 0;
while ((pkt = vpx_codec_get_cx_data(encoder_, &iter)) != NULL) {
if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
- total_size += pkt->data.frame.sz;
+ total_size += static_cast<int>(pkt->data.frame.sz);
encoded_image->data.reserve(total_size);
encoded_image->data.insert(
encoded_image->data.end(),
diff --git a/media/cast/video_sender/mock_video_encoder_controller.cc b/media/cast/video_sender/mock_video_encoder_controller.cc
new file mode 100644
index 0000000..4f649aa
--- /dev/null
+++ b/media/cast/video_sender/mock_video_encoder_controller.cc
@@ -0,0 +1,17 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/cast/video_sender/mock_video_encoder_controller.h"
+
+namespace media {
+namespace cast {
+
+MockVideoEncoderController::MockVideoEncoderController() {
+}
+
+MockVideoEncoderController::~MockVideoEncoderController() {
+}
+
+} // namespace cast
+} // namespace media
diff --git a/media/cast/video_sender/mock_video_encoder_controller.h b/media/cast/video_sender/mock_video_encoder_controller.h
index 90b2abd..a97bcb1 100644
--- a/media/cast/video_sender/mock_video_encoder_controller.h
+++ b/media/cast/video_sender/mock_video_encoder_controller.h
@@ -13,6 +13,9 @@ namespace cast {
class MockVideoEncoderController : public VideoEncoderController {
public:
+ MockVideoEncoderController();
+ virtual ~MockVideoEncoderController();
+
MOCK_METHOD1(SetBitRate, void(int new_bit_rate));
MOCK_METHOD1(SkipNextFrame, void(bool skip_next_frame));
diff --git a/media/cast/video_sender/video_encoder.cc b/media/cast/video_sender/video_encoder.cc
index 94a296c..8377b2c 100644
--- a/media/cast/video_sender/video_encoder.cc
+++ b/media/cast/video_sender/video_encoder.cc
@@ -85,26 +85,26 @@ void VideoEncoder::EncodeVideoFrameEncoderThread(
}
// Inform the encoder about the new target bit rate.
-void VideoEncoder::SetBitRate(int new_bit_rate) OVERRIDE {
+void VideoEncoder::SetBitRate(int new_bit_rate) {
dynamic_config_.bit_rate = new_bit_rate;
}
// Inform the encoder to not encode the next frame.
-void VideoEncoder::SkipNextFrame(bool skip_next_frame) OVERRIDE {
+void VideoEncoder::SkipNextFrame(bool skip_next_frame) {
skip_next_frame_ = skip_next_frame;
}
// Inform the encoder to encode the next frame as a key frame.
-void VideoEncoder::GenerateKeyFrame() OVERRIDE {
+void VideoEncoder::GenerateKeyFrame() {
dynamic_config_.key_frame_requested = true;
}
// Inform the encoder to only reference frames older or equal to frame_id;
-void VideoEncoder::LatestFrameIdToReference(uint8 frame_id) OVERRIDE {
+void VideoEncoder::LatestFrameIdToReference(uint8 frame_id) {
dynamic_config_.latest_frame_id_to_reference = frame_id;
}
-int VideoEncoder::NumberOfSkippedFrames() const OVERRIDE {
+int VideoEncoder::NumberOfSkippedFrames() const {
return skip_count_;
}
diff --git a/media/cast/video_sender/video_encoder.h b/media/cast/video_sender/video_encoder.h
index d3b261e..d3089bd 100644
--- a/media/cast/video_sender/video_encoder.h
+++ b/media/cast/video_sender/video_encoder.h
@@ -27,8 +27,6 @@ class VideoEncoder : public VideoEncoderController,
const VideoSenderConfig& video_config,
uint8 max_unacked_frames);
- virtual ~VideoEncoder();
-
// Called from the main cast thread. This function post the encode task to the
// video encoder thread;
// The video_frame must be valid until the closure callback is called.
@@ -42,6 +40,8 @@ class VideoEncoder : public VideoEncoderController,
const base::Closure frame_release_callback);
protected:
+ virtual ~VideoEncoder();
+
struct CodecDynamicConfig {
bool key_frame_requested;
uint8 latest_frame_id_to_reference;
@@ -64,6 +64,8 @@ class VideoEncoder : public VideoEncoderController,
virtual int NumberOfSkippedFrames() const OVERRIDE;
private:
+ friend class base::RefCountedThreadSafe<VideoEncoder>;
+
const VideoSenderConfig video_config_;
scoped_refptr<CastThread> cast_thread_;
scoped_ptr<Vp8Encoder> vp8_encoder_;
diff --git a/media/cast/video_sender/video_encoder_unittest.cc b/media/cast/video_sender/video_encoder_unittest.cc
index d18a043..509c1de 100644
--- a/media/cast/video_sender/video_encoder_unittest.cc
+++ b/media/cast/video_sender/video_encoder_unittest.cc
@@ -46,7 +46,12 @@ class TestVideoEncoderCallback :
EXPECT_EQ(expected_capture_time_, capture_time);
}
+ protected:
+ virtual ~TestVideoEncoderCallback() {}
+
private:
+ friend class base::RefCountedThreadSafe<TestVideoEncoderCallback>;
+
bool expected_key_frame_;
uint8 expected_frame_id_;
uint8 expected_last_referenced_frame_id_;
@@ -85,7 +90,7 @@ class VideoEncoderTest : public ::testing::Test {
video_frame_.v_plane.data = &(pixels_[0]);
}
- ~VideoEncoderTest() {}
+ virtual ~VideoEncoderTest() {}
virtual void SetUp() {
task_runner_ = new test::FakeTaskRunner(&testing_clock_);
diff --git a/media/cast/video_sender/video_sender.cc b/media/cast/video_sender/video_sender.cc
index 1b42238..120a1b8 100644
--- a/media/cast/video_sender/video_sender.cc
+++ b/media/cast/video_sender/video_sender.cc
@@ -24,7 +24,7 @@ class LocalRtcpVideoSenderFeedback : public RtcpSenderFeedback {
: video_sender_(video_sender) {
}
- virtual void OnReceivedSendReportRequest() OVERRIDE {}
+ virtual void OnReceivedSendReportRequest() {}
virtual void OnReceivedReportBlock(
const RtcpReportBlock& report_block) OVERRIDE {}
diff --git a/media/cast/video_sender/video_sender_unittest.cc b/media/cast/video_sender/video_sender_unittest.cc
index 72582a7..8e88530 100644
--- a/media/cast/video_sender/video_sender_unittest.cc
+++ b/media/cast/video_sender/video_sender_unittest.cc
@@ -53,7 +53,7 @@ class VideoSenderTest : public ::testing::Test {
base::TimeDelta::FromMilliseconds(kStartMillisecond));
}
- ~VideoSenderTest() {}
+ virtual ~VideoSenderTest() {}
void InitEncoder(bool external) {
VideoSenderConfig video_config;