Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Unified Diff: media/cast/sender/video_encoder.cc

Issue 906403006: [Cast] Size-Adaptable platform video encoders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed hubbe's comments. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/sender/video_encoder.h ('k') | media/cast/sender/video_encoder_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « media/cast/sender/video_encoder.h ('k') | media/cast/sender/video_encoder_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698