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 30 matching lines...) Expand all Loading... |
41 if (!IsCodecDisabledByCommandLine(cmd_line, | 41 if (!IsCodecDisabledByCommandLine(cmd_line, |
42 switches::kDisableWebRtcHWEncodingVPx)) { | 42 switches::kDisableWebRtcHWEncodingVPx)) { |
43 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( | 43 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( |
44 webrtc::kVideoCodecVP8, "VP8", width, height, fps)); | 44 webrtc::kVideoCodecVP8, "VP8", width, height, fps)); |
45 } | 45 } |
46 } else if (profile.profile >= media::H264PROFILE_MIN && | 46 } else if (profile.profile >= media::H264PROFILE_MIN && |
47 profile.profile <= media::H264PROFILE_MAX) { | 47 profile.profile <= media::H264PROFILE_MAX) { |
48 // Enable H264 HW encode for WebRTC when SW fallback is available, which is | 48 // Enable H264 HW encode for WebRTC when SW fallback is available, which is |
49 // checked by kWebRtcH264WithOpenH264FFmpeg flag. This check should be | 49 // checked by kWebRtcH264WithOpenH264FFmpeg flag. This check should be |
50 // removed when SW implementation is fully enabled. | 50 // removed when SW implementation is fully enabled. |
51 // kEnableWebRtcHWH264Encoding flag is only enabled for extensions, and | |
52 // can be used without SW fallback. | |
53 bool webrtc_h264_sw_enabled = false; | 51 bool webrtc_h264_sw_enabled = false; |
54 #if BUILDFLAG(RTC_USE_H264) && !defined(MEDIA_DISABLE_FFMPEG) | 52 #if BUILDFLAG(RTC_USE_H264) && !defined(MEDIA_DISABLE_FFMPEG) |
55 webrtc_h264_sw_enabled = | 53 webrtc_h264_sw_enabled = |
56 base::FeatureList::IsEnabled(kWebRtcH264WithOpenH264FFmpeg); | 54 base::FeatureList::IsEnabled(kWebRtcH264WithOpenH264FFmpeg); |
57 #endif // BUILDFLAG(RTC_USE_H264) && !defined(MEDIA_DISABLE_FFMPEG) | 55 #endif // BUILDFLAG(RTC_USE_H264) && !defined(MEDIA_DISABLE_FFMPEG) |
58 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWH264Encoding) || | 56 if (webrtc_h264_sw_enabled || |
59 webrtc_h264_sw_enabled || | |
60 !IsCodecDisabledByCommandLine(cmd_line, | 57 !IsCodecDisabledByCommandLine(cmd_line, |
61 switches::kDisableWebRtcHWEncodingH264)) { | 58 switches::kDisableWebRtcHWEncodingH264)) { |
62 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( | 59 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( |
63 webrtc::kVideoCodecH264, "H264", width, height, fps)); | 60 webrtc::kVideoCodecH264, "H264", width, height, fps)); |
64 } | 61 } |
65 } | 62 } |
66 } | 63 } |
67 | 64 |
68 } // anonymous namespace | 65 } // anonymous namespace |
69 | 66 |
(...skipping 21 matching lines...) Expand all Loading... |
91 RTCVideoEncoderFactory::codecs() const { | 88 RTCVideoEncoderFactory::codecs() const { |
92 return codecs_; | 89 return codecs_; |
93 } | 90 } |
94 | 91 |
95 void RTCVideoEncoderFactory::DestroyVideoEncoder( | 92 void RTCVideoEncoderFactory::DestroyVideoEncoder( |
96 webrtc::VideoEncoder* encoder) { | 93 webrtc::VideoEncoder* encoder) { |
97 delete encoder; | 94 delete encoder; |
98 } | 95 } |
99 | 96 |
100 } // namespace content | 97 } // namespace content |
OLD | NEW |