| Index: media/cast/sender/video_encoder.cc
|
| diff --git a/media/cast/sender/video_encoder.cc b/media/cast/sender/video_encoder.cc
|
| index d6b62a891cf6de13e5de9a6667f6470d7a80d441..d65bf3c8dc845dcf4ad0a8e808e474f7655060eb 100644
|
| --- a/media/cast/sender/video_encoder.cc
|
| +++ b/media/cast/sender/video_encoder.cc
|
| @@ -3,11 +3,61 @@
|
| // found in the LICENSE file.
|
|
|
| #include "media/cast/sender/video_encoder.h"
|
| -#include "media/cast/sender/video_frame_factory.h"
|
| +
|
| +#include "media/cast/sender/external_video_encoder.h"
|
| +#include "media/cast/sender/video_encoder_impl.h"
|
| +
|
| +#if defined(OS_MACOSX)
|
| +#include "media/cast/sender/h264_vt_encoder.h"
|
| +#endif
|
|
|
| namespace media {
|
| namespace cast {
|
|
|
| +// static
|
| +scoped_ptr<VideoEncoder> VideoEncoder::Create(
|
| + const scoped_refptr<CastEnvironment>& cast_environment,
|
| + const VideoSenderConfig& video_config,
|
| + const StatusChangeCallback& status_change_cb,
|
| + const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
|
| + const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb) {
|
| + // On MacOS or IOS, attempt to use the system VideoToolbox library to
|
| + // perform optimized H.264 encoding.
|
| +#if defined(OS_MACOSX) || defined(OS_IOS)
|
| + if (!video_config.use_external_encoder &&
|
| + H264VideoToolboxEncoder::IsSupported(video_config)) {
|
| + return scoped_ptr<VideoEncoder>(
|
| + new SizeAdaptableH264VideoToolboxVideoEncoder(
|
| + cast_environment,
|
| + video_config,
|
| + status_change_cb));
|
| + }
|
| +#endif // defined(OS_MACOSX)
|
| +
|
| + // If the system provides a hardware-accelerated encoder, use it.
|
| +#if !defined(OS_IOS)
|
| + if (ExternalVideoEncoder::IsSupported(video_config)) {
|
| + return scoped_ptr<VideoEncoder>(new SizeAdaptableExternalVideoEncoder(
|
| + cast_environment,
|
| + video_config,
|
| + status_change_cb,
|
| + create_vea_cb,
|
| + create_video_encode_memory_cb));
|
| + }
|
| +#endif // !defined(OS_IOS)
|
| +
|
| + // Attempt to use the software encoder implementation.
|
| + if (VideoEncoderImpl::IsSupported(video_config)) {
|
| + return scoped_ptr<VideoEncoder>(new VideoEncoderImpl(
|
| + cast_environment,
|
| + video_config,
|
| + status_change_cb));
|
| + }
|
| +
|
| + // No encoder implementation will suffice.
|
| + return nullptr;
|
| +}
|
| +
|
| scoped_ptr<VideoFrameFactory> VideoEncoder::CreateVideoFrameFactory() {
|
| return nullptr;
|
| }
|
|
|