Chromium Code Reviews| Index: chrome/gpu/gpu_arc_video_service.cc |
| diff --git a/chrome/gpu/gpu_arc_video_service.cc b/chrome/gpu/gpu_arc_video_service.cc |
| index b18feac72d07437542c41fa3cc32e94feff8169b..ee79521a2155a11d38fd0b90b18261294ca1e391 100644 |
| --- a/chrome/gpu/gpu_arc_video_service.cc |
| +++ b/chrome/gpu/gpu_arc_video_service.cc |
| @@ -111,24 +111,6 @@ struct TypeConverter<chromeos::arc::ArcVideoAccelerator::Config, |
| } |
| }; |
| -template <> |
| -struct TypeConverter<chromeos::arc::ArcVideoAccelerator::DmabufPlane, |
| - arc::mojom::ArcVideoAcceleratorDmabufPlanePtr> { |
| - static chromeos::arc::ArcVideoAccelerator::DmabufPlane Convert( |
| - const arc::mojom::ArcVideoAcceleratorDmabufPlanePtr& input) { |
| - chromeos::arc::ArcVideoAccelerator::DmabufPlane result = {0}; |
| - if (input->offset < 0 || input->stride < 0) { |
| - DVLOG(1) << "Invalid offset/stride: " << input->offset << "/" |
| - << input->stride; |
| - return result; |
| - } |
| - |
| - result.offset = input->offset; |
| - result.stride = input->stride; |
| - return result; |
| - } |
| -}; |
| - |
| } // namespace mojo |
| namespace chromeos { |
| @@ -263,7 +245,7 @@ void GpuArcVideoService::DeprecatedBindDmabuf(::arc::mojom::PortType port, |
| uint32_t index, |
| mojo::ScopedHandle dmabuf_handle, |
| int32_t stride) { |
| - mojo::Array<::arc::mojom::ArcVideoAcceleratorDmabufPlanePtr> planes(1); |
| + std::vector<::arc::mojom::ArcVideoAcceleratorDmabufPlanePtr> planes(1); |
| planes[0]->offset = 0; |
| planes[0]->stride = stride; |
| @@ -274,7 +256,7 @@ void GpuArcVideoService::BindDmabuf( |
| ::arc::mojom::PortType port, |
| uint32_t index, |
| mojo::ScopedHandle dmabuf_handle, |
| - mojo::Array<::arc::mojom::ArcVideoAcceleratorDmabufPlanePtr> |
| + std::vector<::arc::mojom::ArcVideoAcceleratorDmabufPlanePtr> |
| dmabuf_planes) { |
| DVLOG(2) << "BindDmabuf port=" << port << ", index=" << index; |
| @@ -282,8 +264,17 @@ void GpuArcVideoService::BindDmabuf( |
| if (!fd.is_valid()) |
| return; |
| - std::vector<ArcVideoAccelerator::DmabufPlane> converted_planes = |
| - dmabuf_planes.To<std::vector<ArcVideoAccelerator::DmabufPlane>>(); |
| + std::vector<ArcVideoAccelerator::DmabufPlane> converted_planes; |
| + // TODO(yusukes): Use mojo typemaps to simplify the code. |
| + for (const auto& input : dmabuf_planes) { |
| + if (input->offset < 0 || input->stride < 0) { |
| + DVLOG(1) << "Invalid offset/stride: " << input->offset << "/" |
| + << input->stride; |
| + converted_planes.emplace_back(0, 0); |
|
Pawel Osciak
2016/11/17 01:24:18
Nit: it might actually be better to just report an
Yusuke Sato
2016/11/17 02:43:17
Done.
|
| + } else { |
| + converted_planes.emplace_back(input->offset, input->stride); |
| + } |
| + } |
| accelerator_->BindDmabuf(static_cast<PortType>(port), index, std::move(fd), |
| std::move(converted_planes)); |