Unregister from GCM when the only GCM app is removed
[chromium-blink-merge.git] / media / cast / sender / video_encoder.cc
blobd65bf3c8dc845dcf4ad0a8e808e474f7655060eb
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
3 // found in the LICENSE file.
5 #include "media/cast/sender/video_encoder.h"
7 #include "media/cast/sender/external_video_encoder.h"
8 #include "media/cast/sender/video_encoder_impl.h"
10 #if defined(OS_MACOSX)
11 #include "media/cast/sender/h264_vt_encoder.h"
12 #endif
14 namespace media {
15 namespace cast {
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));
35 #endif // defined(OS_MACOSX)
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));
47 #endif // !defined(OS_IOS)
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));
57 // No encoder implementation will suffice.
58 return nullptr;
61 scoped_ptr<VideoFrameFactory> VideoEncoder::CreateVideoFrameFactory() {
62 return nullptr;
65 void VideoEncoder::EmitFrames() {
68 } // namespace cast
69 } // namespace media