| 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 "media/cast/sender/external_video_encoder.h" | 5 #include "media/cast/sender/external_video_encoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 void OnCreateSharedMemory(scoped_ptr<base::SharedMemory> memory) { | 262 void OnCreateSharedMemory(scoped_ptr<base::SharedMemory> memory) { |
| 263 task_runner_->PostTask(FROM_HERE, | 263 task_runner_->PostTask(FROM_HERE, |
| 264 base::Bind(&VEAClientImpl::OnReceivedSharedMemory, | 264 base::Bind(&VEAClientImpl::OnReceivedSharedMemory, |
| 265 this, | 265 this, |
| 266 base::Passed(&memory))); | 266 base::Passed(&memory))); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void OnReceivedSharedMemory(scoped_ptr<base::SharedMemory> memory) { | 269 void OnReceivedSharedMemory(scoped_ptr<base::SharedMemory> memory) { |
| 270 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 270 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 271 | 271 |
| 272 output_buffers_.push_back(memory.release()); | 272 output_buffers_.push_back(memory.Pass()); |
| 273 | 273 |
| 274 // Wait until all requested buffers are received. | 274 // Wait until all requested buffers are received. |
| 275 if (output_buffers_.size() < kOutputBufferCount) | 275 if (output_buffers_.size() < kOutputBufferCount) |
| 276 return; | 276 return; |
| 277 | 277 |
| 278 // Immediately provide all output buffers to the VEA. | 278 // Immediately provide all output buffers to the VEA. |
| 279 for (size_t i = 0; i < output_buffers_.size(); ++i) { | 279 for (size_t i = 0; i < output_buffers_.size(); ++i) { |
| 280 video_encode_accelerator_->UseOutputBitstreamBuffer( | 280 video_encode_accelerator_->UseOutputBitstreamBuffer( |
| 281 media::BitstreamBuffer(static_cast<int32>(i), | 281 media::BitstreamBuffer(static_cast<int32>(i), |
| 282 output_buffers_[i]->handle(), | 282 output_buffers_[i]->handle(), |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 video_config(), | 465 video_config(), |
| 466 frame_size(), | 466 frame_size(), |
| 467 last_frame_id() + 1, | 467 last_frame_id() + 1, |
| 468 CreateEncoderStatusChangeCallback(), | 468 CreateEncoderStatusChangeCallback(), |
| 469 create_vea_cb_, | 469 create_vea_cb_, |
| 470 create_video_encode_memory_cb_)); | 470 create_video_encode_memory_cb_)); |
| 471 } | 471 } |
| 472 | 472 |
| 473 } // namespace cast | 473 } // namespace cast |
| 474 } // namespace media | 474 } // namespace media |
| OLD | NEW |