| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_video_decode_accelerator.h" | 5 #include "media/gpu/android_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 constexpr base::TimeDelta IdleTimerTimeOut = base::TimeDelta::FromSeconds(1); | 107 constexpr base::TimeDelta IdleTimerTimeOut = base::TimeDelta::FromSeconds(1); |
| 108 | 108 |
| 109 // On low end devices (< KitKat is always low-end due to buggy MediaCodec), | 109 // On low end devices (< KitKat is always low-end due to buggy MediaCodec), |
| 110 // defer the surface creation until the codec is actually used if we know no | 110 // defer the surface creation until the codec is actually used if we know no |
| 111 // software fallback exists. | 111 // software fallback exists. |
| 112 bool ShouldDeferSurfaceCreation(AVDACodecAllocator* codec_allocator, | 112 bool ShouldDeferSurfaceCreation(AVDACodecAllocator* codec_allocator, |
| 113 int surface_id, | 113 int surface_id, |
| 114 VideoCodec codec) { | 114 VideoCodec codec) { |
| 115 return surface_id == SurfaceManager::kNoSurfaceID && codec == kCodecH264 && | 115 return surface_id == SurfaceManager::kNoSurfaceID && codec == kCodecH264 && |
| 116 codec_allocator->IsAnyRegisteredAVDA() && | 116 codec_allocator->IsAnyRegisteredAVDA() && |
| 117 (base::android::BuildInfo::GetInstance()->sdk_int() <= 18 || | 117 base::android::BuildInfo::GetInstance()->sdk_int() <= 18; |
| 118 base::SysInfo::IsLowEndDevice()); | |
| 119 } | 118 } |
| 120 | 119 |
| 121 } // namespace | 120 } // namespace |
| 122 | 121 |
| 123 // AVDAManager manages shared resources for a number of AVDA instances. | 122 // AVDAManager manages shared resources for a number of AVDA instances. |
| 124 // Its responsibilities include: | 123 // Its responsibilities include: |
| 125 // - Starting and stopping a shared "construction" thread for instantiating and | 124 // - Starting and stopping a shared "construction" thread for instantiating and |
| 126 // releasing MediaCodecs. | 125 // releasing MediaCodecs. |
| 127 // - Detecting when a task has hung on the construction thread so AVDAs can | 126 // - Detecting when a task has hung on the construction thread so AVDAs can |
| 128 // stop using it. | 127 // stop using it. |
| (...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 if (!media_codec_) | 1628 if (!media_codec_) |
| 1630 return; | 1629 return; |
| 1631 | 1630 |
| 1632 picture_buffer_manager_.CodecChanged(nullptr); | 1631 picture_buffer_manager_.CodecChanged(nullptr); |
| 1633 codec_allocator_->ReleaseMediaCodec(std::move(media_codec_), | 1632 codec_allocator_->ReleaseMediaCodec(std::move(media_codec_), |
| 1634 codec_config_->task_type, | 1633 codec_config_->task_type, |
| 1635 codec_config_->surface_bundle); | 1634 codec_config_->surface_bundle); |
| 1636 } | 1635 } |
| 1637 | 1636 |
| 1638 } // namespace media | 1637 } // namespace media |
| OLD | NEW |