| 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/numerics/safe_math.h" | 10 #include "base/numerics/safe_math.h" |
| 10 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 11 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
| 12 #include "media/gpu/gpu_video_decode_accelerator_factory.h" | 13 #include "media/gpu/gpu_video_decode_accelerator_factory.h" |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace chromeos { |
| 15 namespace arc { | 16 namespace arc { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ArcGpuVideoDecodeAccelerator::~ArcGpuVideoDecodeAccelerator() { | 64 ArcGpuVideoDecodeAccelerator::~ArcGpuVideoDecodeAccelerator() { |
| 64 DCHECK(thread_checker_.CalledOnValidThread()); | 65 DCHECK(thread_checker_.CalledOnValidThread()); |
| 65 if (vda_) { | 66 if (vda_) { |
| 66 client_count_--; | 67 client_count_--; |
| 67 } | 68 } |
| 68 } | 69 } |
| 69 | 70 |
| 70 ArcVideoAccelerator::Result ArcGpuVideoDecodeAccelerator::Initialize( | 71 ArcVideoAccelerator::Result ArcGpuVideoDecodeAccelerator::Initialize( |
| 71 const Config& config, | 72 const Config& config, |
| 72 ArcVideoAccelerator::Client* client) { | 73 ArcVideoAccelerator::Client* client) { |
| 74 auto result = InitializeTask(config, client); |
| 75 // Report initialization status to UMA. |
| 76 UMA_HISTOGRAM_ENUMERATION( |
| 77 "Media.ArcGpuVideoDecodeAccelerator.InitializeResult", result, |
| 78 RESULT_MAX); |
| 79 return result; |
| 80 } |
| 81 |
| 82 ArcVideoAccelerator::Result ArcGpuVideoDecodeAccelerator::InitializeTask( |
| 83 const Config& config, |
| 84 ArcVideoAccelerator::Client* client) { |
| 73 DVLOG(5) << "Initialize(device=" << config.device_type | 85 DVLOG(5) << "Initialize(device=" << config.device_type |
| 74 << ", input_pixel_format=" << config.input_pixel_format | 86 << ", input_pixel_format=" << config.input_pixel_format |
| 75 << ", num_input_buffers=" << config.num_input_buffers << ")"; | 87 << ", num_input_buffers=" << config.num_input_buffers << ")"; |
| 76 DCHECK(thread_checker_.CalledOnValidThread()); | 88 DCHECK(thread_checker_.CalledOnValidThread()); |
| 77 if (config.device_type != Config::DEVICE_DECODER) | 89 if (config.device_type != Config::DEVICE_DECODER) |
| 78 return INVALID_ARGUMENT; | 90 return INVALID_ARGUMENT; |
| 79 DCHECK(client); | 91 DCHECK(client); |
| 80 | 92 |
| 81 if (arc_client_) { | 93 if (arc_client_) { |
| 82 DLOG(ERROR) << "Re-Initialize() is not allowed"; | 94 DLOG(ERROR) << "Re-Initialize() is not allowed"; |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 } | 521 } |
| 510 return true; | 522 return true; |
| 511 default: | 523 default: |
| 512 DLOG(ERROR) << "Invalid port: " << port; | 524 DLOG(ERROR) << "Invalid port: " << port; |
| 513 return false; | 525 return false; |
| 514 } | 526 } |
| 515 } | 527 } |
| 516 | 528 |
| 517 } // namespace arc | 529 } // namespace arc |
| 518 } // namespace chromeos | 530 } // namespace chromeos |
| OLD | NEW |