| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // TODO(posciak): destroy and create a new VDA on codec/profile change | 161 // TODO(posciak): destroy and create a new VDA on codec/profile change |
| 162 // (http://crbug.com/260224). | 162 // (http://crbug.com/260224). |
| 163 if (previously_initialized && (config_.profile() != config.profile())) { | 163 if (previously_initialized && (config_.profile() != config.profile())) { |
| 164 DVLOG(1) << "Codec or profile changed, cannot reinitialize."; | 164 DVLOG(1) << "Codec or profile changed, cannot reinitialize."; |
| 165 bound_init_cb.Run(false); | 165 bound_init_cb.Run(false); |
| 166 return; | 166 return; |
| 167 } | 167 } |
| 168 | 168 |
| 169 VideoDecodeAccelerator::Capabilities capabilities = | 169 VideoDecodeAccelerator::Capabilities capabilities = |
| 170 factories_->GetVideoDecodeAcceleratorCapabilities(); | 170 factories_->GetVideoDecodeAcceleratorCapabilities(); |
| 171 if (!IsProfileSupported(capabilities, config.profile(), | 171 if (!IsProfileSupported(capabilities, config.profile(), config.coded_size(), |
| 172 config.coded_size())) { | 172 config.is_encrypted())) { |
| 173 DVLOG(1) << "Profile " << config.profile() << " or coded size " | 173 DVLOG(1) << "Unsupported profile " << config.profile() |
| 174 << config.coded_size().ToString() << " not supported."; | 174 << ", unsupported coded size " << config.coded_size().ToString() |
| 175 << ", or accelerator should only be used for encrypted content. " |
| 176 << " is_encrypted: " << (config.is_encrypted() ? "yes." : "no."); |
| 175 bound_init_cb.Run(false); | 177 bound_init_cb.Run(false); |
| 176 return; | 178 return; |
| 177 } | 179 } |
| 178 | 180 |
| 179 config_ = config; | 181 config_ = config; |
| 180 needs_all_picture_buffers_to_decode_ = | 182 needs_all_picture_buffers_to_decode_ = |
| 181 capabilities.flags & | 183 capabilities.flags & |
| 182 VideoDecodeAccelerator::Capabilities::NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE; | 184 VideoDecodeAccelerator::Capabilities::NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE; |
| 183 needs_bitstream_conversion_ = (config.codec() == kCodecH264); | 185 needs_bitstream_conversion_ = (config.codec() == kCodecH264); |
| 184 output_cb_ = BindToCurrentLoop(output_cb); | 186 output_cb_ = BindToCurrentLoop(output_cb); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 bitstream_buffers_in_decoder_.erase(it); | 703 bitstream_buffers_in_decoder_.erase(it); |
| 702 } | 704 } |
| 703 | 705 |
| 704 DLOG(ERROR) << "VDA Error: " << error; | 706 DLOG(ERROR) << "VDA Error: " << error; |
| 705 DestroyVDA(); | 707 DestroyVDA(); |
| 706 } | 708 } |
| 707 | 709 |
| 708 bool GpuVideoDecoder::IsProfileSupported( | 710 bool GpuVideoDecoder::IsProfileSupported( |
| 709 const VideoDecodeAccelerator::Capabilities& capabilities, | 711 const VideoDecodeAccelerator::Capabilities& capabilities, |
| 710 VideoCodecProfile profile, | 712 VideoCodecProfile profile, |
| 711 const gfx::Size& coded_size) { | 713 const gfx::Size& coded_size, |
| 714 bool is_encrypted) { |
| 712 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 715 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| 713 for (const auto& supported_profile : capabilities.supported_profiles) { | 716 for (const auto& supported_profile : capabilities.supported_profiles) { |
| 714 if (profile == supported_profile.profile) { | 717 if (profile == supported_profile.profile) { |
| 718 if (supported_profile.encrypted_only && !is_encrypted) |
| 719 continue; |
| 720 |
| 715 return IsCodedSizeSupported(coded_size, | 721 return IsCodedSizeSupported(coded_size, |
| 716 supported_profile.min_resolution, | 722 supported_profile.min_resolution, |
| 717 supported_profile.max_resolution); | 723 supported_profile.max_resolution); |
| 718 } | 724 } |
| 719 } | 725 } |
| 720 return false; | 726 return false; |
| 721 } | 727 } |
| 722 | 728 |
| 723 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 729 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 724 const { | 730 const { |
| 725 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 731 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 726 } | 732 } |
| 727 | 733 |
| 728 } // namespace media | 734 } // namespace media |
| OLD | NEW |