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

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

Issue 668633002: Duplicate VideoEncodeAccelerator::SupportedProfile in gpu_info.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 gpu::VideoEncodeAcceleratorSupportedProfile 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 gpu::VideoEncodeAcceleratorSupportedProfile& 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(
(...skipping 24 matching lines...) Expand all
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 } // anonymous namespace
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 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles = 67 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> profiles =
68 gpu_factories_->GetVideoEncodeAcceleratorSupportedProfiles(); 68 gpu_factories_->GetVideoEncodeAcceleratorSupportedProfiles();
69 for (size_t i = 0; i < profiles.size(); ++i) 69 for (size_t i = 0; i < profiles.size(); ++i)
70 VEAToWebRTCCodecs(&codecs_, profiles[i]); 70 VEAToWebRTCCodecs(&codecs_, profiles[i]);
71 } 71 }
72 72
73 RTCVideoEncoderFactory::~RTCVideoEncoderFactory() {} 73 RTCVideoEncoderFactory::~RTCVideoEncoderFactory() {}
74 74
75 webrtc::VideoEncoder* RTCVideoEncoderFactory::CreateVideoEncoder( 75 webrtc::VideoEncoder* RTCVideoEncoderFactory::CreateVideoEncoder(
76 webrtc::VideoCodecType type) { 76 webrtc::VideoCodecType type) {
77 bool found = false; 77 bool found = false;
(...skipping 13 matching lines...) Expand all
91 RTCVideoEncoderFactory::codecs() const { 91 RTCVideoEncoderFactory::codecs() const {
92 return codecs_; 92 return codecs_;
93 } 93 }
94 94
95 void RTCVideoEncoderFactory::DestroyVideoEncoder( 95 void RTCVideoEncoderFactory::DestroyVideoEncoder(
96 webrtc::VideoEncoder* encoder) { 96 webrtc::VideoEncoder* encoder) {
97 delete encoder; 97 delete encoder;
98 } 98 }
99 99
100 } // namespace content 100 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698