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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
11 #include "content/common/gpu/gpu_channel.h" | 11 #include "content/common/gpu/gpu_channel.h" |
12 #include "content/common/gpu/gpu_messages.h" | 12 #include "content/common/gpu/gpu_messages.h" |
13 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
14 #include "media/base/video_frame.h" | 14 #include "media/base/video_frame.h" |
15 | 15 |
| 16 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 17 #include "content/common/gpu/media/exynos_video_encode_accelerator.h" |
| 18 #endif |
| 19 |
16 namespace content { | 20 namespace content { |
17 | 21 |
18 GpuVideoEncodeAccelerator::GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, | 22 GpuVideoEncodeAccelerator::GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, |
19 int32 route_id) | 23 int32 route_id) |
20 : weak_this_factory_(this), | 24 : weak_this_factory_(this), |
21 channel_(gpu_channel), | 25 channel_(gpu_channel), |
22 route_id_(route_id), | 26 route_id_(route_id), |
23 input_format_(media::VideoFrame::INVALID), | 27 input_format_(media::VideoFrame::INVALID), |
24 output_buffer_size_(0) {} | 28 output_buffer_size_(0) {} |
25 | 29 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 void GpuVideoEncodeAccelerator::NotifyError( | 77 void GpuVideoEncodeAccelerator::NotifyError( |
74 media::VideoEncodeAccelerator::Error error) { | 78 media::VideoEncodeAccelerator::Error error) { |
75 Send(new AcceleratedVideoEncoderHostMsg_NotifyError(route_id_, error)); | 79 Send(new AcceleratedVideoEncoderHostMsg_NotifyError(route_id_, error)); |
76 } | 80 } |
77 | 81 |
78 // static | 82 // static |
79 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 83 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
80 GpuVideoEncodeAccelerator::GetSupportedProfiles() { | 84 GpuVideoEncodeAccelerator::GetSupportedProfiles() { |
81 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles; | 85 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles; |
82 | 86 |
| 87 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 88 profiles = ExynosVideoEncodeAccelerator::GetSupportedProfiles(); |
| 89 #endif |
| 90 |
83 // TODO(sheu): return platform-specific profiles. | 91 // TODO(sheu): return platform-specific profiles. |
84 return profiles; | 92 return profiles; |
85 } | 93 } |
86 | 94 |
87 void GpuVideoEncodeAccelerator::CreateEncoder() { | 95 void GpuVideoEncodeAccelerator::CreateEncoder() { |
88 // TODO(sheu): actual create the encoder. | 96 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 97 encoder_.reset(new ExynosVideoEncodeAccelerator(this)); |
| 98 #endif |
89 } | 99 } |
90 | 100 |
91 void GpuVideoEncodeAccelerator::OnInitialize( | 101 void GpuVideoEncodeAccelerator::OnInitialize( |
92 media::VideoFrame::Format input_format, | 102 media::VideoFrame::Format input_format, |
93 const gfx::Size& input_visible_size, | 103 const gfx::Size& input_visible_size, |
94 media::VideoCodecProfile output_profile, | 104 media::VideoCodecProfile output_profile, |
95 uint32 initial_bitrate) { | 105 uint32 initial_bitrate) { |
96 DVLOG(2) << "GpuVideoEncodeAccelerator::OnInitialize(): " | 106 DVLOG(2) << "GpuVideoEncodeAccelerator::OnInitialize(): " |
97 "input_format=" << input_format | 107 "input_format=" << input_format |
98 << ", input_visible_size=" << input_visible_size.ToString() | 108 << ", input_visible_size=" << input_visible_size.ToString() |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 return; | 248 return; |
239 } else if (!channel_->Send(message)) { | 249 } else if (!channel_->Send(message)) { |
240 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): sending failed: " | 250 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): sending failed: " |
241 "message->type()=" << message->type(); | 251 "message->type()=" << message->type(); |
242 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); | 252 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); |
243 return; | 253 return; |
244 } | 254 } |
245 } | 255 } |
246 | 256 |
247 } // namespace content | 257 } // namespace content |
OLD | NEW |