Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: content/common/gpu/media/vt_video_decode_accelerator_mac.cc

Issue 1751323002: Allow multiple texture ids per picture buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <algorithm> 5 #include <algorithm>
6 6
7 #include <CoreVideo/CoreVideo.h> 7 #include <CoreVideo/CoreVideo.h>
8 #include <OpenGL/CGLIOSurface.h> 8 #include <OpenGL/CGLIOSurface.h>
9 #include <OpenGL/gl.h> 9 #include <OpenGL/gl.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 } 837 }
838 838
839 void VTVideoDecodeAccelerator::AssignPictureBuffers( 839 void VTVideoDecodeAccelerator::AssignPictureBuffers(
840 const std::vector<media::PictureBuffer>& pictures) { 840 const std::vector<media::PictureBuffer>& pictures) {
841 DCHECK(gpu_thread_checker_.CalledOnValidThread()); 841 DCHECK(gpu_thread_checker_.CalledOnValidThread());
842 842
843 for (const media::PictureBuffer& picture : pictures) { 843 for (const media::PictureBuffer& picture : pictures) {
844 DCHECK(!picture_info_map_.count(picture.id())); 844 DCHECK(!picture_info_map_.count(picture.id()));
845 assigned_picture_ids_.insert(picture.id()); 845 assigned_picture_ids_.insert(picture.id());
846 available_picture_ids_.push_back(picture.id()); 846 available_picture_ids_.push_back(picture.id());
847 DCHECK_LE(1u, picture.internal_texture_ids().size());
848 DCHECK_LE(1u, picture.texture_ids().size());
847 picture_info_map_.insert(std::make_pair( 849 picture_info_map_.insert(std::make_pair(
848 picture.id(), 850 picture.id(),
849 make_scoped_ptr(new PictureInfo(picture.internal_texture_id(), 851 make_scoped_ptr(new PictureInfo(picture.internal_texture_ids()[0],
850 picture.texture_id())))); 852 picture.texture_ids()[0]))));
851 } 853 }
852 854
853 // Pictures are not marked as uncleared until after this method returns, and 855 // Pictures are not marked as uncleared until after this method returns, and
854 // they will be broken if they are used before that happens. So, schedule 856 // they will be broken if they are used before that happens. So, schedule
855 // future work after that happens. 857 // future work after that happens.
856 gpu_task_runner_->PostTask(FROM_HERE, base::Bind( 858 gpu_task_runner_->PostTask(FROM_HERE, base::Bind(
857 &VTVideoDecodeAccelerator::ProcessWorkQueues, weak_this_)); 859 &VTVideoDecodeAccelerator::ProcessWorkQueues, weak_this_));
858 } 860 }
859 861
860 void VTVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_id) { 862 void VTVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_id) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 // size passed to ProvidePictureBuffers() is meaningless. 999 // size passed to ProvidePictureBuffers() is meaningless.
998 if (picture_size_ != frame.coded_size) { 1000 if (picture_size_ != frame.coded_size) {
999 // Dismiss current pictures. 1001 // Dismiss current pictures.
1000 for (int32_t picture_id : assigned_picture_ids_) 1002 for (int32_t picture_id : assigned_picture_ids_)
1001 client_->DismissPictureBuffer(picture_id); 1003 client_->DismissPictureBuffer(picture_id);
1002 assigned_picture_ids_.clear(); 1004 assigned_picture_ids_.clear();
1003 available_picture_ids_.clear(); 1005 available_picture_ids_.clear();
1004 1006
1005 // Request new pictures. 1007 // Request new pictures.
1006 picture_size_ = frame.coded_size; 1008 picture_size_ = frame.coded_size;
1007 client_->ProvidePictureBuffers( 1009 client_->ProvidePictureBuffers(kNumPictureBuffers, 1, coded_size_,
1008 kNumPictureBuffers, coded_size_, GL_TEXTURE_RECTANGLE_ARB); 1010 GL_TEXTURE_RECTANGLE_ARB);
1009 return false; 1011 return false;
1010 } 1012 }
1011 if (!SendFrame(frame)) 1013 if (!SendFrame(frame))
1012 return false; 1014 return false;
1013 } 1015 }
1014 1016
1015 return true; 1017 return true;
1016 } 1018 }
1017 1019
1018 bool VTVideoDecodeAccelerator::SendFrame(const Frame& frame) { 1020 bool VTVideoDecodeAccelerator::SendFrame(const Frame& frame) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 SupportedProfile profile; 1159 SupportedProfile profile;
1158 profile.profile = supported_profile; 1160 profile.profile = supported_profile;
1159 profile.min_resolution.SetSize(16, 16); 1161 profile.min_resolution.SetSize(16, 16);
1160 profile.max_resolution.SetSize(4096, 2160); 1162 profile.max_resolution.SetSize(4096, 2160);
1161 profiles.push_back(profile); 1163 profiles.push_back(profile);
1162 } 1164 }
1163 return profiles; 1165 return profiles;
1164 } 1166 }
1165 1167
1166 } // namespace content 1168 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/video_decode_accelerator_unittest.cc ('k') | content/renderer/media/rtc_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698