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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 717 |
718 return true; | 718 return true; |
719 } | 719 } |
720 | 720 |
721 bool AndroidVideoDecodeAccelerator::DequeueOutput() { | 721 bool AndroidVideoDecodeAccelerator::DequeueOutput() { |
722 DCHECK(thread_checker_.CalledOnValidThread()); | 722 DCHECK(thread_checker_.CalledOnValidThread()); |
723 TRACE_EVENT0("media", "AVDA::DequeueOutput"); | 723 TRACE_EVENT0("media", "AVDA::DequeueOutput"); |
724 base::AutoReset<bool> auto_reset(&defer_errors_, true); | 724 base::AutoReset<bool> auto_reset(&defer_errors_, true); |
725 if (state_ == ERROR || state_ == WAITING_FOR_CODEC) | 725 if (state_ == ERROR || state_ == WAITING_FOR_CODEC) |
726 return false; | 726 return false; |
727 if (picturebuffers_requested_ && output_picture_buffers_.empty()) | 727 // If we're draining for reset or destroy, then we don't need picture buffers |
| 728 // since we won't send any decoded frames anyway. There might not be any, |
| 729 // since the pipeline might not be sending them back and / or they don't |
| 730 // exist anymore. From the pipeline's point of view, for Destroy at least, |
| 731 // the VDA is already gone. |
| 732 if (picturebuffers_requested_ && output_picture_buffers_.empty() && |
| 733 !IsDrainingForResetOrDestroy()) { |
728 return false; | 734 return false; |
729 if (!output_picture_buffers_.empty() && free_picture_ids_.empty()) { | 735 } |
| 736 if (!output_picture_buffers_.empty() && free_picture_ids_.empty() && |
| 737 !IsDrainingForResetOrDestroy()) { |
730 // Don't have any picture buffer to send. Need to wait. | 738 // Don't have any picture buffer to send. Need to wait. |
731 return false; | 739 return false; |
732 } | 740 } |
733 | 741 |
734 bool eos = false; | 742 bool eos = false; |
735 base::TimeDelta presentation_timestamp; | 743 base::TimeDelta presentation_timestamp; |
736 int32_t buf_index = 0; | 744 int32_t buf_index = 0; |
737 do { | 745 do { |
738 size_t offset = 0; | 746 size_t offset = 0; |
739 size_t size = 0; | 747 size_t size = 0; |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 | 1646 |
1639 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() | 1647 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() |
1640 const { | 1648 const { |
1641 // Prevent MediaCodec from using its internal software decoders when we have | 1649 // Prevent MediaCodec from using its internal software decoders when we have |
1642 // more secure and up to date versions in the renderer process. | 1650 // more secure and up to date versions in the renderer process. |
1643 return !config_.is_encrypted && (codec_config_->codec_ == kCodecVP8 || | 1651 return !config_.is_encrypted && (codec_config_->codec_ == kCodecVP8 || |
1644 codec_config_->codec_ == kCodecVP9); | 1652 codec_config_->codec_ == kCodecVP9); |
1645 } | 1653 } |
1646 | 1654 |
1647 } // namespace media | 1655 } // namespace media |
OLD | NEW |