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

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

Issue 453063002: Only allow webrtc HW offload for H264 encode for extension process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a content common switch instead. Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/public/common/content_switches.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | 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/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 "content/common/gpu/client/gpu_video_encode_accelerator_host.h" 8 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h"
9 #include "content/public/common/content_switches.h"
8 #include "content/renderer/media/rtc_video_encoder.h" 10 #include "content/renderer/media/rtc_video_encoder.h"
9 #include "media/filters/gpu_video_accelerator_factories.h" 11 #include "media/filters/gpu_video_accelerator_factories.h"
10 #include "media/video/video_encode_accelerator.h" 12 #include "media/video/video_encode_accelerator.h"
11 13
12 namespace content { 14 namespace content {
13 15
14 namespace { 16 namespace {
15 17
16 // Translate from media::VideoEncodeAccelerator::SupportedProfile to 18 // Translate from media::VideoEncodeAccelerator::SupportedProfile to
17 // one or more instances of cricket::WebRtcVideoEncoderFactory::VideoCodec 19 // one or more instances of cricket::WebRtcVideoEncoderFactory::VideoCodec
18 void VEAToWebRTCCodecs( 20 void VEAToWebRTCCodecs(
19 std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>* codecs, 21 std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>* codecs,
20 const media::VideoEncodeAccelerator::SupportedProfile& profile) { 22 const media::VideoEncodeAccelerator::SupportedProfile& profile) {
21 int width = profile.max_resolution.width(); 23 int width = profile.max_resolution.width();
22 int height = profile.max_resolution.height(); 24 int height = profile.max_resolution.height();
23 int fps = profile.max_framerate.numerator; 25 int fps = profile.max_framerate.numerator;
24 DCHECK_EQ(profile.max_framerate.denominator, 1U); 26 DCHECK_EQ(profile.max_framerate.denominator, 1U);
25 27
26 if (profile.profile >= media::VP8PROFILE_MIN && 28 if (profile.profile >= media::VP8PROFILE_MIN &&
27 profile.profile <= media::VP8PROFILE_MAX) { 29 profile.profile <= media::VP8PROFILE_MAX) {
28 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( 30 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec(
29 webrtc::kVideoCodecVP8, "VP8", width, height, fps)); 31 webrtc::kVideoCodecVP8, "VP8", width, height, fps));
30 } else if (profile.profile >= media::H264PROFILE_MIN && 32 } else if (profile.profile >= media::H264PROFILE_MIN &&
31 profile.profile <= media::H264PROFILE_MAX) { 33 profile.profile <= media::H264PROFILE_MAX) {
32 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( 34 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec(
33 webrtc::kVideoCodecGeneric, "CAST1", width, height, fps)); 35 webrtc::kVideoCodecGeneric, "CAST1", width, height, fps));
34 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( 36 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
35 webrtc::kVideoCodecH264, "H264", width, height, fps)); 37 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWH264Encoding)) {
Pawel Osciak 2014/08/19 01:30:27 Could we please have this together with the kEnabl
hshi1 2014/08/19 17:34:49 You mean also check for the VP8 flag above? Done.
Pawel Osciak 2014/08/20 01:49:29 Not exactly, I meant we should not have checks for
38 codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec(
39 webrtc::kVideoCodecH264, "H264", width, height, fps));
40 }
36 } 41 }
37 } 42 }
38 43
39 // Translate from cricket::WebRtcVideoEncoderFactory::VideoCodec to 44 // Translate from cricket::WebRtcVideoEncoderFactory::VideoCodec to
40 // media::VideoCodecProfile. Pick a default profile for each codec type. 45 // media::VideoCodecProfile. Pick a default profile for each codec type.
41 media::VideoCodecProfile WebRTCCodecToVideoCodecProfile( 46 media::VideoCodecProfile WebRTCCodecToVideoCodecProfile(
42 webrtc::VideoCodecType type) { 47 webrtc::VideoCodecType type) {
43 switch (type) { 48 switch (type) {
44 case webrtc::kVideoCodecVP8: 49 case webrtc::kVideoCodecVP8:
45 return media::VP8PROFILE_ANY; 50 return media::VP8PROFILE_ANY;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 RTCVideoEncoderFactory::codecs() const { 95 RTCVideoEncoderFactory::codecs() const {
91 return codecs_; 96 return codecs_;
92 } 97 }
93 98
94 void RTCVideoEncoderFactory::DestroyVideoEncoder( 99 void RTCVideoEncoderFactory::DestroyVideoEncoder(
95 webrtc::VideoEncoder* encoder) { 100 webrtc::VideoEncoder* encoder) {
96 delete encoder; 101 delete encoder;
97 } 102 }
98 103
99 } // namespace content 104 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/content_switches.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698