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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_to_current_loop.h" |
6 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
7 #include "base/numerics/safe_math.h" | 8 #include "base/numerics/safe_math.h" |
8 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 9 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
9 #include "content/common/gpu/media/gpu_video_accelerator_util.h" | 10 #include "content/common/gpu/media/gpu_video_accelerator_util.h" |
10 #include "content/common/pepper_file_util.h" | 11 #include "content/common/pepper_file_util.h" |
11 #include "content/public/renderer/renderer_ppapi_host.h" | 12 #include "content/public/renderer/renderer_ppapi_host.h" |
12 #include "content/renderer/pepper/gfx_conversion.h" | 13 #include "content/renderer/pepper/gfx_conversion.h" |
13 #include "content/renderer/pepper/host_globals.h" | 14 #include "content/renderer/pepper/host_globals.h" |
14 #include "content/renderer/pepper/pepper_video_encoder_host.h" | 15 #include "content/renderer/pepper/pepper_video_encoder_host.h" |
15 #include "content/renderer/pepper/video_encoder_shim.h" | 16 #include "content/renderer/pepper/video_encoder_shim.h" |
16 #include "content/renderer/render_thread_impl.h" | 17 #include "content/renderer/render_thread_impl.h" |
17 #include "media/base/bind_to_current_loop.h" | |
18 #include "media/base/video_frame.h" | 18 #include "media/base/video_frame.h" |
19 #include "media/renderers/gpu_video_accelerator_factories.h" | 19 #include "media/renderers/gpu_video_accelerator_factories.h" |
20 #include "media/video/video_encode_accelerator.h" | 20 #include "media/video/video_encode_accelerator.h" |
21 #include "ppapi/c/pp_codecs.h" | 21 #include "ppapi/c/pp_codecs.h" |
22 #include "ppapi/c/pp_errors.h" | 22 #include "ppapi/c/pp_errors.h" |
23 #include "ppapi/c/pp_graphics_3d.h" | 23 #include "ppapi/c/pp_graphics_3d.h" |
24 #include "ppapi/host/dispatch_host_message.h" | 24 #include "ppapi/host/dispatch_host_message.h" |
25 #include "ppapi/host/ppapi_host.h" | 25 #include "ppapi/host/ppapi_host.h" |
26 #include "ppapi/proxy/ppapi_messages.h" | 26 #include "ppapi/proxy/ppapi_messages.h" |
27 #include "ppapi/shared_impl/media_stream_buffer.h" | 27 #include "ppapi/shared_impl/media_stream_buffer.h" |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 506 |
507 std::vector<int32> attribs(1, PP_GRAPHICS3DATTRIB_NONE); | 507 std::vector<int32> attribs(1, PP_GRAPHICS3DATTRIB_NONE); |
508 command_buffer_ = channel_->CreateOffscreenCommandBuffer( | 508 command_buffer_ = channel_->CreateOffscreenCommandBuffer( |
509 gfx::Size(), nullptr, attribs, GURL::EmptyGURL(), | 509 gfx::Size(), nullptr, attribs, GURL::EmptyGURL(), |
510 gfx::PreferIntegratedGpu); | 510 gfx::PreferIntegratedGpu); |
511 if (!command_buffer_) { | 511 if (!command_buffer_) { |
512 Close(); | 512 Close(); |
513 return false; | 513 return false; |
514 } | 514 } |
515 | 515 |
516 command_buffer_->SetChannelErrorCallback(media::BindToCurrentLoop( | 516 command_buffer_->SetChannelErrorCallback(base::BindToCurrentLoop( |
517 base::Bind(&PepperVideoEncoderHost::NotifyPepperError, | 517 base::Bind(&PepperVideoEncoderHost::NotifyPepperError, |
518 weak_ptr_factory_.GetWeakPtr(), PP_ERROR_RESOURCE_FAILED))); | 518 weak_ptr_factory_.GetWeakPtr(), PP_ERROR_RESOURCE_FAILED))); |
519 if (!command_buffer_->Initialize()) { | 519 if (!command_buffer_->Initialize()) { |
520 Close(); | 520 Close(); |
521 return false; | 521 return false; |
522 } | 522 } |
523 | 523 |
524 return true; | 524 return true; |
525 } | 525 } |
526 | 526 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 } | 665 } |
666 | 666 |
667 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32 buffer_id) { | 667 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32 buffer_id) { |
668 DCHECK(RenderThreadImpl::current()); | 668 DCHECK(RenderThreadImpl::current()); |
669 DCHECK_GE(buffer_id, 0); | 669 DCHECK_GE(buffer_id, 0); |
670 DCHECK_LT(buffer_id, static_cast<int32>(shm_buffers_.size())); | 670 DCHECK_LT(buffer_id, static_cast<int32>(shm_buffers_.size())); |
671 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); | 671 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); |
672 } | 672 } |
673 | 673 |
674 } // namespace content | 674 } // namespace content |
OLD | NEW |