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

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

Issue 568413002: Add VEA supported profiles to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use GPUInfo Created 6 years, 3 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 | « content/renderer/media/renderer_gpu_video_accelerator_factories.cc ('k') | gpu/config/BUILD.gn » ('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 "base/command_line.h"
8 #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" 9 #include "content/public/common/content_switches.h"
10 #include "content/renderer/media/rtc_video_encoder.h" 10 #include "content/renderer/media/rtc_video_encoder.h"
11 #include "media/filters/gpu_video_accelerator_factories.h" 11 #include "media/filters/gpu_video_accelerator_factories.h"
12 #include "media/video/video_encode_accelerator.h" 12 #include "media/video/video_encode_accelerator.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 namespace { 16 namespace {
17 17
18 // Translate from media::VideoEncodeAccelerator::SupportedProfile to 18 // Translate from media::VideoEncodeAccelerator::SupportedProfile to
19 // one or more instances of cricket::WebRtcVideoEncoderFactory::VideoCodec 19 // one or more instances of cricket::WebRtcVideoEncoderFactory::VideoCodec
20 void VEAToWebRTCCodecs( 20 void VEAToWebRTCCodecs(
21 std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>* codecs, 21 std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>* codecs,
22 const media::VideoEncodeAccelerator::SupportedProfile& profile) { 22 const media::VideoEncodeAccelerator::SupportedProfile& profile) {
23 int width = profile.max_resolution.width(); 23 int width = profile.max_resolution.width();
24 int height = profile.max_resolution.height(); 24 int height = profile.max_resolution.height();
25 int fps = profile.max_framerate.numerator; 25 int fps = profile.max_framerate_numerator;
26 DCHECK_EQ(profile.max_framerate.denominator, 1U); 26 DCHECK_EQ(profile.max_framerate_denominator, 1U);
27 27
28 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 28 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
29 if (profile.profile >= media::VP8PROFILE_MIN && 29 if (profile.profile >= media::VP8PROFILE_MIN &&
30 profile.profile <= media::VP8PROFILE_MAX) { 30 profile.profile <= media::VP8PROFILE_MAX) {
31 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWVp8Encoding)) { 31 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWVp8Encoding)) {
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 } 34 }
35 } else if (profile.profile >= media::H264PROFILE_MIN && 35 } else if (profile.profile >= media::H264PROFILE_MIN &&
36 profile.profile <= media::H264PROFILE_MAX) { 36 profile.profile <= media::H264PROFILE_MAX) {
(...skipping 15 matching lines...) Expand all
52 case webrtc::kVideoCodecVP8: 52 case webrtc::kVideoCodecVP8:
53 return media::VP8PROFILE_ANY; 53 return media::VP8PROFILE_ANY;
54 case webrtc::kVideoCodecH264: 54 case webrtc::kVideoCodecH264:
55 case webrtc::kVideoCodecGeneric: 55 case webrtc::kVideoCodecGeneric:
56 return media::H264PROFILE_MAIN; 56 return media::H264PROFILE_MAIN;
57 default: 57 default:
58 return media::VIDEO_CODEC_PROFILE_UNKNOWN; 58 return media::VIDEO_CODEC_PROFILE_UNKNOWN;
59 } 59 }
60 } 60 }
61 61
62 } // anonymous namespace 62 } // anonymouse namespace
kenrb 2014/09/22 15:25:11 ?
wuchengli 2014/09/23 03:37:24 Fixed.
63 63
64 RTCVideoEncoderFactory::RTCVideoEncoderFactory( 64 RTCVideoEncoderFactory::RTCVideoEncoderFactory(
65 const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories) 65 const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories)
66 : gpu_factories_(gpu_factories) { 66 : gpu_factories_(gpu_factories) {
67 // Query media::VideoEncodeAccelerator (statically) for our supported codecs. 67 // Query media::VideoEncodeAccelerator for our supported codecs.
68 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles = 68 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles =
69 GpuVideoEncodeAcceleratorHost::GetSupportedProfiles(); 69 gpu_factories_->GetVideoEncodeAcceleratorSupportedProfiles();
70 for (size_t i = 0; i < profiles.size(); ++i) 70 for (size_t i = 0; i < profiles.size(); ++i)
71 VEAToWebRTCCodecs(&codecs_, profiles[i]); 71 VEAToWebRTCCodecs(&codecs_, profiles[i]);
72 } 72 }
73 73
74 RTCVideoEncoderFactory::~RTCVideoEncoderFactory() {} 74 RTCVideoEncoderFactory::~RTCVideoEncoderFactory() {}
75 75
76 webrtc::VideoEncoder* RTCVideoEncoderFactory::CreateVideoEncoder( 76 webrtc::VideoEncoder* RTCVideoEncoderFactory::CreateVideoEncoder(
77 webrtc::VideoCodecType type) { 77 webrtc::VideoCodecType type) {
78 bool found = false; 78 bool found = false;
79 for (size_t i = 0; i < codecs_.size(); ++i) { 79 for (size_t i = 0; i < codecs_.size(); ++i) {
(...skipping 18 matching lines...) Expand all
98 RTCVideoEncoderFactory::codecs() const { 98 RTCVideoEncoderFactory::codecs() const {
99 return codecs_; 99 return codecs_;
100 } 100 }
101 101
102 void RTCVideoEncoderFactory::DestroyVideoEncoder( 102 void RTCVideoEncoderFactory::DestroyVideoEncoder(
103 webrtc::VideoEncoder* encoder) { 103 webrtc::VideoEncoder* encoder) {
104 delete encoder; 104 delete encoder;
105 } 105 }
106 106
107 } // namespace content 107 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/renderer_gpu_video_accelerator_factories.cc ('k') | gpu/config/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698