| 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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 const media::BitstreamBuffer& bitstream_buffer) { | 779 const media::BitstreamBuffer& bitstream_buffer) { |
| 780 pending_bitstream_buffers_.push( | 780 pending_bitstream_buffers_.push( |
| 781 std::make_pair(bitstream_buffer, base::Time::Now())); | 781 std::make_pair(bitstream_buffer, base::Time::Now())); |
| 782 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", | 782 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", |
| 783 pending_bitstream_buffers_.size()); | 783 pending_bitstream_buffers_.size()); |
| 784 | 784 |
| 785 DoIOTask(true); | 785 DoIOTask(true); |
| 786 } | 786 } |
| 787 | 787 |
| 788 void AndroidVideoDecodeAccelerator::RequestPictureBuffers() { | 788 void AndroidVideoDecodeAccelerator::RequestPictureBuffers() { |
| 789 client_->ProvidePictureBuffers(kNumPictureBuffers, | 789 client_->ProvidePictureBuffers(kNumPictureBuffers, 1, |
| 790 strategy_->GetPictureBufferSize(), | 790 strategy_->GetPictureBufferSize(), |
| 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 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 const media::PictureBuffer& picture_buffer) { | 1031 const media::PictureBuffer& picture_buffer) { |
| 1032 RETURN_ON_FAILURE(this, gl_decoder_, "Null gl_decoder_", ILLEGAL_STATE, | 1032 RETURN_ON_FAILURE(this, gl_decoder_, "Null gl_decoder_", ILLEGAL_STATE, |
| 1033 nullptr); | 1033 nullptr); |
| 1034 RETURN_ON_FAILURE(this, gl_decoder_->GetContextGroup(), | 1034 RETURN_ON_FAILURE(this, gl_decoder_->GetContextGroup(), |
| 1035 "Null gl_decoder_->GetContextGroup()", ILLEGAL_STATE, | 1035 "Null gl_decoder_->GetContextGroup()", ILLEGAL_STATE, |
| 1036 nullptr); | 1036 nullptr); |
| 1037 gpu::gles2::TextureManager* texture_manager = | 1037 gpu::gles2::TextureManager* texture_manager = |
| 1038 gl_decoder_->GetContextGroup()->texture_manager(); | 1038 gl_decoder_->GetContextGroup()->texture_manager(); |
| 1039 RETURN_ON_FAILURE(this, texture_manager, "Null texture_manager", | 1039 RETURN_ON_FAILURE(this, texture_manager, "Null texture_manager", |
| 1040 ILLEGAL_STATE, nullptr); | 1040 ILLEGAL_STATE, nullptr); |
| 1041 |
| 1042 DCHECK_LE(1u, picture_buffer.internal_texture_ids().size()); |
| 1041 gpu::gles2::TextureRef* texture_ref = | 1043 gpu::gles2::TextureRef* texture_ref = |
| 1042 texture_manager->GetTexture(picture_buffer.internal_texture_id()); | 1044 texture_manager->GetTexture(picture_buffer.internal_texture_ids()[0]); |
| 1043 RETURN_ON_FAILURE(this, texture_manager, "Null texture_ref", ILLEGAL_STATE, | 1045 RETURN_ON_FAILURE(this, texture_manager, "Null texture_ref", ILLEGAL_STATE, |
| 1044 nullptr); | 1046 nullptr); |
| 1045 | 1047 |
| 1046 return texture_ref; | 1048 return texture_ref; |
| 1047 } | 1049 } |
| 1048 | 1050 |
| 1049 void AndroidVideoDecodeAccelerator::OnFrameAvailable() { | 1051 void AndroidVideoDecodeAccelerator::OnFrameAvailable() { |
| 1050 // Remember: this may be on any thread. | 1052 // Remember: this may be on any thread. |
| 1051 DCHECK(strategy_); | 1053 DCHECK(strategy_); |
| 1052 strategy_->OnFrameAvailable(); | 1054 strategy_->OnFrameAvailable(); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1214 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 1213 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1215 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | |
| 1214 media::VideoDecodeAccelerator::Capabilities:: | 1216 media::VideoDecodeAccelerator::Capabilities:: |
| 1215 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1217 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1216 } | 1218 } |
| 1217 | 1219 |
| 1218 return capabilities; | 1220 return capabilities; |
| 1219 } | 1221 } |
| 1220 | 1222 |
| 1221 } // namespace content | 1223 } // namespace content |
| OLD | NEW |