| OLD | NEW |
| 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 | 6 |
| 7 #include "media/cast/sender/external_video_encoder.h" | 7 #include "media/cast/sender/external_video_encoder.h" |
| 8 #include "media/cast/sender/video_encoder_impl.h" | 8 #include "media/cast/sender/video_encoder_impl.h" |
| 9 | 9 |
| 10 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
| 11 #include "media/cast/sender/h264_vt_encoder.h" | 11 #include "media/cast/sender/h264_vt_encoder.h" |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 namespace cast { | 15 namespace cast { |
| 16 | 16 |
| 17 // static | 17 // static |
| 18 scoped_ptr<VideoEncoder> VideoEncoder::Create( | 18 scoped_ptr<VideoEncoder> VideoEncoder::Create( |
| 19 const scoped_refptr<CastEnvironment>& cast_environment, | 19 const scoped_refptr<CastEnvironment>& cast_environment, |
| 20 const VideoSenderConfig& video_config, | 20 const VideoSenderConfig& video_config, |
| 21 const StatusChangeCallback& status_change_cb, | 21 const StatusChangeCallback& status_change_cb, |
| 22 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, | 22 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
| 23 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb) { | 23 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb) { |
| 24 // On MacOS or IOS, attempt to use the system VideoToolbox library to | 24 // On MacOS or IOS, attempt to use the system VideoToolbox library to |
| 25 // perform optimized H.264 encoding. | 25 // perform optimized H.264 encoding. |
| 26 #if defined(OS_MACOSX) || defined(OS_IOS) | 26 #if defined(OS_MACOSX) || defined(OS_IOS) |
| 27 if (!video_config.use_external_encoder && | 27 if (!video_config.use_external_encoder && |
| 28 H264VideoToolboxEncoder::IsSupported(video_config)) { | 28 H264VideoToolboxEncoder::IsSupported(video_config)) { |
| 29 return scoped_ptr<VideoEncoder>( | 29 return scoped_ptr<VideoEncoder>(new H264VideoToolboxEncoder( |
| 30 new SizeAdaptableH264VideoToolboxVideoEncoder( | 30 cast_environment, video_config, status_change_cb)); |
| 31 cast_environment, | |
| 32 video_config, | |
| 33 status_change_cb)); | |
| 34 } | 31 } |
| 35 #endif // defined(OS_MACOSX) | 32 #endif // defined(OS_MACOSX) |
| 36 | 33 |
| 37 #if !defined(OS_IOS) | 34 #if !defined(OS_IOS) |
| 38 // If the system provides a hardware-accelerated encoder, use it. | 35 // If the system provides a hardware-accelerated encoder, use it. |
| 39 if (ExternalVideoEncoder::IsSupported(video_config)) { | 36 if (ExternalVideoEncoder::IsSupported(video_config)) { |
| 40 return scoped_ptr<VideoEncoder>(new SizeAdaptableExternalVideoEncoder( | 37 return scoped_ptr<VideoEncoder>(new SizeAdaptableExternalVideoEncoder( |
| 41 cast_environment, | 38 cast_environment, |
| 42 video_config, | 39 video_config, |
| 43 status_change_cb, | 40 status_change_cb, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 60 | 57 |
| 61 scoped_ptr<VideoFrameFactory> VideoEncoder::CreateVideoFrameFactory() { | 58 scoped_ptr<VideoFrameFactory> VideoEncoder::CreateVideoFrameFactory() { |
| 62 return nullptr; | 59 return nullptr; |
| 63 } | 60 } |
| 64 | 61 |
| 65 void VideoEncoder::EmitFrames() { | 62 void VideoEncoder::EmitFrames() { |
| 66 } | 63 } |
| 67 | 64 |
| 68 } // namespace cast | 65 } // namespace cast |
| 69 } // namespace media | 66 } // namespace media |
| OLD | NEW |