| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 158     DCHECK(network_task_runner_->BelongsToCurrentThread()); | 158     DCHECK(network_task_runner_->BelongsToCurrentThread()); | 
| 159     capture_task_runner_->PostTask( | 159     capture_task_runner_->PostTask( | 
| 160         FROM_HERE, base::Bind(&VideoScheduler::UpdateSequenceNumber, | 160         FROM_HERE, base::Bind(&VideoScheduler::UpdateSequenceNumber, | 
| 161                               this, sequence_number)); | 161                               this, sequence_number)); | 
| 162     return; | 162     return; | 
| 163   } | 163   } | 
| 164 | 164 | 
| 165   sequence_number_ = sequence_number; | 165   sequence_number_ = sequence_number; | 
| 166 } | 166 } | 
| 167 | 167 | 
|  | 168 void VideoScheduler::SetLosslessEncode(bool want_lossless) { | 
|  | 169   if (!encode_task_runner_->BelongsToCurrentThread()) { | 
|  | 170     DCHECK(network_task_runner_->BelongsToCurrentThread()); | 
|  | 171     encode_task_runner_->PostTask( | 
|  | 172         FROM_HERE, base::Bind(&VideoScheduler::SetLosslessEncode, | 
|  | 173                               this, want_lossless)); | 
|  | 174     return; | 
|  | 175   } | 
|  | 176 | 
|  | 177   encoder_->SetLosslessEncode(want_lossless); | 
|  | 178 } | 
|  | 179 | 
|  | 180 void VideoScheduler::SetLosslessColor(bool want_lossless) { | 
|  | 181   if (!encode_task_runner_->BelongsToCurrentThread()) { | 
|  | 182     DCHECK(network_task_runner_->BelongsToCurrentThread()); | 
|  | 183     encode_task_runner_->PostTask( | 
|  | 184         FROM_HERE, base::Bind(&VideoScheduler::SetLosslessColor, | 
|  | 185                               this, want_lossless)); | 
|  | 186     return; | 
|  | 187   } | 
|  | 188 | 
|  | 189   encoder_->SetLosslessColor(want_lossless); | 
|  | 190 } | 
|  | 191 | 
| 168 // Private methods ----------------------------------------------------------- | 192 // Private methods ----------------------------------------------------------- | 
| 169 | 193 | 
| 170 VideoScheduler::~VideoScheduler() { | 194 VideoScheduler::~VideoScheduler() { | 
| 171 } | 195 } | 
| 172 | 196 | 
| 173 // Capturer thread ------------------------------------------------------------- | 197 // Capturer thread ------------------------------------------------------------- | 
| 174 | 198 | 
| 175 void VideoScheduler::StartOnCaptureThread() { | 199 void VideoScheduler::StartOnCaptureThread() { | 
| 176   DCHECK(capture_task_runner_->BelongsToCurrentThread()); | 200   DCHECK(capture_task_runner_->BelongsToCurrentThread()); | 
| 177   DCHECK(!capture_timer_); | 201   DCHECK(!capture_timer_); | 
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 328   frame.reset(); | 352   frame.reset(); | 
| 329 | 353 | 
| 330   scheduler_.RecordEncodeTime( | 354   scheduler_.RecordEncodeTime( | 
| 331       base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); | 355       base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); | 
| 332   network_task_runner_->PostTask( | 356   network_task_runner_->PostTask( | 
| 333       FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this, | 357       FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this, | 
| 334                             base::Passed(&packet))); | 358                             base::Passed(&packet))); | 
| 335 } | 359 } | 
| 336 | 360 | 
| 337 }  // namespace remoting | 361 }  // namespace remoting | 
| OLD | NEW | 
|---|