From d0247b1b59f9c528cb6df88b4f2b9afaf80d181e Mon Sep 17 00:00:00 2001 From: "Torne (Richard Coles)" Date: Thu, 19 Sep 2013 22:36:51 +0100 Subject: Merge from Chromium at DEPS revision 224184 This commit was generated by merge_to_master.py. Change-Id: Ia3424df5abed9bea642c522b9e2358dceabd8423 --- remoting/host/DEPS | 2 ++ remoting/host/audio_silence_detector.h | 2 +- remoting/host/client_session.cc | 11 +++-------- remoting/host/mouse_clamping_filter.cc | 5 +++-- remoting/host/plugin/host_plugin.cc | 2 +- remoting/host/video_scheduler.cc | 31 +++++++++---------------------- remoting/host/video_scheduler_unittest.cc | 14 +++++++------- 7 files changed, 26 insertions(+), 41 deletions(-) (limited to 'remoting/host') diff --git a/remoting/host/DEPS b/remoting/host/DEPS index 90d75cab0f..6a826365ae 100644 --- a/remoting/host/DEPS +++ b/remoting/host/DEPS @@ -4,9 +4,11 @@ include_rules = [ "+remoting/codec", "+remoting/jingle_glue", "+remoting/protocol", + "+skia/ext", "+third_party/jsoncpp", "+third_party/modp_b64", "+third_party/npapi", + "+third_party/skia/include/core", "+third_party/webrtc", "+ui", ] diff --git a/remoting/host/audio_silence_detector.h b/remoting/host/audio_silence_detector.h index 4bc686e8a6..83beec36a9 100644 --- a/remoting/host/audio_silence_detector.h +++ b/remoting/host/audio_silence_detector.h @@ -39,4 +39,4 @@ class AudioSilenceDetector { } // namespace remoting -#endif // REMOTING_HOST_AUDIO_SILENCE_DETECTOR_H_ \ No newline at end of file +#endif // REMOTING_HOST_AUDIO_SILENCE_DETECTOR_H_ diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index 45439f490c..67f4a952b7 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc @@ -10,7 +10,6 @@ #include "remoting/base/capabilities.h" #include "remoting/codec/audio_encoder.h" #include "remoting/codec/audio_encoder_opus.h" -#include "remoting/codec/audio_encoder_speex.h" #include "remoting/codec/audio_encoder_verbatim.h" #include "remoting/codec/video_encoder.h" #include "remoting/codec/video_encoder_verbatim.h" @@ -427,13 +426,11 @@ scoped_ptr ClientSession::CreateVideoEncoder( const protocol::SessionConfig& config) { const protocol::ChannelConfig& video_config = config.video_config(); - if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { - return scoped_ptr(new remoting::VideoEncoderVerbatim()); - } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { + if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { return scoped_ptr(new remoting::VideoEncoderVp8()); } - NOTIMPLEMENTED(); + NOTREACHED(); return scoped_ptr(); } @@ -444,13 +441,11 @@ scoped_ptr ClientSession::CreateAudioEncoder( if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { return scoped_ptr(new AudioEncoderVerbatim()); - } else if (audio_config.codec == protocol::ChannelConfig::CODEC_SPEEX) { - return scoped_ptr(new AudioEncoderSpeex()); } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { return scoped_ptr(new AudioEncoderOpus()); } - NOTIMPLEMENTED(); + NOTREACHED(); return scoped_ptr(); } diff --git a/remoting/host/mouse_clamping_filter.cc b/remoting/host/mouse_clamping_filter.cc index db01c103b2..91462fa307 100644 --- a/remoting/host/mouse_clamping_filter.cc +++ b/remoting/host/mouse_clamping_filter.cc @@ -24,8 +24,9 @@ void MouseClampingFilter::ProcessVideoPacket( // Configure the MouseInputFilter to clamp to the video dimensions. if (video_packet->format().has_screen_width() && video_packet->format().has_screen_height()) { - SkISize screen_size = SkISize::Make(video_packet->format().screen_width(), - video_packet->format().screen_height()); + webrtc::DesktopSize screen_size = + webrtc::DesktopSize(video_packet->format().screen_width(), + video_packet->format().screen_height()); input_filter_.set_input_size(screen_size); input_filter_.set_output_size(screen_size); } diff --git a/remoting/host/plugin/host_plugin.cc b/remoting/host/plugin/host_plugin.cc index b8e2b13f68..f281bd1200 100644 --- a/remoting/host/plugin/host_plugin.cc +++ b/remoting/host/plugin/host_plugin.cc @@ -21,7 +21,7 @@ #include "remoting/host/plugin/host_plugin_utils.h" #include "remoting/host/plugin/host_script_object.h" #if defined(OS_WIN) -#include "ui/gfx/dpi_win.h" +#include "ui/gfx/win/dpi.h" #endif #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/npfunctions.h" diff --git a/remoting/host/video_scheduler.cc b/remoting/host/video_scheduler.cc index 883166b39c..5c95c7a938 100644 --- a/remoting/host/video_scheduler.cc +++ b/remoting/host/video_scheduler.cc @@ -249,11 +249,8 @@ void VideoScheduler::SendVideoPacket(scoped_ptr packet) { if (!video_stub_) return; - base::Closure callback; - if ((packet->flags() & VideoPacket::LAST_PARTITION) != 0) - callback = base::Bind(&VideoScheduler::VideoFrameSentCallback, this); - - video_stub_->ProcessVideoPacket(packet.Pass(), callback); + video_stub_->ProcessVideoPacket( + packet.Pass(), base::Bind(&VideoScheduler::VideoFrameSentCallback, this)); } void VideoScheduler::VideoFrameSentCallback() { @@ -286,7 +283,6 @@ void VideoScheduler::EncodeFrame( // If there is nothing to encode then send an empty keep-alive packet. if (!frame || frame->updated_region().is_empty()) { scoped_ptr packet(new VideoPacket()); - packet->set_flags(VideoPacket::LAST_PARTITION); packet->set_client_sequence_number(sequence_number); network_task_runner_->PostTask( FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this, @@ -295,25 +291,16 @@ void VideoScheduler::EncodeFrame( return; } - encoder_->Encode( - frame.get(), base::Bind(&VideoScheduler::EncodedDataAvailableCallback, - this, sequence_number)); - capture_task_runner_->DeleteSoon(FROM_HERE, frame.release()); -} - -void VideoScheduler::EncodedDataAvailableCallback( - int64 sequence_number, - scoped_ptr packet) { - DCHECK(encode_task_runner_->BelongsToCurrentThread()); - + scoped_ptr packet = encoder_->Encode(*frame); packet->set_client_sequence_number(sequence_number); - bool last = (packet->flags() & VideoPacket::LAST_PACKET) != 0; - if (last) { - scheduler_.RecordEncodeTime( - base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); - } + // Destroy the frame before sending |packet| because SendVideoPacket() may + // trigger another frame to be captured, and the screen capturer expects the + // old frame to be freed by then. + frame.reset(); + scheduler_.RecordEncodeTime( + base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); network_task_runner_->PostTask( FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this, base::Passed(&packet))); diff --git a/remoting/host/video_scheduler_unittest.cc b/remoting/host/video_scheduler_unittest.cc index 2dd7afbf19..25567d27ba 100644 --- a/remoting/host/video_scheduler_unittest.cc +++ b/remoting/host/video_scheduler_unittest.cc @@ -37,8 +37,7 @@ namespace { ACTION(FinishEncode) { scoped_ptr packet(new VideoPacket()); - packet->set_flags(VideoPacket::LAST_PACKET | VideoPacket::LAST_PARTITION); - arg1.Run(packet.Pass()); + return packet.release(); } ACTION(FinishSend) { @@ -55,9 +54,11 @@ class MockVideoEncoder : public VideoEncoder { MockVideoEncoder(); virtual ~MockVideoEncoder(); - MOCK_METHOD2(Encode, void( - const webrtc::DesktopFrame* frame, - const DataAvailableCallback& data_available_callback)); + scoped_ptr Encode( + const webrtc::DesktopFrame& frame) { + return scoped_ptr(EncodePtr(frame)); + } + MOCK_METHOD1(EncodePtr, VideoPacket*(const webrtc::DesktopFrame& frame)); private: DISALLOW_COPY_AND_ASSIGN(MockVideoEncoder); @@ -158,7 +159,6 @@ TEST_F(VideoSchedulerTest, StartAndStop) { frame_.reset(new webrtc::BasicDesktopFrame( webrtc::DesktopSize(kWidth, kHeight))); - webrtc::DesktopFrame* frame_ptr = frame_.get(); // First the capturer is called. Expectation capturer_capture = EXPECT_CALL(*capturer, Capture(_)) @@ -166,7 +166,7 @@ TEST_F(VideoSchedulerTest, StartAndStop) { .WillRepeatedly(Invoke(this, &VideoSchedulerTest::OnCaptureFrame)); // Expect the encoder be called. - EXPECT_CALL(*encoder_, Encode(frame_ptr, _)) + EXPECT_CALL(*encoder_, EncodePtr(_)) .WillRepeatedly(FinishEncode()); // By default delete the arguments when ProcessVideoPacket is received. -- cgit v1.2.3