| 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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 const media::BitstreamBuffer& bitstream_buffer) { | 784 const media::BitstreamBuffer& bitstream_buffer) { |
| 785 pending_bitstream_buffers_.push( | 785 pending_bitstream_buffers_.push( |
| 786 std::make_pair(bitstream_buffer, base::Time::Now())); | 786 std::make_pair(bitstream_buffer, base::Time::Now())); |
| 787 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", | 787 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", |
| 788 pending_bitstream_buffers_.size()); | 788 pending_bitstream_buffers_.size()); |
| 789 | 789 |
| 790 DoIOTask(); | 790 DoIOTask(); |
| 791 } | 791 } |
| 792 | 792 |
| 793 void AndroidVideoDecodeAccelerator::RequestPictureBuffers() { | 793 void AndroidVideoDecodeAccelerator::RequestPictureBuffers() { |
| 794 client_->ProvidePictureBuffers(kNumPictureBuffers, size_, | 794 client_->ProvidePictureBuffers(kNumPictureBuffers, 1, size_, |
| 795 strategy_->GetTextureTarget()); | 795 strategy_->GetTextureTarget()); |
| 796 } | 796 } |
| 797 | 797 |
| 798 void AndroidVideoDecodeAccelerator::AssignPictureBuffers( | 798 void AndroidVideoDecodeAccelerator::AssignPictureBuffers( |
| 799 const std::vector<media::PictureBuffer>& buffers) { | 799 const std::vector<media::PictureBuffer>& buffers) { |
| 800 DCHECK(thread_checker_.CalledOnValidThread()); | 800 DCHECK(thread_checker_.CalledOnValidThread()); |
| 801 DCHECK(output_picture_buffers_.empty()); | 801 DCHECK(output_picture_buffers_.empty()); |
| 802 DCHECK(free_picture_ids_.empty()); | 802 DCHECK(free_picture_ids_.empty()); |
| 803 | 803 |
| 804 if (buffers.size() < kNumPictureBuffers) { | 804 if (buffers.size() < kNumPictureBuffers) { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 RETURN_ON_FAILURE(this, gl_decoder_, "Null gl_decoder_", ILLEGAL_STATE, | 1039 RETURN_ON_FAILURE(this, gl_decoder_, "Null gl_decoder_", ILLEGAL_STATE, |
| 1040 nullptr); | 1040 nullptr); |
| 1041 RETURN_ON_FAILURE(this, gl_decoder_->GetContextGroup(), | 1041 RETURN_ON_FAILURE(this, gl_decoder_->GetContextGroup(), |
| 1042 "Null gl_decoder_->GetContextGroup()", ILLEGAL_STATE, | 1042 "Null gl_decoder_->GetContextGroup()", ILLEGAL_STATE, |
| 1043 nullptr); | 1043 nullptr); |
| 1044 gpu::gles2::TextureManager* texture_manager = | 1044 gpu::gles2::TextureManager* texture_manager = |
| 1045 gl_decoder_->GetContextGroup()->texture_manager(); | 1045 gl_decoder_->GetContextGroup()->texture_manager(); |
| 1046 RETURN_ON_FAILURE(this, texture_manager, "Null texture_manager", | 1046 RETURN_ON_FAILURE(this, texture_manager, "Null texture_manager", |
| 1047 ILLEGAL_STATE, nullptr); | 1047 ILLEGAL_STATE, nullptr); |
| 1048 gpu::gles2::TextureRef* texture_ref = | 1048 gpu::gles2::TextureRef* texture_ref = |
| 1049 texture_manager->GetTexture(picture_buffer.internal_texture_id()); | 1049 texture_manager->GetTexture(picture_buffer.internal_texture_ids().ids[0]); |
| 1050 RETURN_ON_FAILURE(this, texture_manager, "Null texture_ref", ILLEGAL_STATE, | 1050 RETURN_ON_FAILURE(this, texture_manager, "Null texture_ref", ILLEGAL_STATE, |
| 1051 nullptr); | 1051 nullptr); |
| 1052 | 1052 |
| 1053 return texture_ref; | 1053 return texture_ref; |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 void AndroidVideoDecodeAccelerator::OnFrameAvailable() { | 1056 void AndroidVideoDecodeAccelerator::OnFrameAvailable() { |
| 1057 // Remember: this may be on any thread. | 1057 // Remember: this may be on any thread. |
| 1058 DCHECK(strategy_); | 1058 DCHECK(strategy_); |
| 1059 strategy_->OnFrameAvailable(); | 1059 strategy_->OnFrameAvailable(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1200 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 1201 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1201 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | |
| 1202 media::VideoDecodeAccelerator::Capabilities:: | 1202 media::VideoDecodeAccelerator::Capabilities:: |
| 1203 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1203 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1204 } | 1204 } |
| 1205 | 1205 |
| 1206 return capabilities; | 1206 return capabilities; |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 } // namespace content | 1209 } // namespace content |
| OLD | NEW |