OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/client/software_video_renderer.h" | 5 #include "remoting/client/software_video_renderer.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "remoting/base/util.h" | 15 #include "remoting/base/util.h" |
16 #include "remoting/client/frame_consumer.h" | 16 #include "remoting/client/frame_consumer.h" |
17 #include "remoting/codec/video_decoder.h" | 17 #include "remoting/codec/video_decoder.h" |
18 #include "remoting/codec/video_decoder_verbatim.h" | 18 #include "remoting/codec/video_decoder_verbatim.h" |
19 #if !defined(MEDIA_DISABLE_LIBVPX) | |
20 #include "remoting/codec/video_decoder_vpx.h" | 19 #include "remoting/codec/video_decoder_vpx.h" |
21 #endif // !defined(MEDIA_DISABLE_LIBVPX) | |
22 #include "remoting/protocol/session_config.h" | 20 #include "remoting/protocol/session_config.h" |
23 #include "third_party/libyuv/include/libyuv/convert_argb.h" | 21 #include "third_party/libyuv/include/libyuv/convert_argb.h" |
24 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 22 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
25 | 23 |
26 using base::Passed; | 24 using base::Passed; |
27 using remoting::protocol::ChannelConfig; | 25 using remoting::protocol::ChannelConfig; |
28 using remoting::protocol::SessionConfig; | 26 using remoting::protocol::SessionConfig; |
29 | 27 |
30 namespace remoting { | 28 namespace remoting { |
31 | 29 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 SoftwareVideoRenderer::Core::~Core() { | 140 SoftwareVideoRenderer::Core::~Core() { |
143 } | 141 } |
144 | 142 |
145 void SoftwareVideoRenderer::Core::Initialize(const SessionConfig& config) { | 143 void SoftwareVideoRenderer::Core::Initialize(const SessionConfig& config) { |
146 DCHECK(decode_task_runner_->BelongsToCurrentThread()); | 144 DCHECK(decode_task_runner_->BelongsToCurrentThread()); |
147 | 145 |
148 // Initialize decoder based on the selected codec. | 146 // Initialize decoder based on the selected codec. |
149 ChannelConfig::Codec codec = config.video_config().codec; | 147 ChannelConfig::Codec codec = config.video_config().codec; |
150 if (codec == ChannelConfig::CODEC_VERBATIM) { | 148 if (codec == ChannelConfig::CODEC_VERBATIM) { |
151 decoder_.reset(new VideoDecoderVerbatim()); | 149 decoder_.reset(new VideoDecoderVerbatim()); |
152 #if !defined(MEDIA_DISABLE_LIBVPX) | |
153 } else if (codec == ChannelConfig::CODEC_VP8) { | 150 } else if (codec == ChannelConfig::CODEC_VP8) { |
154 decoder_ = VideoDecoderVpx::CreateForVP8(); | 151 decoder_ = VideoDecoderVpx::CreateForVP8(); |
155 } else if (codec == ChannelConfig::CODEC_VP9) { | 152 } else if (codec == ChannelConfig::CODEC_VP9) { |
156 decoder_ = VideoDecoderVpx::CreateForVP9(); | 153 decoder_ = VideoDecoderVpx::CreateForVP9(); |
157 } else { | 154 } else { |
158 #endif // !defined(MEDIA_DISABLE_LIBVPX) | |
159 NOTREACHED() << "Invalid Encoding found: " << codec; | 155 NOTREACHED() << "Invalid Encoding found: " << codec; |
160 } | 156 } |
161 | 157 |
162 if (consumer_->GetPixelFormat() == FrameConsumer::FORMAT_RGBA) { | 158 if (consumer_->GetPixelFormat() == FrameConsumer::FORMAT_RGBA) { |
163 scoped_ptr<VideoDecoder> wrapper( | 159 scoped_ptr<VideoDecoder> wrapper( |
164 new RgbToBgrVideoDecoderFilter(decoder_.Pass())); | 160 new RgbToBgrVideoDecoderFilter(decoder_.Pass())); |
165 decoder_ = wrapper.Pass(); | 161 decoder_ = wrapper.Pass(); |
166 } | 162 } |
167 } | 163 } |
168 | 164 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 DCHECK(CalledOnValidThread()); | 416 DCHECK(CalledOnValidThread()); |
421 | 417 |
422 // Record the latency between the packet being received and presented. | 418 // Record the latency between the packet being received and presented. |
423 stats_.video_decode_ms()->Record( | 419 stats_.video_decode_ms()->Record( |
424 (base::Time::Now() - decode_start).InMilliseconds()); | 420 (base::Time::Now() - decode_start).InMilliseconds()); |
425 | 421 |
426 done.Run(); | 422 done.Run(); |
427 } | 423 } |
428 | 424 |
429 } // namespace remoting | 425 } // namespace remoting |
OLD | NEW |