| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 : decode_task_runner_(decode_task_runner), | 51 : decode_task_runner_(decode_task_runner), |
| 52 consumer_(consumer), | 52 consumer_(consumer), |
| 53 perf_tracker_(perf_tracker), | 53 perf_tracker_(perf_tracker), |
| 54 weak_factory_(this) {} | 54 weak_factory_(this) {} |
| 55 | 55 |
| 56 SoftwareVideoRenderer::~SoftwareVideoRenderer() { | 56 SoftwareVideoRenderer::~SoftwareVideoRenderer() { |
| 57 if (decoder_) | 57 if (decoder_) |
| 58 decode_task_runner_->DeleteSoon(FROM_HERE, decoder_.release()); | 58 decode_task_runner_->DeleteSoon(FROM_HERE, decoder_.release()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool SoftwareVideoRenderer::Initialize( |
| 62 const ClientContext& client_context, |
| 63 protocol::PerformanceTracker* perf_tracker) { |
| 64 // SoftwareVideoRenderer should be fully initialized after it is constructed. |
| 65 return true; |
| 66 } |
| 67 |
| 61 void SoftwareVideoRenderer::OnSessionConfig( | 68 void SoftwareVideoRenderer::OnSessionConfig( |
| 62 const protocol::SessionConfig& config) { | 69 const protocol::SessionConfig& config) { |
| 63 DCHECK(thread_checker_.CalledOnValidThread()); | 70 DCHECK(thread_checker_.CalledOnValidThread()); |
| 64 | 71 |
| 65 // Initialize decoder based on the selected codec. | 72 // Initialize decoder based on the selected codec. |
| 66 ChannelConfig::Codec codec = config.video_config().codec; | 73 ChannelConfig::Codec codec = config.video_config().codec; |
| 67 if (codec == ChannelConfig::CODEC_VERBATIM) { | 74 if (codec == ChannelConfig::CODEC_VERBATIM) { |
| 68 decoder_.reset(new VideoDecoderVerbatim()); | 75 decoder_.reset(new VideoDecoderVerbatim()); |
| 69 } else if (codec == ChannelConfig::CODEC_VP8) { | 76 } else if (codec == ChannelConfig::CODEC_VP8) { |
| 70 decoder_ = VideoDecoderVpx::CreateForVP8(); | 77 decoder_ = VideoDecoderVpx::CreateForVP8(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 174 |
| 168 stats->time_rendered = base::TimeTicks::Now(); | 175 stats->time_rendered = base::TimeTicks::Now(); |
| 169 if (perf_tracker_) | 176 if (perf_tracker_) |
| 170 perf_tracker_->RecordVideoFrameStats(*stats); | 177 perf_tracker_->RecordVideoFrameStats(*stats); |
| 171 | 178 |
| 172 if (!done.is_null()) | 179 if (!done.is_null()) |
| 173 done.Run(); | 180 done.Run(); |
| 174 } | 181 } |
| 175 | 182 |
| 176 } // namespace remoting | 183 } // namespace remoting |
| OLD | NEW |