| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // the thread might already be started even if there are no avda instances. | 187 // the thread might already be started even if there are no avda instances. |
| 188 // Plus, sometimes we just fail to start the thread. | 188 // Plus, sometimes we just fail to start the thread. |
| 189 if (!construction_thread_.IsRunning()) { | 189 if (!construction_thread_.IsRunning()) { |
| 190 if (!construction_thread_.Start()) { | 190 if (!construction_thread_.Start()) { |
| 191 LOG(ERROR) << "Failed to start construction thread."; | 191 LOG(ERROR) << "Failed to start construction thread."; |
| 192 return false; | 192 return false; |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 thread_avda_instances_.insert(avda_instance); | 196 thread_avda_instances_.insert(avda_instance); |
| 197 UMA_HISTOGRAM_ENUMERATION("Media.AVDA.NumAVDAInstances", |
| 198 thread_avda_instances_.size(), |
| 199 31); // PRESUBMIT_IGNORE_UMA_MAX |
| 197 return true; | 200 return true; |
| 198 } | 201 } |
| 199 | 202 |
| 200 // |avda_instance| will no longer need the construction thread. Stop the | 203 // |avda_instance| will no longer need the construction thread. Stop the |
| 201 // thread if this is the last instance. | 204 // thread if this is the last instance. |
| 202 void StopThread(AndroidVideoDecodeAccelerator* avda_instance) { | 205 void StopThread(AndroidVideoDecodeAccelerator* avda_instance) { |
| 203 DCHECK(thread_checker_.CalledOnValidThread()); | 206 DCHECK(thread_checker_.CalledOnValidThread()); |
| 204 | 207 |
| 205 thread_avda_instances_.erase(avda_instance); | 208 thread_avda_instances_.erase(avda_instance); |
| 206 if (!thread_avda_instances_.empty()) | 209 if (!thread_avda_instances_.empty()) |
| (...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1772 | 1775 |
| 1773 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() | 1776 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() |
| 1774 const { | 1777 const { |
| 1775 // Prevent MediaCodec from using its internal software decoders when we have | 1778 // Prevent MediaCodec from using its internal software decoders when we have |
| 1776 // more secure and up to date versions in the renderer process. | 1779 // more secure and up to date versions in the renderer process. |
| 1777 return !config_.is_encrypted && (codec_config_->codec_ == media::kCodecVP8 || | 1780 return !config_.is_encrypted && (codec_config_->codec_ == media::kCodecVP8 || |
| 1778 codec_config_->codec_ == media::kCodecVP9); | 1781 codec_config_->codec_ == media::kCodecVP9); |
| 1779 } | 1782 } |
| 1780 | 1783 |
| 1781 } // namespace media | 1784 } // namespace media |
| OLD | NEW |