Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: content/renderer/media/gpu/rtc_video_encoder_factory.cc

Issue 2125163003: Reland "Use kEnableWebRtcHWH264Encoding flag when SW fallback is available" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
26 const int fps = profile.max_framerate_numerator; 26 const int fps = profile.max_framerate_numerator;
27 DCHECK_EQ(profile.max_framerate_denominator, 1U); 27 DCHECK_EQ(profile.max_framerate_denominator, 1U);
28 28
29 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 29 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
30 if (profile.profile >= media::VP8PROFILE_MIN && 30 if (profile.profile >= media::VP8PROFILE_MIN &&
31 profile.profile <= media::VP8PROFILE_MAX) { 31 profile.profile <= media::VP8PROFILE_MAX) {
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 bool webrtc_h264_enabled = false; 36 // Enable H264 HW encode for WebRTC when SW fallback is available, which is
37 #if BUILDFLAG(RTC_USE_H264) && defined(OS_MACOSX) 37 // checked by kWebRtcH264WithOpenH264FFmpeg flag. This check should be
38 webrtc_h264_enabled = 38 // removed when SW implementation is fully enabled.
39 // kEnableWebRtcHWH264Encoding flag is only enabled for extensions, and
40 // can be used without SW fallback.
41 bool webrtc_h264_sw_enabled = false;
42 #if BUILDFLAG(RTC_USE_H264)
43 webrtc_h264_sw_enabled =
39 base::FeatureList::IsEnabled(kWebRtcH264WithOpenH264FFmpeg); 44 base::FeatureList::IsEnabled(kWebRtcH264WithOpenH264FFmpeg);
40 #endif // BUILDFLAG(RTC_USE_H264) && defined(OS_MACOSX) 45 #endif // BUILDFLAG(RTC_USE_H264)
41 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWH264Encoding) || 46 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWH264Encoding) ||
42 webrtc_h264_enabled) { 47 webrtc_h264_sw_enabled) {
43 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( 48 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec(
44 webrtc::kVideoCodecH264, "H264", width, height, fps)); 49 webrtc::kVideoCodecH264, "H264", width, height, fps));
45 } 50 }
46 } 51 }
47 } 52 }
48 53
49 } // anonymous namespace 54 } // anonymous namespace
50 55
51 RTCVideoEncoderFactory::RTCVideoEncoderFactory( 56 RTCVideoEncoderFactory::RTCVideoEncoderFactory(
52 media::GpuVideoAcceleratorFactories* gpu_factories) 57 media::GpuVideoAcceleratorFactories* gpu_factories)
(...skipping 19 matching lines...) Expand all
72 RTCVideoEncoderFactory::codecs() const { 77 RTCVideoEncoderFactory::codecs() const {
73 return codecs_; 78 return codecs_;
74 } 79 }
75 80
76 void RTCVideoEncoderFactory::DestroyVideoEncoder( 81 void RTCVideoEncoderFactory::DestroyVideoEncoder(
77 webrtc::VideoEncoder* encoder) { 82 webrtc::VideoEncoder* encoder) {
78 delete encoder; 83 delete encoder;
79 } 84 }
80 85
81 } // namespace content 86 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698