| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/filters/gpu_video_decoder.h" | 5 #include "media/filters/gpu_video_decoder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 280 |
| 281 // If we don't have to wait for a surface complete initialization with a null | 281 // If we don't have to wait for a surface complete initialization with a null |
| 282 // surface. | 282 // surface. |
| 283 CompleteInitialization(cdm_id, SurfaceManager::kNoSurfaceID); | 283 CompleteInitialization(cdm_id, SurfaceManager::kNoSurfaceID); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void GpuVideoDecoder::CompleteInitialization(int cdm_id, int surface_id) { | 286 void GpuVideoDecoder::CompleteInitialization(int cdm_id, int surface_id) { |
| 287 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 287 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| 288 DCHECK(!init_cb_.is_null()); | 288 DCHECK(!init_cb_.is_null()); |
| 289 | 289 |
| 290 // It's possible for the vda to become null if NotifyError is called. |
| 291 if (!vda_) { |
| 292 base::ResetAndReturn(&init_cb_).Run(false); |
| 293 return; |
| 294 } |
| 295 |
| 290 VideoDecodeAccelerator::Config vda_config; | 296 VideoDecodeAccelerator::Config vda_config; |
| 291 vda_config.profile = config_.profile(); | 297 vda_config.profile = config_.profile(); |
| 292 vda_config.cdm_id = cdm_id; | 298 vda_config.cdm_id = cdm_id; |
| 293 vda_config.is_encrypted = config_.is_encrypted(); | 299 vda_config.is_encrypted = config_.is_encrypted(); |
| 294 vda_config.surface_id = surface_id; | 300 vda_config.surface_id = surface_id; |
| 295 vda_config.is_deferred_initialization_allowed = true; | 301 vda_config.is_deferred_initialization_allowed = true; |
| 296 vda_config.initial_expected_coded_size = config_.coded_size(); | 302 vda_config.initial_expected_coded_size = config_.coded_size(); |
| 297 if (!vda_->Initialize(vda_config, this)) { | 303 if (!vda_->Initialize(vda_config, this)) { |
| 298 DVLOG(1) << "VDA::Initialize failed."; | 304 DVLOG(1) << "VDA::Initialize failed."; |
| 299 base::ResetAndReturn(&init_cb_).Run(false); | 305 base::ResetAndReturn(&init_cb_).Run(false); |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 } | 823 } |
| 818 return false; | 824 return false; |
| 819 } | 825 } |
| 820 | 826 |
| 821 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 827 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 822 const { | 828 const { |
| 823 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 829 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 824 } | 830 } |
| 825 | 831 |
| 826 } // namespace media | 832 } // namespace media |
| OLD | NEW |