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/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" |
(...skipping 26 matching lines...) Expand all Loading... |
37 webrtc::kVideoCodecH264, "H264", width, height, fps)); | 37 webrtc::kVideoCodecH264, "H264", width, height, fps)); |
38 } | 38 } |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 } // anonymous namespace | 42 } // anonymous namespace |
43 | 43 |
44 RTCVideoEncoderFactory::RTCVideoEncoderFactory( | 44 RTCVideoEncoderFactory::RTCVideoEncoderFactory( |
45 const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories) | 45 const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories) |
46 : gpu_factories_(gpu_factories) { | 46 : gpu_factories_(gpu_factories) { |
47 const std::vector<media::VideoEncodeAccelerator::SupportedProfile>& profiles = | 47 const media::VideoEncodeAccelerator::SupportedProfiles& profiles = |
48 gpu_factories_->GetVideoEncodeAcceleratorSupportedProfiles(); | 48 gpu_factories_->GetVideoEncodeAcceleratorSupportedProfiles(); |
49 for (const auto& profile : profiles) | 49 for (const auto& profile : profiles) |
50 VEAToWebRTCCodecs(&codecs_, profile); | 50 VEAToWebRTCCodecs(&codecs_, profile); |
51 } | 51 } |
52 | 52 |
53 RTCVideoEncoderFactory::~RTCVideoEncoderFactory() {} | 53 RTCVideoEncoderFactory::~RTCVideoEncoderFactory() {} |
54 | 54 |
55 webrtc::VideoEncoder* RTCVideoEncoderFactory::CreateVideoEncoder( | 55 webrtc::VideoEncoder* RTCVideoEncoderFactory::CreateVideoEncoder( |
56 webrtc::VideoCodecType type) { | 56 webrtc::VideoCodecType type) { |
57 for (const auto& codec : codecs_) { | 57 for (const auto& codec : codecs_) { |
58 if (codec.type == type) | 58 if (codec.type == type) |
59 return new RTCVideoEncoder(type, gpu_factories_); | 59 return new RTCVideoEncoder(type, gpu_factories_); |
60 } | 60 } |
61 return nullptr; | 61 return nullptr; |
62 } | 62 } |
63 | 63 |
64 const std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>& | 64 const std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>& |
65 RTCVideoEncoderFactory::codecs() const { | 65 RTCVideoEncoderFactory::codecs() const { |
66 return codecs_; | 66 return codecs_; |
67 } | 67 } |
68 | 68 |
69 void RTCVideoEncoderFactory::DestroyVideoEncoder( | 69 void RTCVideoEncoderFactory::DestroyVideoEncoder( |
70 webrtc::VideoEncoder* encoder) { | 70 webrtc::VideoEncoder* encoder) { |
71 delete encoder; | 71 delete encoder; |
72 } | 72 } |
73 | 73 |
74 } // namespace content | 74 } // namespace content |
OLD | NEW |