| 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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 // occurred. This guarantees that somebody finds out about the error. If | 697 // occurred. This guarantees that somebody finds out about the error. If |
| 698 // we don't do this, and if the max decodes are already in flight, then there | 698 // we don't do this, and if the max decodes are already in flight, then there |
| 699 // won't be another decode request to report the error. | 699 // won't be another decode request to report the error. |
| 700 if (!bitstream_buffers_in_decoder_.empty()) { | 700 if (!bitstream_buffers_in_decoder_.empty()) { |
| 701 auto it = bitstream_buffers_in_decoder_.begin(); | 701 auto it = bitstream_buffers_in_decoder_.begin(); |
| 702 it->second.done_cb.Run(kDecodeError); | 702 it->second.done_cb.Run(kDecodeError); |
| 703 bitstream_buffers_in_decoder_.erase(it); | 703 bitstream_buffers_in_decoder_.erase(it); |
| 704 } | 704 } |
| 705 | 705 |
| 706 DLOG(ERROR) << "VDA Error: " << error; | 706 DLOG(ERROR) << "VDA Error: " << error; |
| 707 UMA_HISTOGRAM_ENUMERATION("Media.GpuVideoDecoderError", error, |
| 708 media::VideoDecodeAccelerator::ERROR_MAX + 1); |
| 709 |
| 707 DestroyVDA(); | 710 DestroyVDA(); |
| 708 } | 711 } |
| 709 | 712 |
| 710 bool GpuVideoDecoder::IsProfileSupported( | 713 bool GpuVideoDecoder::IsProfileSupported( |
| 711 const VideoDecodeAccelerator::Capabilities& capabilities, | 714 const VideoDecodeAccelerator::Capabilities& capabilities, |
| 712 VideoCodecProfile profile, | 715 VideoCodecProfile profile, |
| 713 const gfx::Size& coded_size, | 716 const gfx::Size& coded_size, |
| 714 bool is_encrypted) { | 717 bool is_encrypted) { |
| 715 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 718 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| 716 for (const auto& supported_profile : capabilities.supported_profiles) { | 719 for (const auto& supported_profile : capabilities.supported_profiles) { |
| 717 if (profile == supported_profile.profile) { | 720 if (profile == supported_profile.profile) { |
| 718 if (supported_profile.encrypted_only && !is_encrypted) | 721 if (supported_profile.encrypted_only && !is_encrypted) |
| 719 continue; | 722 continue; |
| 720 | 723 |
| 721 return IsCodedSizeSupported(coded_size, | 724 return IsCodedSizeSupported(coded_size, |
| 722 supported_profile.min_resolution, | 725 supported_profile.min_resolution, |
| 723 supported_profile.max_resolution); | 726 supported_profile.max_resolution); |
| 724 } | 727 } |
| 725 } | 728 } |
| 726 return false; | 729 return false; |
| 727 } | 730 } |
| 728 | 731 |
| 729 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 732 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 730 const { | 733 const { |
| 731 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 734 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 732 } | 735 } |
| 733 | 736 |
| 734 } // namespace media | 737 } // namespace media |
| OLD | NEW |