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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 // There is no guarantee that we have a 3D context to work with. So | 520 // There is no guarantee that we have a 3D context to work with. So |
521 // we create a dummy command buffer to communicate with the gpu process. | 521 // we create a dummy command buffer to communicate with the gpu process. |
522 scoped_refptr<gpu::GpuChannelHost> channel = | 522 scoped_refptr<gpu::GpuChannelHost> channel = |
523 RenderThreadImpl::current()->EstablishGpuChannelSync( | 523 RenderThreadImpl::current()->EstablishGpuChannelSync( |
524 CAUSE_FOR_GPU_LAUNCH_PEPPERVIDEOENCODERACCELERATOR_INITIALIZE); | 524 CAUSE_FOR_GPU_LAUNCH_PEPPERVIDEOENCODERACCELERATOR_INITIALIZE); |
525 if (!channel) | 525 if (!channel) |
526 return false; | 526 return false; |
527 | 527 |
528 std::vector<int32_t> attribs(1, PP_GRAPHICS3DATTRIB_NONE); | 528 std::vector<int32_t> attribs(1, PP_GRAPHICS3DATTRIB_NONE); |
529 command_buffer_ = channel->CreateCommandBuffer( | 529 command_buffer_ = channel->CreateCommandBuffer( |
530 gpu::kNullSurfaceHandle, gfx::Size(), nullptr, | 530 gpu::kNullSurfaceHandle, gfx::Size(), nullptr, gpu::GPU_STREAM_DEFAULT, |
531 gpu::GpuChannelHost::kDefaultStreamId, | 531 gpu::GpuStreamPriority::NORMAL, attribs, GURL::EmptyGURL(), |
532 gpu::GpuChannelHost::kDefaultStreamPriority, attribs, GURL::EmptyGURL(), | |
533 gfx::PreferIntegratedGpu); | 532 gfx::PreferIntegratedGpu); |
534 if (!command_buffer_) { | 533 if (!command_buffer_) { |
535 Close(); | 534 Close(); |
536 return false; | 535 return false; |
537 } | 536 } |
538 | 537 |
539 command_buffer_->SetGpuControlClient(this); | 538 command_buffer_->SetGpuControlClient(this); |
540 | 539 |
541 return true; | 540 return true; |
542 } | 541 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 } | 676 } |
678 | 677 |
679 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { | 678 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { |
680 DCHECK(RenderThreadImpl::current()); | 679 DCHECK(RenderThreadImpl::current()); |
681 DCHECK_GE(buffer_id, 0); | 680 DCHECK_GE(buffer_id, 0); |
682 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); | 681 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); |
683 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); | 682 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); |
684 } | 683 } |
685 | 684 |
686 } // namespace content | 685 } // namespace content |
OLD | NEW |