Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/rtc_video_encoder_factory.h" | 5 #include "content/renderer/media/rtc_video_encoder_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/feature_list.h" | |
| 8 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h" | 9 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h" |
| 9 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| 11 #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" | |
| 10 #include "content/renderer/media/rtc_video_encoder.h" | 12 #include "content/renderer/media/rtc_video_encoder.h" |
| 11 #include "media/renderers/gpu_video_accelerator_factories.h" | 13 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 12 #include "media/video/video_encode_accelerator.h" | 14 #include "media/video/video_encode_accelerator.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| 17 | 19 |
| 18 // Translate from media::VideoEncodeAccelerator::SupportedProfile to | 20 // Translate from media::VideoEncodeAccelerator::SupportedProfile to |
| 19 // one or more instances of cricket::WebRtcVideoEncoderFactory::VideoCodec | 21 // one or more instances of cricket::WebRtcVideoEncoderFactory::VideoCodec |
| 20 void VEAToWebRTCCodecs( | 22 void VEAToWebRTCCodecs( |
| 21 std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>* codecs, | 23 std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>* codecs, |
| 22 const media::VideoEncodeAccelerator::SupportedProfile& profile) { | 24 const media::VideoEncodeAccelerator::SupportedProfile& profile) { |
| 23 const int width = profile.max_resolution.width(); | 25 const int width = profile.max_resolution.width(); |
| 24 const int height = profile.max_resolution.height(); | 26 const int height = profile.max_resolution.height(); |
| 25 const int fps = profile.max_framerate_numerator; | 27 const int fps = profile.max_framerate_numerator; |
| 26 DCHECK_EQ(profile.max_framerate_denominator, 1U); | 28 DCHECK_EQ(profile.max_framerate_denominator, 1U); |
| 27 | 29 |
| 28 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 30 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 29 if (profile.profile >= media::VP8PROFILE_MIN && | 31 if (profile.profile >= media::VP8PROFILE_MIN && |
| 30 profile.profile <= media::VP8PROFILE_MAX) { | 32 profile.profile <= media::VP8PROFILE_MAX) { |
| 31 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( | 33 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( |
| 32 webrtc::kVideoCodecVP8, "VP8", width, height, fps)); | 34 webrtc::kVideoCodecVP8, "VP8", width, height, fps)); |
| 33 } else if (profile.profile >= media::H264PROFILE_MIN && | 35 } else if (profile.profile >= media::H264PROFILE_MIN && |
| 34 profile.profile <= media::H264PROFILE_MAX) { | 36 profile.profile <= media::H264PROFILE_MAX) { |
| 35 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWH264Encoding)) { | 37 bool webrtc_h264_enabled = false; |
| 38 #if BUILDFLAG(RTC_USE_H264) && defined(OS_MACOSX) | |
| 39 webrtc_h264_enabled = | |
| 40 base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg); | |
|
mcasas
2016/04/07 17:14:42
No need for content::
emircan
2016/04/07 19:23:28
Done.
| |
| 41 #endif // BUILDFLAG(RTC_USE_H264) && defined(OS_MACOSX) | |
| 42 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWH264Encoding) || | |
| 43 webrtc_h264_enabled) { | |
| 36 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( | 44 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( |
| 37 webrtc::kVideoCodecH264, "H264", width, height, fps)); | 45 webrtc::kVideoCodecH264, "H264", width, height, fps)); |
| 38 } | 46 } |
| 39 } | 47 } |
| 40 } | 48 } |
| 41 | 49 |
| 42 } // anonymous namespace | 50 } // anonymous namespace |
| 43 | 51 |
| 44 RTCVideoEncoderFactory::RTCVideoEncoderFactory( | 52 RTCVideoEncoderFactory::RTCVideoEncoderFactory( |
| 45 media::GpuVideoAcceleratorFactories* gpu_factories) | 53 media::GpuVideoAcceleratorFactories* gpu_factories) |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 65 RTCVideoEncoderFactory::codecs() const { | 73 RTCVideoEncoderFactory::codecs() const { |
| 66 return codecs_; | 74 return codecs_; |
| 67 } | 75 } |
| 68 | 76 |
| 69 void RTCVideoEncoderFactory::DestroyVideoEncoder( | 77 void RTCVideoEncoderFactory::DestroyVideoEncoder( |
| 70 webrtc::VideoEncoder* encoder) { | 78 webrtc::VideoEncoder* encoder) { |
| 71 delete encoder; | 79 delete encoder; |
| 72 } | 80 } |
| 73 | 81 |
| 74 } // namespace content | 82 } // namespace content |
| OLD | NEW |