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

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

Issue 450693006: VideoToolbox encoder for cast senders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove useless include and clean up in unit tests. Created 6 years, 1 month 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_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/video_sender.cc
diff --git a/media/cast/sender/video_sender.cc b/media/cast/sender/video_sender.cc
index 190e9648d52ad4a6ffd85772b4046c903c76f160..a34b55f8cf46edfa23766746ddbd6563069ff393 100644
--- a/media/cast/sender/video_sender.cc
+++ b/media/cast/sender/video_sender.cc
@@ -17,6 +17,10 @@
#include "media/cast/sender/video_encoder_impl.h"
#include "media/cast/sender/video_frame_factory.h"
+#if defined(OS_MACOSX)
+#include "media/cast/sender/h264_vt_encoder.h"
+#endif
+
namespace media {
namespace cast {
@@ -70,6 +74,18 @@ VideoSender::VideoSender(
weak_factory_(this) {
cast_initialization_status_ = STATUS_VIDEO_UNINITIALIZED;
+#if defined(OS_MACOSX)
+ // On Apple platforms, use the hardware H.264 encoder if possible. It is the
+ // only reasonable option for iOS.
+ if (!video_config.use_external_encoder &&
+ video_config.codec == CODEC_VIDEO_H264) {
+ video_encoder_.reset(new H264VideoToolboxEncoder(
+ cast_environment, video_config,
+ base::Bind(&VideoSender::OnEncoderInitialized,
+ weak_factory_.GetWeakPtr(), initialization_cb)));
+ }
+#endif // defined(OS_MACOSX)
+#if !defined(OS_IOS)
if (video_config.use_external_encoder) {
video_encoder_.reset(new ExternalVideoEncoder(
cast_environment,
@@ -78,11 +94,12 @@ VideoSender::VideoSender(
weak_factory_.GetWeakPtr(), initialization_cb),
create_vea_cb,
create_video_encode_mem_cb));
- } else {
+ } else if (!video_encoder_) {
// Software encoder is initialized immediately.
video_encoder_.reset(new VideoEncoderImpl(cast_environment, video_config));
cast_initialization_status_ = STATUS_VIDEO_INITIALIZED;
}
+#endif // !defined(OS_IOS)
if (cast_initialization_status_ == STATUS_VIDEO_INITIALIZED) {
cast_environment->PostTask(
« no previous file with comments | « media/cast/sender/video_encoder_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698