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/memory/shared_memory.h" | 6 #include "base/memory/shared_memory.h" |
7 #include "base/numerics/safe_math.h" | 7 #include "base/numerics/safe_math.h" |
8 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 8 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
9 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h" | 9 #include "content/common/gpu/media/gpu_video_accelerator_util.h" |
10 #include "content/common/pepper_file_util.h" | 10 #include "content/common/pepper_file_util.h" |
11 #include "content/public/renderer/renderer_ppapi_host.h" | 11 #include "content/public/renderer/renderer_ppapi_host.h" |
12 #include "content/renderer/pepper/gfx_conversion.h" | 12 #include "content/renderer/pepper/gfx_conversion.h" |
13 #include "content/renderer/pepper/host_globals.h" | 13 #include "content/renderer/pepper/host_globals.h" |
14 #include "content/renderer/pepper/pepper_video_encoder_host.h" | 14 #include "content/renderer/pepper/pepper_video_encoder_host.h" |
15 #include "content/renderer/pepper/video_encoder_shim.h" | 15 #include "content/renderer/pepper/video_encoder_shim.h" |
16 #include "content/renderer/render_thread_impl.h" | 16 #include "content/renderer/render_thread_impl.h" |
17 #include "media/base/bind_to_current_loop.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" |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 void PepperVideoEncoderHost::NotifyError( | 443 void PepperVideoEncoderHost::NotifyError( |
444 media::VideoEncodeAccelerator::Error error) { | 444 media::VideoEncodeAccelerator::Error error) { |
445 DCHECK(RenderThreadImpl::current()); | 445 DCHECK(RenderThreadImpl::current()); |
446 NotifyPepperError(PP_FromMediaEncodeAcceleratorError(error)); | 446 NotifyPepperError(PP_FromMediaEncodeAcceleratorError(error)); |
447 } | 447 } |
448 | 448 |
449 void PepperVideoEncoderHost::GetSupportedProfiles( | 449 void PepperVideoEncoderHost::GetSupportedProfiles( |
450 std::vector<PP_VideoProfileDescription>* pp_profiles) { | 450 std::vector<PP_VideoProfileDescription>* pp_profiles) { |
451 DCHECK(RenderThreadImpl::current()); | 451 DCHECK(RenderThreadImpl::current()); |
452 | 452 |
453 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles; | 453 media::VideoEncodeAccelerator::SupportedProfiles profiles; |
454 | 454 |
455 if (EnsureGpuChannel()) { | 455 if (EnsureGpuChannel()) { |
456 profiles = GpuVideoEncodeAcceleratorHost::ConvertGpuToMediaProfiles( | 456 profiles = GpuVideoAcceleratorUtil::ConvertGpuToMediaEncodeProfiles( |
457 channel_->gpu_info().video_encode_accelerator_supported_profiles); | 457 channel_->gpu_info().video_encode_accelerator_supported_profiles); |
458 for (media::VideoEncodeAccelerator::SupportedProfile profile : profiles) { | 458 for (media::VideoEncodeAccelerator::SupportedProfile profile : profiles) { |
459 pp_profiles->push_back(PP_FromVideoEncodeAcceleratorSupportedProfile( | 459 pp_profiles->push_back(PP_FromVideoEncodeAcceleratorSupportedProfile( |
460 profile, PP_HARDWAREACCELERATION_ONLY)); | 460 profile, PP_HARDWAREACCELERATION_ONLY)); |
461 } | 461 } |
462 } | 462 } |
463 | 463 |
464 #if !defined(OS_ANDROID) | 464 #if !defined(OS_ANDROID) |
465 VideoEncoderShim software_encoder(this); | 465 VideoEncoderShim software_encoder(this); |
466 profiles = software_encoder.GetSupportedProfiles(); | 466 profiles = software_encoder.GetSupportedProfiles(); |
(...skipping 198 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 |