| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // integer. | 289 // integer. |
| 290 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; | 290 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; |
| 291 int dup_fd = HANDLE_EINTR(dup(input_info->handle.get())); | 291 int dup_fd = HANDLE_EINTR(dup(input_info->handle.get())); |
| 292 if (dup_fd < 0) { | 292 if (dup_fd < 0) { |
| 293 DLOG(ERROR) << "dup() failed."; | 293 DLOG(ERROR) << "dup() failed."; |
| 294 arc_client_->OnError(PLATFORM_FAILURE); | 294 arc_client_->OnError(PLATFORM_FAILURE); |
| 295 return; | 295 return; |
| 296 } | 296 } |
| 297 CreateInputRecord(bitstream_buffer_id, index, metadata.timestamp); | 297 CreateInputRecord(bitstream_buffer_id, index, metadata.timestamp); |
| 298 vda_->Decode(media::BitstreamBuffer( | 298 vda_->Decode(media::BitstreamBuffer( |
| 299 bitstream_buffer_id, base::SharedMemoryHandle(dup_fd, true), | 299 bitstream_buffer_id, |
| 300 base::SharedMemoryHandle(base::FileDescriptor(dup_fd, true)), |
| 300 metadata.bytes_used, input_info->offset)); | 301 metadata.bytes_used, input_info->offset)); |
| 301 break; | 302 break; |
| 302 } | 303 } |
| 303 case PORT_OUTPUT: { | 304 case PORT_OUTPUT: { |
| 304 // is_valid() is true for the first time the buffer is passed to the VDA. | 305 // is_valid() is true for the first time the buffer is passed to the VDA. |
| 305 // In that case, VDA needs to import the buffer first. | 306 // In that case, VDA needs to import the buffer first. |
| 306 OutputBufferInfo& info = buffers_pending_import_[index]; | 307 OutputBufferInfo& info = buffers_pending_import_[index]; |
| 307 if (info.handle.is_valid()) { | 308 if (info.handle.is_valid()) { |
| 308 gfx::GpuMemoryBufferHandle handle; | 309 gfx::GpuMemoryBufferHandle handle; |
| 309 #if defined(USE_OZONE) | 310 #if defined(USE_OZONE) |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 } | 523 } |
| 523 return true; | 524 return true; |
| 524 default: | 525 default: |
| 525 DLOG(ERROR) << "Invalid port: " << port; | 526 DLOG(ERROR) << "Invalid port: " << port; |
| 526 return false; | 527 return false; |
| 527 } | 528 } |
| 528 } | 529 } |
| 529 | 530 |
| 530 } // namespace arc | 531 } // namespace arc |
| 531 } // namespace chromeos | 532 } // namespace chromeos |
| OLD | NEW |