| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 thread_avda_instances_.erase(avda); | 253 thread_avda_instances_.erase(avda); |
| 254 // Post a task to stop the thread through the thread's task runner and back | 254 // Post a task to stop the thread through the thread's task runner and back |
| 255 // to this thread. This ensures that all pending tasks are run first. If the | 255 // to this thread. This ensures that all pending tasks are run first. If the |
| 256 // thread is hung we don't post a task to avoid leaking an unbounded number | 256 // thread is hung we don't post a task to avoid leaking an unbounded number |
| 257 // of tasks on its queue. If the thread is not hung, but appears to be, it | 257 // of tasks on its queue. If the thread is not hung, but appears to be, it |
| 258 // will stay alive until next time an AVDA tries to stop it. We're | 258 // will stay alive until next time an AVDA tries to stop it. We're |
| 259 // guaranteed to not run StopThreadTask() when the thread is hung because if | 259 // guaranteed to not run StopThreadTask() when the thread is hung because if |
| 260 // an AVDA queues tasks after DoNothing(), the StopThreadTask() reply will | 260 // an AVDA queues tasks after DoNothing(), the StopThreadTask() reply will |
| 261 // be canceled by invalidating its weak pointer. | 261 // be canceled by invalidating its weak pointer. |
| 262 if (thread_avda_instances_.empty() && | 262 if (thread_avda_instances_.empty() && construction_thread_.IsRunning() && |
| 263 !hang_detector_.IsThreadLikelyHung()) { | 263 !hang_detector_.IsThreadLikelyHung()) { |
| 264 construction_thread_.task_runner()->PostTaskAndReply( | 264 construction_thread_.task_runner()->PostTaskAndReply( |
| 265 FROM_HERE, base::Bind(&base::DoNothing), | 265 FROM_HERE, base::Bind(&base::DoNothing), |
| 266 base::Bind(&AVDAManager::StopThreadTask, | 266 base::Bind(&AVDAManager::StopThreadTask, |
| 267 weak_this_factory_.GetWeakPtr())); | 267 weak_this_factory_.GetWeakPtr())); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 // Request periodic callback of |avda|->DoIOTask(). Does nothing if the | 271 // Request periodic callback of |avda|->DoIOTask(). Does nothing if the |
| 272 // instance is already registered and the timer started. The first request | 272 // instance is already registered and the timer started. The first request |
| (...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1780 | 1780 |
| 1781 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() | 1781 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() |
| 1782 const { | 1782 const { |
| 1783 // Prevent MediaCodec from using its internal software decoders when we have | 1783 // Prevent MediaCodec from using its internal software decoders when we have |
| 1784 // more secure and up to date versions in the renderer process. | 1784 // more secure and up to date versions in the renderer process. |
| 1785 return !config_.is_encrypted && (codec_config_->codec_ == media::kCodecVP8 || | 1785 return !config_.is_encrypted && (codec_config_->codec_ == media::kCodecVP8 || |
| 1786 codec_config_->codec_ == media::kCodecVP9); | 1786 codec_config_->codec_ == media::kCodecVP9); |
| 1787 } | 1787 } |
| 1788 | 1788 |
| 1789 } // namespace media | 1789 } // namespace media |
| OLD | NEW |