| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 return media::H264PROFILE_SCALABLEBASELINE; | 73 return media::H264PROFILE_SCALABLEBASELINE; |
| 74 case PP_VIDEOPROFILE_H264SCALABLEHIGH: | 74 case PP_VIDEOPROFILE_H264SCALABLEHIGH: |
| 75 return media::H264PROFILE_SCALABLEHIGH; | 75 return media::H264PROFILE_SCALABLEHIGH; |
| 76 case PP_VIDEOPROFILE_H264STEREOHIGH: | 76 case PP_VIDEOPROFILE_H264STEREOHIGH: |
| 77 return media::H264PROFILE_STEREOHIGH; | 77 return media::H264PROFILE_STEREOHIGH; |
| 78 case PP_VIDEOPROFILE_H264MULTIVIEWHIGH: | 78 case PP_VIDEOPROFILE_H264MULTIVIEWHIGH: |
| 79 return media::H264PROFILE_MULTIVIEWHIGH; | 79 return media::H264PROFILE_MULTIVIEWHIGH; |
| 80 case PP_VIDEOPROFILE_VP8_ANY: | 80 case PP_VIDEOPROFILE_VP8_ANY: |
| 81 return media::VP8PROFILE_ANY; | 81 return media::VP8PROFILE_ANY; |
| 82 case PP_VIDEOPROFILE_VP9_ANY: | 82 case PP_VIDEOPROFILE_VP9_ANY: |
| 83 return media::VP9PROFILE_ANY; | 83 return media::VP9PROFILE_PROFILE0; |
| 84 // No default case, to catch unhandled PP_VideoProfile values. | 84 // No default case, to catch unhandled PP_VideoProfile values. |
| 85 } | 85 } |
| 86 return media::VIDEO_CODEC_PROFILE_UNKNOWN; | 86 return media::VIDEO_CODEC_PROFILE_UNKNOWN; |
| 87 } | 87 } |
| 88 | 88 |
| 89 PP_VideoProfile PP_FromMediaVideoProfile(media::VideoCodecProfile profile) { | 89 PP_VideoProfile PP_FromMediaVideoProfile(media::VideoCodecProfile profile) { |
| 90 switch (profile) { | 90 switch (profile) { |
| 91 case media::H264PROFILE_BASELINE: | 91 case media::H264PROFILE_BASELINE: |
| 92 return PP_VIDEOPROFILE_H264BASELINE; | 92 return PP_VIDEOPROFILE_H264BASELINE; |
| 93 case media::H264PROFILE_MAIN: | 93 case media::H264PROFILE_MAIN: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 105 case media::H264PROFILE_SCALABLEBASELINE: | 105 case media::H264PROFILE_SCALABLEBASELINE: |
| 106 return PP_VIDEOPROFILE_H264SCALABLEBASELINE; | 106 return PP_VIDEOPROFILE_H264SCALABLEBASELINE; |
| 107 case media::H264PROFILE_SCALABLEHIGH: | 107 case media::H264PROFILE_SCALABLEHIGH: |
| 108 return PP_VIDEOPROFILE_H264SCALABLEHIGH; | 108 return PP_VIDEOPROFILE_H264SCALABLEHIGH; |
| 109 case media::H264PROFILE_STEREOHIGH: | 109 case media::H264PROFILE_STEREOHIGH: |
| 110 return PP_VIDEOPROFILE_H264STEREOHIGH; | 110 return PP_VIDEOPROFILE_H264STEREOHIGH; |
| 111 case media::H264PROFILE_MULTIVIEWHIGH: | 111 case media::H264PROFILE_MULTIVIEWHIGH: |
| 112 return PP_VIDEOPROFILE_H264MULTIVIEWHIGH; | 112 return PP_VIDEOPROFILE_H264MULTIVIEWHIGH; |
| 113 case media::VP8PROFILE_ANY: | 113 case media::VP8PROFILE_ANY: |
| 114 return PP_VIDEOPROFILE_VP8_ANY; | 114 return PP_VIDEOPROFILE_VP8_ANY; |
| 115 case media::VP9PROFILE_ANY: | 115 case media::VP9PROFILE_PROFILE0: |
| 116 return PP_VIDEOPROFILE_VP9_ANY; | 116 return PP_VIDEOPROFILE_VP9_ANY; |
| 117 default: | 117 default: |
| 118 NOTREACHED(); | 118 NOTREACHED(); |
| 119 return static_cast<PP_VideoProfile>(-1); | 119 return static_cast<PP_VideoProfile>(-1); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 media::VideoPixelFormat PP_ToMediaVideoFormat(PP_VideoFrame_Format format) { | 123 media::VideoPixelFormat PP_ToMediaVideoFormat(PP_VideoFrame_Format format) { |
| 124 switch (format) { | 124 switch (format) { |
| 125 case PP_VIDEOFRAME_FORMAT_UNKNOWN: | 125 case PP_VIDEOFRAME_FORMAT_UNKNOWN: |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 void PepperVideoEncoderHost::GetSupportedProfiles( | 447 void PepperVideoEncoderHost::GetSupportedProfiles( |
| 448 std::vector<PP_VideoProfileDescription>* pp_profiles) { | 448 std::vector<PP_VideoProfileDescription>* pp_profiles) { |
| 449 DCHECK(RenderThreadImpl::current()); | 449 DCHECK(RenderThreadImpl::current()); |
| 450 | 450 |
| 451 media::VideoEncodeAccelerator::SupportedProfiles profiles; | 451 media::VideoEncodeAccelerator::SupportedProfiles profiles; |
| 452 | 452 |
| 453 if (EnsureGpuChannel()) { | 453 if (EnsureGpuChannel()) { |
| 454 profiles = GpuVideoAcceleratorUtil::ConvertGpuToMediaEncodeProfiles( | 454 profiles = GpuVideoAcceleratorUtil::ConvertGpuToMediaEncodeProfiles( |
| 455 channel_->gpu_info().video_encode_accelerator_supported_profiles); | 455 channel_->gpu_info().video_encode_accelerator_supported_profiles); |
| 456 for (media::VideoEncodeAccelerator::SupportedProfile profile : profiles) { | 456 for (media::VideoEncodeAccelerator::SupportedProfile profile : profiles) { |
| 457 if (profile.profile == media::VP9PROFILE_PROFILE1 || |
| 458 profile.profile == media::VP9PROFILE_PROFILE2 || |
| 459 profile.profile == media::VP9PROFILE_PROFILE3) { |
| 460 continue; |
| 461 } |
| 457 pp_profiles->push_back( | 462 pp_profiles->push_back( |
| 458 PP_FromVideoEncodeAcceleratorSupportedProfile(profile, PP_TRUE)); | 463 PP_FromVideoEncodeAcceleratorSupportedProfile(profile, PP_TRUE)); |
| 459 } | 464 } |
| 460 } | 465 } |
| 461 | 466 |
| 462 #if !defined(OS_ANDROID) | 467 #if !defined(OS_ANDROID) |
| 463 VideoEncoderShim software_encoder(this); | 468 VideoEncoderShim software_encoder(this); |
| 464 profiles = software_encoder.GetSupportedProfiles(); | 469 profiles = software_encoder.GetSupportedProfiles(); |
| 465 for (media::VideoEncodeAccelerator::SupportedProfile profile : profiles) { | 470 for (media::VideoEncodeAccelerator::SupportedProfile profile : profiles) { |
| 466 pp_profiles->push_back( | 471 pp_profiles->push_back( |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 } | 665 } |
| 661 | 666 |
| 662 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { | 667 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { |
| 663 DCHECK(RenderThreadImpl::current()); | 668 DCHECK(RenderThreadImpl::current()); |
| 664 DCHECK_GE(buffer_id, 0); | 669 DCHECK_GE(buffer_id, 0); |
| 665 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); | 670 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); |
| 666 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); | 671 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); |
| 667 } | 672 } |
| 668 | 673 |
| 669 } // namespace content | 674 } // namespace content |
| OLD | NEW |