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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "media/cast/sender/video_encoder.h" 5 #include "media/cast/sender/video_encoder.h"
6 #include "media/cast/sender/video_frame_factory.h" 6
7 #include "media/cast/sender/external_video_encoder.h"
8 #include "media/cast/sender/video_encoder_impl.h"
9
10 #if defined(OS_MACOSX)
11 #include "media/cast/sender/h264_vt_encoder.h"
12 #endif
7 13
8 namespace media { 14 namespace media {
9 namespace cast { 15 namespace cast {
10 16
17 // static
18 scoped_ptr<VideoEncoder> VideoEncoder::Create(
19 const scoped_refptr<CastEnvironment>& cast_environment,
20 const VideoSenderConfig& video_config,
21 const StatusChangeCallback& status_change_cb,
22 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
23 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb) {
24 // On MacOS or IOS, attempt to use the system VideoToolbox library to
25 // perform optimized H.264 encoding.
26 #if defined(OS_MACOSX) || defined(OS_IOS)
27 if (!video_config.use_external_encoder &&
28 H264VideoToolboxEncoder::IsSupported(video_config)) {
29 return scoped_ptr<VideoEncoder>(
30 new SizeAdaptableH264VideoToolboxVideoEncoder(
31 cast_environment,
32 video_config,
33 status_change_cb));
34 }
35 #endif // defined(OS_MACOSX)
36
37 // If the system provides a hardware-accelerated encoder, use it.
38 #if !defined(OS_IOS)
39 if (ExternalVideoEncoder::IsSupported(video_config)) {
40 return scoped_ptr<VideoEncoder>(new SizeAdaptableExternalVideoEncoder(
41 cast_environment,
42 video_config,
43 status_change_cb,
44 create_vea_cb,
45 create_video_encode_memory_cb));
46 }
47 #endif // !defined(OS_IOS)
48
49 // Attempt to use the software encoder implementation.
50 if (VideoEncoderImpl::IsSupported(video_config)) {
51 return scoped_ptr<VideoEncoder>(new VideoEncoderImpl(
52 cast_environment,
53 video_config,
54 status_change_cb));
55 }
56
57 // No encoder implementation will suffice.
58 return nullptr;
59 }
60
11 scoped_ptr<VideoFrameFactory> VideoEncoder::CreateVideoFrameFactory() { 61 scoped_ptr<VideoFrameFactory> VideoEncoder::CreateVideoFrameFactory() {
12 return nullptr; 62 return nullptr;
13 } 63 }
14 64
15 void VideoEncoder::EmitFrames() { 65 void VideoEncoder::EmitFrames() {
16 } 66 }
17 67
18 } // namespace cast 68 } // namespace cast
19 } // namespace media 69 } // namespace media
OLDNEW
« 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