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/common/gpu/client/gpu_video_encode_accelerator_host.h" | 5 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "content/common/gpu/client/gpu_channel_host.h" | 9 #include "content/common/gpu/client/gpu_channel_host.h" |
10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 channel_ = NULL; | 67 channel_ = NULL; |
68 } | 68 } |
69 NOTIFY_ERROR(kPlatformFailureError) << "OnChannelError()"; | 69 NOTIFY_ERROR(kPlatformFailureError) << "OnChannelError()"; |
70 } | 70 } |
71 | 71 |
72 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 72 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
73 GpuVideoEncodeAcceleratorHost::GetSupportedProfiles() { | 73 GpuVideoEncodeAcceleratorHost::GetSupportedProfiles() { |
74 DCHECK(CalledOnValidThread()); | 74 DCHECK(CalledOnValidThread()); |
75 if (!channel_) | 75 if (!channel_) |
76 return std::vector<media::VideoEncodeAccelerator::SupportedProfile>(); | 76 return std::vector<media::VideoEncodeAccelerator::SupportedProfile>(); |
77 return channel_->gpu_info().video_encode_accelerator_supported_profiles; | 77 return ConvertGpuToMediaProfiles( |
78 channel_->gpu_info().video_encode_accelerator_supported_profiles); | |
79 } | |
80 | |
81 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | |
82 GpuVideoEncodeAcceleratorHost::ConvertGpuToMediaProfiles(const std::vector< | |
83 gpu::VideoEncodeAcceleratorSupportedProfile>& gpu_profiles) { | |
84 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles; | |
85 for (size_t i = 0; i < gpu_profiles.size(); i++) { | |
86 media::VideoEncodeAccelerator::SupportedProfile profile; | |
87 profile.profile = | |
88 static_cast<media::VideoCodecProfile>(gpu_profiles[i].profile); | |
piman
2014/10/22 20:46:31
Can you add a list of static_asserts that check th
| |
89 profile.max_resolution = gpu_profiles[i].max_resolution; | |
90 profile.max_framerate_numerator = gpu_profiles[i].max_framerate_numerator; | |
91 profile.max_framerate_denominator = | |
92 gpu_profiles[i].max_framerate_denominator; | |
93 profiles.push_back(profile); | |
94 } | |
95 return profiles; | |
78 } | 96 } |
79 | 97 |
80 bool GpuVideoEncodeAcceleratorHost::Initialize( | 98 bool GpuVideoEncodeAcceleratorHost::Initialize( |
81 media::VideoFrame::Format input_format, | 99 media::VideoFrame::Format input_format, |
82 const gfx::Size& input_visible_size, | 100 const gfx::Size& input_visible_size, |
83 media::VideoCodecProfile output_profile, | 101 media::VideoCodecProfile output_profile, |
84 uint32 initial_bitrate, | 102 uint32 initial_bitrate, |
85 Client* client) { | 103 Client* client) { |
86 DCHECK(CalledOnValidThread()); | 104 DCHECK(CalledOnValidThread()); |
87 client_ = client; | 105 client_ = client; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 weak_this_factory_.InvalidateWeakPtrs(); | 287 weak_this_factory_.InvalidateWeakPtrs(); |
270 | 288 |
271 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 289 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
272 // last thing done on this stack! | 290 // last thing done on this stack! |
273 media::VideoEncodeAccelerator::Client* client = NULL; | 291 media::VideoEncodeAccelerator::Client* client = NULL; |
274 std::swap(client_, client); | 292 std::swap(client_, client); |
275 client->NotifyError(error); | 293 client->NotifyError(error); |
276 } | 294 } |
277 | 295 |
278 } // namespace content | 296 } // namespace content |
OLD | NEW |