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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 const std::vector<media::PictureBuffer>& buffers) { | 801 const std::vector<media::PictureBuffer>& buffers) { |
802 DCHECK(thread_checker_.CalledOnValidThread()); | 802 DCHECK(thread_checker_.CalledOnValidThread()); |
803 DCHECK(output_picture_buffers_.empty()); | 803 DCHECK(output_picture_buffers_.empty()); |
804 DCHECK(free_picture_ids_.empty()); | 804 DCHECK(free_picture_ids_.empty()); |
805 | 805 |
806 if (buffers.size() < kNumPictureBuffers) { | 806 if (buffers.size() < kNumPictureBuffers) { |
807 POST_ERROR(INVALID_ARGUMENT, "Not enough picture buffers assigned."); | 807 POST_ERROR(INVALID_ARGUMENT, "Not enough picture buffers assigned."); |
808 return; | 808 return; |
809 } | 809 } |
810 | 810 |
| 811 bool have_context = make_context_current_.Run(); |
| 812 |
811 for (size_t i = 0; i < buffers.size(); ++i) { | 813 for (size_t i = 0; i < buffers.size(); ++i) { |
812 if (buffers[i].size() != size_) { | 814 if (buffers[i].size() != size_) { |
813 POST_ERROR(INVALID_ARGUMENT, | 815 POST_ERROR(INVALID_ARGUMENT, |
814 "Invalid picture buffer size assigned. Wanted " | 816 "Invalid picture buffer size assigned. Wanted " |
815 << size_.ToString() << ", but got " | 817 << size_.ToString() << ", but got " |
816 << buffers[i].size().ToString()); | 818 << buffers[i].size().ToString()); |
817 return; | 819 return; |
818 } | 820 } |
819 int32_t id = buffers[i].id(); | 821 int32_t id = buffers[i].id(); |
820 output_picture_buffers_.insert(std::make_pair(id, buffers[i])); | 822 output_picture_buffers_.insert(std::make_pair(id, buffers[i])); |
821 free_picture_ids_.push(id); | 823 free_picture_ids_.push(id); |
822 // Since the client might be re-using |picture_buffer_id| values, forget | 824 // Since the client might be re-using |picture_buffer_id| values, forget |
823 // about previously-dismissed IDs now. See ReusePictureBuffer() comment | 825 // about previously-dismissed IDs now. See ReusePictureBuffer() comment |
824 // about "zombies" for why we maintain this set in the first place. | 826 // about "zombies" for why we maintain this set in the first place. |
825 dismissed_picture_ids_.erase(id); | 827 dismissed_picture_ids_.erase(id); |
826 | 828 |
827 strategy_->AssignOnePictureBuffer(buffers[i]); | 829 strategy_->AssignOnePictureBuffer(buffers[i], have_context); |
828 } | 830 } |
829 TRACE_COUNTER1("media", "AVDA::FreePictureIds", free_picture_ids_.size()); | 831 TRACE_COUNTER1("media", "AVDA::FreePictureIds", free_picture_ids_.size()); |
830 | 832 |
831 DoIOTask(); | 833 DoIOTask(); |
832 } | 834 } |
833 | 835 |
834 void AndroidVideoDecodeAccelerator::ReusePictureBuffer( | 836 void AndroidVideoDecodeAccelerator::ReusePictureBuffer( |
835 int32_t picture_buffer_id) { | 837 int32_t picture_buffer_id) { |
836 DCHECK(thread_checker_.CalledOnValidThread()); | 838 DCHECK(thread_checker_.CalledOnValidThread()); |
837 | 839 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1204 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
1203 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1205 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | |
1204 media::VideoDecodeAccelerator::Capabilities:: | 1206 media::VideoDecodeAccelerator::Capabilities:: |
1205 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1207 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
1206 } | 1208 } |
1207 | 1209 |
1208 return capabilities; | 1210 return capabilities; |
1209 } | 1211 } |
1210 | 1212 |
1211 } // namespace content | 1213 } // namespace content |
OLD | NEW |