| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 SoftwareVideoRenderer::SoftwareVideoRenderer(protocol::FrameConsumer* consumer) | 48 SoftwareVideoRenderer::SoftwareVideoRenderer(protocol::FrameConsumer* consumer) |
| 49 : consumer_(consumer), weak_factory_(this) { | 49 : consumer_(consumer), weak_factory_(this) { |
| 50 thread_checker_.DetachFromThread(); | 50 thread_checker_.DetachFromThread(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 SoftwareVideoRenderer::SoftwareVideoRenderer( | 53 SoftwareVideoRenderer::SoftwareVideoRenderer( |
| 54 scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner, | 54 std::unique_ptr<protocol::FrameConsumer> consumer) |
| 55 protocol::FrameConsumer* consumer, | 55 : SoftwareVideoRenderer(consumer.get()) { |
| 56 protocol::FrameStatsConsumer* stats_consumer) | 56 owned_consumer_ = std::move(consumer); |
| 57 : decode_task_runner_(decode_task_runner), | 57 } |
| 58 consumer_(consumer), | |
| 59 stats_consumer_(stats_consumer), | |
| 60 weak_factory_(this) {} | |
| 61 | 58 |
| 62 SoftwareVideoRenderer::~SoftwareVideoRenderer() { | 59 SoftwareVideoRenderer::~SoftwareVideoRenderer() { |
| 63 if (decoder_) | 60 if (decoder_) |
| 64 decode_task_runner_->DeleteSoon(FROM_HERE, decoder_.release()); | 61 decode_task_runner_->DeleteSoon(FROM_HERE, decoder_.release()); |
| 65 } | 62 } |
| 66 | 63 |
| 67 bool SoftwareVideoRenderer::Initialize( | 64 bool SoftwareVideoRenderer::Initialize( |
| 68 const ClientContext& client_context, | 65 const ClientContext& client_context, |
| 69 protocol::FrameStatsConsumer* stats_consumer) { | 66 protocol::FrameStatsConsumer* stats_consumer) { |
| 70 DCHECK(thread_checker_.CalledOnValidThread()); | 67 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 184 |
| 188 stats->client_stats.time_rendered = base::TimeTicks::Now(); | 185 stats->client_stats.time_rendered = base::TimeTicks::Now(); |
| 189 if (stats_consumer_) | 186 if (stats_consumer_) |
| 190 stats_consumer_->OnVideoFrameStats(*stats); | 187 stats_consumer_->OnVideoFrameStats(*stats); |
| 191 | 188 |
| 192 if (!done.is_null()) | 189 if (!done.is_null()) |
| 193 done.Run(); | 190 done.Run(); |
| 194 } | 191 } |
| 195 | 192 |
| 196 } // namespace remoting | 193 } // namespace remoting |
| OLD | NEW |