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 "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
11 #include "ipc/ipc_message_macros.h" | 11 #include "ipc/ipc_message_macros.h" |
12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
13 | 13 |
| 14 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 15 #include "content/common/gpu/media/exynos_video_encode_accelerator.h" |
| 16 #endif |
| 17 |
14 namespace content { | 18 namespace content { |
15 | 19 |
16 GpuVideoEncodeAccelerator::GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, | 20 GpuVideoEncodeAccelerator::GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, |
17 int32 route_id) | 21 int32 route_id) |
18 : channel_(gpu_channel), | 22 : channel_(gpu_channel), |
19 route_id_(route_id), | 23 route_id_(route_id), |
20 input_format_(media::VideoFrame::INVALID), | 24 input_format_(media::VideoFrame::INVALID), |
21 output_buffer_size_(0) {} | 25 output_buffer_size_(0) {} |
22 | 26 |
23 GpuVideoEncodeAccelerator::~GpuVideoEncodeAccelerator() { | 27 GpuVideoEncodeAccelerator::~GpuVideoEncodeAccelerator() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 void GpuVideoEncodeAccelerator::NotifyError( | 74 void GpuVideoEncodeAccelerator::NotifyError( |
71 media::VideoEncodeAccelerator::Error error) { | 75 media::VideoEncodeAccelerator::Error error) { |
72 Send(new AcceleratedVideoEncoderHostMsg_NotifyError(route_id_, error)); | 76 Send(new AcceleratedVideoEncoderHostMsg_NotifyError(route_id_, error)); |
73 } | 77 } |
74 | 78 |
75 // static | 79 // static |
76 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 80 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
77 GpuVideoEncodeAccelerator::GetSupportedProfiles() { | 81 GpuVideoEncodeAccelerator::GetSupportedProfiles() { |
78 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles; | 82 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles; |
79 | 83 |
| 84 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 85 profiles = ExynosVideoEncodeAccelerator::GetSupportedProfiles(); |
| 86 #endif |
| 87 |
80 // TODO(sheu): return platform-specific profiles. | 88 // TODO(sheu): return platform-specific profiles. |
81 return profiles; | 89 return profiles; |
82 } | 90 } |
83 | 91 |
84 void GpuVideoEncodeAccelerator::CreateEncoder() { | 92 void GpuVideoEncodeAccelerator::CreateEncoder() { |
85 // TODO(sheu): actual create the encoder. | 93 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 94 encoder_.reset(new ExynosVideoEncodeAccelerator(this)); |
| 95 #endif |
86 } | 96 } |
87 | 97 |
88 void GpuVideoEncodeAccelerator::OnInitialize( | 98 void GpuVideoEncodeAccelerator::OnInitialize( |
89 media::VideoFrame::Format input_format, | 99 media::VideoFrame::Format input_format, |
90 const gfx::Size& input_visible_size, | 100 const gfx::Size& input_visible_size, |
91 media::VideoCodecProfile output_profile, | 101 media::VideoCodecProfile output_profile, |
92 int32 initial_bitrate) { | 102 int32 initial_bitrate) { |
93 DVLOG(2) << "GpuVideoEncodeAccelerator::OnInitialize(): " | 103 DVLOG(2) << "GpuVideoEncodeAccelerator::OnInitialize(): " |
94 "input_format=" << input_format | 104 "input_format=" << input_format |
95 << ", input_visible_size=" << input_visible_size.ToString() | 105 << ", input_visible_size=" << input_visible_size.ToString() |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return; | 231 return; |
222 } else if (!channel_->Send(message)) { | 232 } else if (!channel_->Send(message)) { |
223 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): sending failed: " | 233 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): sending failed: " |
224 "message->type()=" << message->type(); | 234 "message->type()=" << message->type(); |
225 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); | 235 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); |
226 return; | 236 return; |
227 } | 237 } |
228 } | 238 } |
229 | 239 |
230 } // namespace content | 240 } // namespace content |
OLD | NEW |