OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/media/gpu_video_encode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/gpu/gpu_channel.h" | 8 #include "content/common/gpu/gpu_channel.h" |
9 #include "content/common/gpu/gpu_messages.h" | 9 #include "content/common/gpu/gpu_messages.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
11 | 11 |
| 12 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 13 #include "content/common/gpu/media/exynos_video_encode_accelerator.h" |
| 14 #endif |
| 15 |
12 namespace content { | 16 namespace content { |
13 | 17 |
14 GpuVideoEncodeAccelerator::GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, | 18 GpuVideoEncodeAccelerator::GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, |
15 int32 route_id) | 19 int32 route_id) |
16 : channel_(gpu_channel), route_id_(route_id) {} | 20 : channel_(gpu_channel), route_id_(route_id) {} |
17 | 21 |
18 GpuVideoEncodeAccelerator::~GpuVideoEncodeAccelerator() { | 22 GpuVideoEncodeAccelerator::~GpuVideoEncodeAccelerator() { |
19 encoder_.release()->Destroy(); | 23 encoder_.release()->Destroy(); |
20 } | 24 } |
21 | 25 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 DLOG(ERROR) << "GpuVideoEncodeAccelerator::NotifyError(): Send() failed: " | 87 DLOG(ERROR) << "GpuVideoEncodeAccelerator::NotifyError(): Send() failed: " |
84 "error=" << error; | 88 "error=" << error; |
85 } | 89 } |
86 } | 90 } |
87 | 91 |
88 // static | 92 // static |
89 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 93 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
90 GpuVideoEncodeAccelerator::GetSupportedProfiles() { | 94 GpuVideoEncodeAccelerator::GetSupportedProfiles() { |
91 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles; | 95 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles; |
92 | 96 |
| 97 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 98 profiles = ExynosVideoEncodeAccelerator::GetSupportedProfiles(); |
| 99 #endif |
| 100 |
93 // TODO(sheu): return platform-specific profiles. | 101 // TODO(sheu): return platform-specific profiles. |
94 return profiles; | 102 return profiles; |
95 } | 103 } |
96 | 104 |
97 scoped_ptr<media::VideoEncodeAccelerator> | 105 scoped_ptr<media::VideoEncodeAccelerator> |
98 GpuVideoEncodeAccelerator::CreateEncoder() { | 106 GpuVideoEncodeAccelerator::CreateEncoder() { |
99 scoped_ptr<media::VideoEncodeAccelerator> encoder; | 107 scoped_ptr<media::VideoEncodeAccelerator> encoder; |
100 | 108 |
101 // TODO(sheu): return platform-specific encoder. | 109 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 110 encoder.reset(new ExynosVideoEncodeAccelerator(this)); |
| 111 #endif |
| 112 |
102 return encoder.Pass(); | 113 return encoder.Pass(); |
103 } | 114 } |
104 | 115 |
105 bool GpuVideoEncodeAccelerator::Send(IPC::Message* message) { | 116 bool GpuVideoEncodeAccelerator::Send(IPC::Message* message) { |
106 if (!channel_) { | 117 if (!channel_) { |
107 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): no channel"; | 118 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): no channel"; |
108 delete message; | 119 delete message; |
109 return false; | 120 return false; |
110 } else if (!channel_->Send(message)) { | 121 } else if (!channel_->Send(message)) { |
111 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): sending failed"; | 122 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): sending failed"; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 void GpuVideoEncodeAccelerator::OnRequestEncodingParameterChange( | 192 void GpuVideoEncodeAccelerator::OnRequestEncodingParameterChange( |
182 int32 bitrate) { | 193 int32 bitrate) { |
183 DVLOG(2) << "GpuVideoEncodeAccelerator::OnRequestEncodingParametersChange(): " | 194 DVLOG(2) << "GpuVideoEncodeAccelerator::OnRequestEncodingParametersChange(): " |
184 "bitrate=" << bitrate; | 195 "bitrate=" << bitrate; |
185 if (!encoder_) | 196 if (!encoder_) |
186 return; | 197 return; |
187 encoder_->RequestEncodingParameterChange(bitrate); | 198 encoder_->RequestEncodingParameterChange(bitrate); |
188 } | 199 } |
189 | 200 |
190 } // namespace content | 201 } // namespace content |
OLD | NEW |