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) |
19 #include "remoting/codec/video_decoder_vpx.h" | 20 #include "remoting/codec/video_decoder_vpx.h" |
| 21 #endif // !defined(MEDIA_DISABLE_LIBVPX) |
20 #include "remoting/protocol/session_config.h" | 22 #include "remoting/protocol/session_config.h" |
21 #include "third_party/libyuv/include/libyuv/convert_argb.h" | 23 #include "third_party/libyuv/include/libyuv/convert_argb.h" |
22 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 24 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
23 | 25 |
24 using base::Passed; | 26 using base::Passed; |
25 using remoting::protocol::ChannelConfig; | 27 using remoting::protocol::ChannelConfig; |
26 using remoting::protocol::SessionConfig; | 28 using remoting::protocol::SessionConfig; |
27 | 29 |
28 namespace remoting { | 30 namespace remoting { |
29 | 31 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 SoftwareVideoRenderer::Core::~Core() { | 142 SoftwareVideoRenderer::Core::~Core() { |
141 } | 143 } |
142 | 144 |
143 void SoftwareVideoRenderer::Core::Initialize(const SessionConfig& config) { | 145 void SoftwareVideoRenderer::Core::Initialize(const SessionConfig& config) { |
144 DCHECK(decode_task_runner_->BelongsToCurrentThread()); | 146 DCHECK(decode_task_runner_->BelongsToCurrentThread()); |
145 | 147 |
146 // Initialize decoder based on the selected codec. | 148 // Initialize decoder based on the selected codec. |
147 ChannelConfig::Codec codec = config.video_config().codec; | 149 ChannelConfig::Codec codec = config.video_config().codec; |
148 if (codec == ChannelConfig::CODEC_VERBATIM) { | 150 if (codec == ChannelConfig::CODEC_VERBATIM) { |
149 decoder_.reset(new VideoDecoderVerbatim()); | 151 decoder_.reset(new VideoDecoderVerbatim()); |
| 152 #if !defined(MEDIA_DISABLE_LIBVPX) |
150 } else if (codec == ChannelConfig::CODEC_VP8) { | 153 } else if (codec == ChannelConfig::CODEC_VP8) { |
151 decoder_ = VideoDecoderVpx::CreateForVP8(); | 154 decoder_ = VideoDecoderVpx::CreateForVP8(); |
152 } else if (codec == ChannelConfig::CODEC_VP9) { | 155 } else if (codec == ChannelConfig::CODEC_VP9) { |
153 decoder_ = VideoDecoderVpx::CreateForVP9(); | 156 decoder_ = VideoDecoderVpx::CreateForVP9(); |
154 } else { | 157 } else { |
| 158 #endif // !defined(MEDIA_DISABLE_LIBVPX) |
155 NOTREACHED() << "Invalid Encoding found: " << codec; | 159 NOTREACHED() << "Invalid Encoding found: " << codec; |
156 } | 160 } |
157 | 161 |
158 if (consumer_->GetPixelFormat() == FrameConsumer::FORMAT_RGBA) { | 162 if (consumer_->GetPixelFormat() == FrameConsumer::FORMAT_RGBA) { |
159 scoped_ptr<VideoDecoder> wrapper( | 163 scoped_ptr<VideoDecoder> wrapper( |
160 new RgbToBgrVideoDecoderFilter(decoder_.Pass())); | 164 new RgbToBgrVideoDecoderFilter(decoder_.Pass())); |
161 decoder_ = wrapper.Pass(); | 165 decoder_ = wrapper.Pass(); |
162 } | 166 } |
163 } | 167 } |
164 | 168 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 DCHECK(CalledOnValidThread()); | 420 DCHECK(CalledOnValidThread()); |
417 | 421 |
418 // Record the latency between the packet being received and presented. | 422 // Record the latency between the packet being received and presented. |
419 stats_.video_decode_ms()->Record( | 423 stats_.video_decode_ms()->Record( |
420 (base::Time::Now() - decode_start).InMilliseconds()); | 424 (base::Time::Now() - decode_start).InMilliseconds()); |
421 | 425 |
422 done.Run(); | 426 done.Run(); |
423 } | 427 } |
424 | 428 |
425 } // namespace remoting | 429 } // namespace remoting |
OLD | NEW |