| 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/gpu/rtc_video_encoder_factory.h" | 5 #include "content/renderer/media/gpu/rtc_video_encoder_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
| 9 #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" | 9 #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" |
| 10 #include "content/renderer/media/gpu/rtc_video_encoder.h" | 10 #include "content/renderer/media/gpu/rtc_video_encoder.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( | 32 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( |
| 33 webrtc::kVideoCodecVP8, "VP8", width, height, fps)); | 33 webrtc::kVideoCodecVP8, "VP8", width, height, fps)); |
| 34 } else if (profile.profile >= media::H264PROFILE_MIN && | 34 } else if (profile.profile >= media::H264PROFILE_MIN && |
| 35 profile.profile <= media::H264PROFILE_MAX) { | 35 profile.profile <= media::H264PROFILE_MAX) { |
| 36 // Enable H264 HW encode for WebRTC when SW fallback is available, which is | 36 // Enable H264 HW encode for WebRTC when SW fallback is available, which is |
| 37 // checked by kWebRtcH264WithOpenH264FFmpeg flag. This check should be | 37 // checked by kWebRtcH264WithOpenH264FFmpeg flag. This check should be |
| 38 // removed when SW implementation is fully enabled. | 38 // removed when SW implementation is fully enabled. |
| 39 // kEnableWebRtcHWH264Encoding flag is only enabled for extensions, and | 39 // kEnableWebRtcHWH264Encoding flag is only enabled for extensions, and |
| 40 // can be used without SW fallback. | 40 // can be used without SW fallback. |
| 41 bool webrtc_h264_sw_enabled = false; | 41 bool webrtc_h264_sw_enabled = false; |
| 42 #if BUILDFLAG(RTC_USE_H264) | 42 #if BUILDFLAG(RTC_USE_H264) && !defined(MEDIA_DISABLE_FFMPEG) |
| 43 webrtc_h264_sw_enabled = | 43 webrtc_h264_sw_enabled = |
| 44 base::FeatureList::IsEnabled(kWebRtcH264WithOpenH264FFmpeg); | 44 base::FeatureList::IsEnabled(kWebRtcH264WithOpenH264FFmpeg); |
| 45 #endif // BUILDFLAG(RTC_USE_H264) | 45 #endif // BUILDFLAG(RTC_USE_H264) && !defined(MEDIA_DISABLE_FFMPEG) |
| 46 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWH264Encoding) || | 46 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWH264Encoding) || |
| 47 webrtc_h264_sw_enabled) { | 47 webrtc_h264_sw_enabled) { |
| 48 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( | 48 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( |
| 49 webrtc::kVideoCodecH264, "H264", width, height, fps)); | 49 webrtc::kVideoCodecH264, "H264", width, height, fps)); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // anonymous namespace | 54 } // anonymous namespace |
| 55 | 55 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 77 RTCVideoEncoderFactory::codecs() const { | 77 RTCVideoEncoderFactory::codecs() const { |
| 78 return codecs_; | 78 return codecs_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void RTCVideoEncoderFactory::DestroyVideoEncoder( | 81 void RTCVideoEncoderFactory::DestroyVideoEncoder( |
| 82 webrtc::VideoEncoder* encoder) { | 82 webrtc::VideoEncoder* encoder) { |
| 83 delete encoder; | 83 delete encoder; |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace content | 86 } // namespace content |
| OLD | NEW |