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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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) { |
801 POST_ERROR(INVALID_ARGUMENT, "Not enough picture buffers assigned."); | 801 POST_ERROR(INVALID_ARGUMENT, "Not enough picture buffers assigned."); |
802 return; | 802 return; |
803 } | 803 } |
804 | 804 |
805 bool have_context = false; | |
DaleCurtis
2016/03/28 18:02:02
const bool have_context = make_context_current_.Ru
liberato (no reviews please)
2016/03/28 20:58:18
Done.
| |
806 if ((have_context = make_context_current_.Run()) == false) { | |
807 LOG(WARNING) << "Failed make GL context current for Assign, continuing."; | |
808 } | |
809 | |
805 for (size_t i = 0; i < buffers.size(); ++i) { | 810 for (size_t i = 0; i < buffers.size(); ++i) { |
806 if (buffers[i].size() != size_) { | 811 if (buffers[i].size() != size_) { |
807 POST_ERROR(INVALID_ARGUMENT, | 812 POST_ERROR(INVALID_ARGUMENT, |
808 "Invalid picture buffer size assigned. Wanted " | 813 "Invalid picture buffer size assigned. Wanted " |
809 << size_.ToString() << ", but got " | 814 << size_.ToString() << ", but got " |
810 << buffers[i].size().ToString()); | 815 << buffers[i].size().ToString()); |
811 return; | 816 return; |
812 } | 817 } |
813 int32_t id = buffers[i].id(); | 818 int32_t id = buffers[i].id(); |
814 output_picture_buffers_.insert(std::make_pair(id, buffers[i])); | 819 output_picture_buffers_.insert(std::make_pair(id, buffers[i])); |
815 free_picture_ids_.push(id); | 820 free_picture_ids_.push(id); |
816 // Since the client might be re-using |picture_buffer_id| values, forget | 821 // Since the client might be re-using |picture_buffer_id| values, forget |
817 // about previously-dismissed IDs now. See ReusePictureBuffer() comment | 822 // about previously-dismissed IDs now. See ReusePictureBuffer() comment |
818 // about "zombies" for why we maintain this set in the first place. | 823 // about "zombies" for why we maintain this set in the first place. |
819 dismissed_picture_ids_.erase(id); | 824 dismissed_picture_ids_.erase(id); |
820 | 825 |
821 strategy_->AssignOnePictureBuffer(buffers[i]); | 826 strategy_->AssignOnePictureBuffer(buffers[i], have_context); |
822 } | 827 } |
823 TRACE_COUNTER1("media", "AVDA::FreePictureIds", free_picture_ids_.size()); | 828 TRACE_COUNTER1("media", "AVDA::FreePictureIds", free_picture_ids_.size()); |
824 DoIOTask(true); | 829 DoIOTask(true); |
825 } | 830 } |
826 | 831 |
827 void AndroidVideoDecodeAccelerator::ReusePictureBuffer( | 832 void AndroidVideoDecodeAccelerator::ReusePictureBuffer( |
828 int32_t picture_buffer_id) { | 833 int32_t picture_buffer_id) { |
829 DCHECK(thread_checker_.CalledOnValidThread()); | 834 DCHECK(thread_checker_.CalledOnValidThread()); |
830 | 835 |
831 // This ReusePictureBuffer() might have been in a pipe somewhere (queued in | 836 // This ReusePictureBuffer() might have been in a pipe somewhere (queued in |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1208 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1213 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
1209 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1214 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | |
1210 media::VideoDecodeAccelerator::Capabilities:: | 1215 media::VideoDecodeAccelerator::Capabilities:: |
1211 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1216 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
1212 } | 1217 } |
1213 | 1218 |
1214 return capabilities; | 1219 return capabilities; |
1215 } | 1220 } |
1216 | 1221 |
1217 } // namespace content | 1222 } // namespace content |
OLD | NEW |