| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/gpu/arc_gpu_video_decode_accelerator.h" | 5 #include "chrome/gpu/arc_gpu_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/numerics/safe_math.h" | 10 #include "base/numerics/safe_math.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // integer. | 290 // integer. |
| 291 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; | 291 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; |
| 292 int dup_fd = HANDLE_EINTR(dup(input_info->handle.get())); | 292 int dup_fd = HANDLE_EINTR(dup(input_info->handle.get())); |
| 293 if (dup_fd < 0) { | 293 if (dup_fd < 0) { |
| 294 DLOG(ERROR) << "dup() failed."; | 294 DLOG(ERROR) << "dup() failed."; |
| 295 arc_client_->OnError(PLATFORM_FAILURE); | 295 arc_client_->OnError(PLATFORM_FAILURE); |
| 296 return; | 296 return; |
| 297 } | 297 } |
| 298 CreateInputRecord(bitstream_buffer_id, index, metadata.timestamp); | 298 CreateInputRecord(bitstream_buffer_id, index, metadata.timestamp); |
| 299 // TODO(rockot): Pass GUIDs through Mojo. https://crbug.com/713763. | 299 // TODO(rockot): Pass GUIDs through Mojo. https://crbug.com/713763. |
| 300 // TODO(erikchen): This fd comes from a mojo::ScopedHandle in | 300 // TODO(rockot): This fd comes from a mojo::ScopedHandle in |
| 301 // GpuArcVideoService::BindSharedMemory. That should be passed through, | 301 // GpuArcVideoService::BindSharedMemory. That should be passed through, |
| 302 // rather than pulling out the fd. https://crbug.com/713763. | 302 // rather than pulling out the fd. https://crbug.com/713763. |
| 303 // TODO(rockot): Pass through a real size rather than |0|.. |
| 303 base::UnguessableToken guid = base::UnguessableToken::Create(); | 304 base::UnguessableToken guid = base::UnguessableToken::Create(); |
| 304 vda_->Decode(media::BitstreamBuffer( | 305 vda_->Decode(media::BitstreamBuffer( |
| 305 bitstream_buffer_id, | 306 bitstream_buffer_id, |
| 306 base::SharedMemoryHandle(base::FileDescriptor(dup_fd, true), guid), | 307 base::SharedMemoryHandle(base::FileDescriptor(dup_fd, true), 0u, |
| 308 guid), |
| 307 metadata.bytes_used, input_info->offset)); | 309 metadata.bytes_used, input_info->offset)); |
| 308 break; | 310 break; |
| 309 } | 311 } |
| 310 case PORT_OUTPUT: { | 312 case PORT_OUTPUT: { |
| 311 // is_valid() is true for the first time the buffer is passed to the VDA. | 313 // is_valid() is true for the first time the buffer is passed to the VDA. |
| 312 // In that case, VDA needs to import the buffer first. | 314 // In that case, VDA needs to import the buffer first. |
| 313 OutputBufferInfo& info = buffers_pending_import_[index]; | 315 OutputBufferInfo& info = buffers_pending_import_[index]; |
| 314 if (info.handle.is_valid()) { | 316 if (info.handle.is_valid()) { |
| 315 gfx::GpuMemoryBufferHandle handle; | 317 gfx::GpuMemoryBufferHandle handle; |
| 316 #if defined(USE_OZONE) | 318 #if defined(USE_OZONE) |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 } | 531 } |
| 530 return true; | 532 return true; |
| 531 default: | 533 default: |
| 532 DLOG(ERROR) << "Invalid port: " << port; | 534 DLOG(ERROR) << "Invalid port: " << port; |
| 533 return false; | 535 return false; |
| 534 } | 536 } |
| 535 } | 537 } |
| 536 | 538 |
| 537 } // namespace arc | 539 } // namespace arc |
| 538 } // namespace chromeos | 540 } // namespace chromeos |
| OLD | NEW |