| Index: content/renderer/pepper/pepper_video_encoder_host.cc
|
| diff --git a/content/renderer/pepper/pepper_video_encoder_host.cc b/content/renderer/pepper/pepper_video_encoder_host.cc
|
| index bacbfe0b309fda372a7f92eb4064d0bf96770abe..ec6c555df94230956033b00aace600d936d2b2f2 100644
|
| --- a/content/renderer/pepper/pepper_video_encoder_host.cc
|
| +++ b/content/renderer/pepper/pepper_video_encoder_host.cc
|
| @@ -11,6 +11,7 @@
|
| #include "content/renderer/pepper/gfx_conversion.h"
|
| #include "content/renderer/pepper/host_globals.h"
|
| #include "content/renderer/pepper/pepper_video_encoder_host.h"
|
| +#include "content/renderer/pepper/video_encoder_shim.h"
|
| #include "content/renderer/render_thread_impl.h"
|
| #include "media/base/bind_to_current_loop.h"
|
| #include "media/base/video_frame.h"
|
| @@ -280,8 +281,7 @@ int32_t PepperVideoEncoderHost::OnHostMsgInitialize(
|
| int32_t error = PP_ERROR_NOTSUPPORTED;
|
| initialize_reply_context_ = context->MakeReplyMessageContext();
|
|
|
| - if (acceleration == PP_HARDWAREACCELERATION_ONLY ||
|
| - acceleration == PP_HARDWAREACCELERATION_WITHFALLBACK) {
|
| + if (acceleration != PP_HARDWAREACCELERATION_NONE) {
|
| if (InitializeHardware(media_input_format_, input_size, media_profile,
|
| initial_bitrate))
|
| return PP_OK_COMPLETIONPENDING;
|
| @@ -290,7 +290,14 @@ int32_t PepperVideoEncoderHost::OnHostMsgInitialize(
|
| error = PP_ERROR_FAILED;
|
| }
|
|
|
| - // TODO(llandwerlin): Software encoder.
|
| + if (acceleration != PP_HARDWAREACCELERATION_ONLY) {
|
| + encoder_.reset(new VideoEncoderShim(this));
|
| + if (encoder_->Initialize(media_input_format_, input_size, media_profile,
|
| + initial_bitrate, this))
|
| + return PP_OK_COMPLETIONPENDING;
|
| + error = PP_ERROR_FAILED;
|
| + }
|
| +
|
| initialize_reply_context_ = ppapi::host::ReplyMessageContext();
|
| Close();
|
| return error;
|
| @@ -454,7 +461,11 @@ void PepperVideoEncoderHost::GetSupportedProfiles(
|
| pp_profiles->push_back(PP_FromVideoEncodeAcceleratorSupportedProfile(
|
| profile, PP_HARDWAREACCELERATION_ONLY));
|
|
|
| - // TODO(llandwerlin): add software supported profiles.
|
| + VideoEncoderShim software_encoder(this);
|
| + profiles = software_encoder.GetSupportedProfiles();
|
| + for (media::VideoEncodeAccelerator::SupportedProfile profile : profiles)
|
| + pp_profiles->push_back(PP_FromVideoEncodeAcceleratorSupportedProfile(
|
| + profile, PP_HARDWAREACCELERATION_NONE));
|
| }
|
|
|
| bool PepperVideoEncoderHost::IsInitializationValid(
|
| @@ -649,4 +660,11 @@ void PepperVideoEncoderHost::NotifyPepperError(int32_t error) {
|
| PpapiPluginMsg_VideoEncoder_NotifyError(encoder_last_error_));
|
| }
|
|
|
| +uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32 buffer_id) {
|
| + DCHECK(RenderThreadImpl::current());
|
| + DCHECK_GE(buffer_id, 0);
|
| + DCHECK_LT(buffer_id, static_cast<int32>(shm_buffers_.size()));
|
| + return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory());
|
| +}
|
| +
|
| } // namespace content
|
|
|