| 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 "media/gpu/android/media_codec_video_decoder.h" | 5 #include "media/gpu/android/media_codec_video_decoder.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/base/android/media_codec_bridge_impl.h" | 8 #include "media/base/android/media_codec_bridge_impl.h" |
| 9 #include "media/base/android/media_codec_util.h" | 9 #include "media/base/android/media_codec_util.h" |
| 10 #include "media/base/video_codecs.h" | 10 #include "media/base/video_codecs.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 bool ConfigSupported(const VideoDecoderConfig& config) { | 23 bool ConfigSupported(const VideoDecoderConfig& config) { |
| 24 // Don't support larger than 4k because it won't perform well on many devices. | 24 // Don't support larger than 4k because it won't perform well on many devices. |
| 25 const auto size = config.coded_size(); | 25 const auto size = config.coded_size(); |
| 26 if (size.width() > 3840 || size.height() > 2160) | 26 if (size.width() > 3840 || size.height() > 2160) |
| 27 return false; | 27 return false; |
| 28 | 28 |
| 29 // Only use MediaCodec for VP8 or VP9 if it's likely backed by hardware or if | 29 // Only use MediaCodec for VP8 or VP9 if it's likely backed by hardware or if |
| 30 // the stream is encrypted. | 30 // the stream is encrypted. |
| 31 const auto codec = config.codec(); | 31 const auto codec = config.codec(); |
| 32 if (IsMediaCodecSoftwareDecodingForbidden(config) && | 32 if (IsMediaCodecSoftwareDecodingForbidden(config) && |
| 33 VideoCodecBridge::IsKnownUnaccelerated(codec, MEDIA_CODEC_DECODER)) { | 33 MediaCodecUtil::IsKnownUnaccelerated(codec, |
| 34 MediaCodecDirection::DECODER)) { |
| 34 DVLOG(1) << "Config not supported: " << GetCodecName(codec) | 35 DVLOG(1) << "Config not supported: " << GetCodecName(codec) |
| 35 << " is not hardware accelerated"; | 36 << " is not hardware accelerated"; |
| 36 return false; | 37 return false; |
| 37 } | 38 } |
| 38 | 39 |
| 39 switch (codec) { | 40 switch (codec) { |
| 40 case kCodecVP8: | 41 case kCodecVP8: |
| 41 case kCodecVP9: { | 42 case kCodecVP9: { |
| 42 if ((codec == kCodecVP8 && !MediaCodecUtil::IsVp8DecoderAvailable()) || | 43 if ((codec == kCodecVP8 && !MediaCodecUtil::IsVp8DecoderAvailable()) || |
| 43 (codec == kCodecVP9 && !MediaCodecUtil::IsVp9DecoderAvailable())) { | 44 (codec == kCodecVP9 && !MediaCodecUtil::IsVp9DecoderAvailable())) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 bool MediaCodecVideoDecoder::CanReadWithoutStalling() const { | 102 bool MediaCodecVideoDecoder::CanReadWithoutStalling() const { |
| 102 NOTIMPLEMENTED(); | 103 NOTIMPLEMENTED(); |
| 103 return false; | 104 return false; |
| 104 } | 105 } |
| 105 | 106 |
| 106 int MediaCodecVideoDecoder::GetMaxDecodeRequests() const { | 107 int MediaCodecVideoDecoder::GetMaxDecodeRequests() const { |
| 107 return 4; | 108 return 4; |
| 108 } | 109 } |
| 109 | 110 |
| 110 } // namespace media | 111 } // namespace media |
| OLD | NEW |