| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/host/video_scheduler.h" | 5 #include "remoting/host/video_scheduler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 161 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 162 capture_task_runner_->PostTask( | 162 capture_task_runner_->PostTask( |
| 163 FROM_HERE, base::Bind(&VideoScheduler::UpdateSequenceNumber, | 163 FROM_HERE, base::Bind(&VideoScheduler::UpdateSequenceNumber, |
| 164 this, sequence_number)); | 164 this, sequence_number)); |
| 165 return; | 165 return; |
| 166 } | 166 } |
| 167 | 167 |
| 168 sequence_number_ = sequence_number; | 168 sequence_number_ = sequence_number; |
| 169 } | 169 } |
| 170 | 170 |
| 171 void VideoScheduler::SetLosslessEncode(bool want_lossless) { |
| 172 if (!encode_task_runner_->BelongsToCurrentThread()) { |
| 173 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 174 encode_task_runner_->PostTask( |
| 175 FROM_HERE, base::Bind(&VideoScheduler::SetLosslessEncode, |
| 176 this, want_lossless)); |
| 177 return; |
| 178 } |
| 179 |
| 180 encoder_->SetLosslessEncode(want_lossless); |
| 181 } |
| 182 |
| 183 void VideoScheduler::SetLosslessColor(bool want_lossless) { |
| 184 if (!encode_task_runner_->BelongsToCurrentThread()) { |
| 185 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 186 encode_task_runner_->PostTask( |
| 187 FROM_HERE, base::Bind(&VideoScheduler::SetLosslessColor, |
| 188 this, want_lossless)); |
| 189 return; |
| 190 } |
| 191 |
| 192 encoder_->SetLosslessColor(want_lossless); |
| 193 } |
| 194 |
| 171 // Private methods ----------------------------------------------------------- | 195 // Private methods ----------------------------------------------------------- |
| 172 | 196 |
| 173 VideoScheduler::~VideoScheduler() { | 197 VideoScheduler::~VideoScheduler() { |
| 174 } | 198 } |
| 175 | 199 |
| 176 // Capturer thread ------------------------------------------------------------- | 200 // Capturer thread ------------------------------------------------------------- |
| 177 | 201 |
| 178 void VideoScheduler::StartOnCaptureThread() { | 202 void VideoScheduler::StartOnCaptureThread() { |
| 179 DCHECK(capture_task_runner_->BelongsToCurrentThread()); | 203 DCHECK(capture_task_runner_->BelongsToCurrentThread()); |
| 180 DCHECK(!capture_timer_); | 204 DCHECK(!capture_timer_); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 frame.reset(); | 348 frame.reset(); |
| 325 | 349 |
| 326 scheduler_.RecordEncodeTime( | 350 scheduler_.RecordEncodeTime( |
| 327 base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); | 351 base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); |
| 328 network_task_runner_->PostTask( | 352 network_task_runner_->PostTask( |
| 329 FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this, | 353 FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this, |
| 330 base::Passed(&packet))); | 354 base::Passed(&packet))); |
| 331 } | 355 } |
| 332 | 356 |
| 333 } // namespace remoting | 357 } // namespace remoting |
| OLD | NEW |