Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/pepper/pepper_video_encoder_host.h" | 5 #include "content/renderer/pepper/pepper_video_encoder_host.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 // There is no guarantee that we have a 3D context to work with. So | 498 // There is no guarantee that we have a 3D context to work with. So |
| 499 // we create a dummy command buffer to communicate with the gpu process. | 499 // we create a dummy command buffer to communicate with the gpu process. |
| 500 channel_ = RenderThreadImpl::current()->EstablishGpuChannelSync( | 500 channel_ = RenderThreadImpl::current()->EstablishGpuChannelSync( |
| 501 CAUSE_FOR_GPU_LAUNCH_PEPPERVIDEOENCODERACCELERATOR_INITIALIZE); | 501 CAUSE_FOR_GPU_LAUNCH_PEPPERVIDEOENCODERACCELERATOR_INITIALIZE); |
| 502 if (!channel_) | 502 if (!channel_) |
| 503 return false; | 503 return false; |
| 504 | 504 |
| 505 std::vector<int32_t> attribs(1, PP_GRAPHICS3DATTRIB_NONE); | 505 std::vector<int32_t> attribs(1, PP_GRAPHICS3DATTRIB_NONE); |
| 506 command_buffer_ = channel_->CreateOffscreenCommandBuffer( | 506 command_buffer_ = channel_->CreateOffscreenCommandBuffer( |
| 507 gfx::Size(), nullptr, GpuChannelHost::kDefaultStreamId, | 507 gfx::Size(), nullptr, GpuChannelHost::kDefaultStreamId, |
| 508 GpuChannelHost::kDefaultStreamPriority, attribs, GURL::EmptyGURL(), | 508 GpuChannelHost::kDefaultStreamPriority, attribs, "", |
|
piman
2016/02/18 18:29:28
nit: std::string()
Mark Dittmer
2016/02/18 21:10:25
Done.
| |
| 509 gfx::PreferIntegratedGpu); | 509 gfx::PreferIntegratedGpu); |
| 510 if (!command_buffer_) { | 510 if (!command_buffer_) { |
| 511 Close(); | 511 Close(); |
| 512 return false; | 512 return false; |
| 513 } | 513 } |
| 514 | 514 |
| 515 command_buffer_->SetContextLostCallback(media::BindToCurrentLoop( | 515 command_buffer_->SetContextLostCallback(media::BindToCurrentLoop( |
| 516 base::Bind(&PepperVideoEncoderHost::NotifyPepperError, | 516 base::Bind(&PepperVideoEncoderHost::NotifyPepperError, |
| 517 weak_ptr_factory_.GetWeakPtr(), PP_ERROR_RESOURCE_FAILED))); | 517 weak_ptr_factory_.GetWeakPtr(), PP_ERROR_RESOURCE_FAILED))); |
| 518 if (!command_buffer_->Initialize()) { | 518 if (!command_buffer_->Initialize()) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 662 } | 662 } |
| 663 | 663 |
| 664 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { | 664 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { |
| 665 DCHECK(RenderThreadImpl::current()); | 665 DCHECK(RenderThreadImpl::current()); |
| 666 DCHECK_GE(buffer_id, 0); | 666 DCHECK_GE(buffer_id, 0); |
| 667 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); | 667 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); |
| 668 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); | 668 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); |
| 669 } | 669 } |
| 670 | 670 |
| 671 } // namespace content | 671 } // namespace content |
| OLD | NEW |