| 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 "content/common/gpu/media/android_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 const media::BitstreamBuffer& bitstream_buffer) { | 780 const media::BitstreamBuffer& bitstream_buffer) { |
| 781 pending_bitstream_buffers_.push( | 781 pending_bitstream_buffers_.push( |
| 782 std::make_pair(bitstream_buffer, base::Time::Now())); | 782 std::make_pair(bitstream_buffer, base::Time::Now())); |
| 783 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", | 783 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", |
| 784 pending_bitstream_buffers_.size()); | 784 pending_bitstream_buffers_.size()); |
| 785 | 785 |
| 786 DoIOTask(); | 786 DoIOTask(); |
| 787 } | 787 } |
| 788 | 788 |
| 789 void AndroidVideoDecodeAccelerator::RequestPictureBuffers() { | 789 void AndroidVideoDecodeAccelerator::RequestPictureBuffers() { |
| 790 client_->ProvidePictureBuffers(kNumPictureBuffers, size_, | 790 client_->ProvidePictureBuffers(kNumPictureBuffers, 1, size_, |
| 791 strategy_->GetTextureTarget()); | 791 strategy_->GetTextureTarget()); |
| 792 } | 792 } |
| 793 | 793 |
| 794 void AndroidVideoDecodeAccelerator::AssignPictureBuffers( | 794 void AndroidVideoDecodeAccelerator::AssignPictureBuffers( |
| 795 const std::vector<media::PictureBuffer>& buffers) { | 795 const std::vector<media::PictureBuffer>& buffers) { |
| 796 DCHECK(thread_checker_.CalledOnValidThread()); | 796 DCHECK(thread_checker_.CalledOnValidThread()); |
| 797 DCHECK(output_picture_buffers_.empty()); | 797 DCHECK(output_picture_buffers_.empty()); |
| 798 DCHECK(free_picture_ids_.empty()); | 798 DCHECK(free_picture_ids_.empty()); |
| 799 | 799 |
| 800 if (buffers.size() < kNumPictureBuffers) { | 800 if (buffers.size() < kNumPictureBuffers) { |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 const media::PictureBuffer& picture_buffer) { | 1034 const media::PictureBuffer& picture_buffer) { |
| 1035 RETURN_ON_FAILURE(this, gl_decoder_, "Null gl_decoder_", ILLEGAL_STATE, | 1035 RETURN_ON_FAILURE(this, gl_decoder_, "Null gl_decoder_", ILLEGAL_STATE, |
| 1036 nullptr); | 1036 nullptr); |
| 1037 RETURN_ON_FAILURE(this, gl_decoder_->GetContextGroup(), | 1037 RETURN_ON_FAILURE(this, gl_decoder_->GetContextGroup(), |
| 1038 "Null gl_decoder_->GetContextGroup()", ILLEGAL_STATE, | 1038 "Null gl_decoder_->GetContextGroup()", ILLEGAL_STATE, |
| 1039 nullptr); | 1039 nullptr); |
| 1040 gpu::gles2::TextureManager* texture_manager = | 1040 gpu::gles2::TextureManager* texture_manager = |
| 1041 gl_decoder_->GetContextGroup()->texture_manager(); | 1041 gl_decoder_->GetContextGroup()->texture_manager(); |
| 1042 RETURN_ON_FAILURE(this, texture_manager, "Null texture_manager", | 1042 RETURN_ON_FAILURE(this, texture_manager, "Null texture_manager", |
| 1043 ILLEGAL_STATE, nullptr); | 1043 ILLEGAL_STATE, nullptr); |
| 1044 |
| 1045 DCHECK_LE(1u, picture_buffer.internal_texture_ids().size()); |
| 1044 gpu::gles2::TextureRef* texture_ref = | 1046 gpu::gles2::TextureRef* texture_ref = |
| 1045 texture_manager->GetTexture(picture_buffer.internal_texture_id()); | 1047 texture_manager->GetTexture(picture_buffer.internal_texture_ids()[0]); |
| 1046 RETURN_ON_FAILURE(this, texture_manager, "Null texture_ref", ILLEGAL_STATE, | 1048 RETURN_ON_FAILURE(this, texture_manager, "Null texture_ref", ILLEGAL_STATE, |
| 1047 nullptr); | 1049 nullptr); |
| 1048 | 1050 |
| 1049 return texture_ref; | 1051 return texture_ref; |
| 1050 } | 1052 } |
| 1051 | 1053 |
| 1052 void AndroidVideoDecodeAccelerator::OnFrameAvailable() { | 1054 void AndroidVideoDecodeAccelerator::OnFrameAvailable() { |
| 1053 // Remember: this may be on any thread. | 1055 // Remember: this may be on any thread. |
| 1054 DCHECK(strategy_); | 1056 DCHECK(strategy_); |
| 1055 strategy_->OnFrameAvailable(); | 1057 strategy_->OnFrameAvailable(); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1215 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 1214 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1216 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | |
| 1215 media::VideoDecodeAccelerator::Capabilities:: | 1217 media::VideoDecodeAccelerator::Capabilities:: |
| 1216 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1218 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1217 } | 1219 } |
| 1218 | 1220 |
| 1219 return capabilities; | 1221 return capabilities; |
| 1220 } | 1222 } |
| 1221 | 1223 |
| 1222 } // namespace content | 1224 } // namespace content |
| OLD | NEW |