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

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, 9 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } 831 }
832 832
833 void VTVideoDecodeAccelerator::AssignPictureBuffers( 833 void VTVideoDecodeAccelerator::AssignPictureBuffers(
834 const std::vector<media::PictureBuffer>& pictures) { 834 const std::vector<media::PictureBuffer>& pictures) {
835 DCHECK(gpu_thread_checker_.CalledOnValidThread()); 835 DCHECK(gpu_thread_checker_.CalledOnValidThread());
836 836
837 for (const media::PictureBuffer& picture : pictures) { 837 for (const media::PictureBuffer& picture : pictures) {
838 DCHECK(!picture_info_map_.count(picture.id())); 838 DCHECK(!picture_info_map_.count(picture.id()));
839 assigned_picture_ids_.insert(picture.id()); 839 assigned_picture_ids_.insert(picture.id());
840 available_picture_ids_.push_back(picture.id()); 840 available_picture_ids_.push_back(picture.id());
841 DCHECK_LE(1u, picture.internal_texture_ids().size());
842 DCHECK_LE(1u, picture.texture_ids().size());
841 picture_info_map_.insert(std::make_pair( 843 picture_info_map_.insert(std::make_pair(
842 picture.id(), 844 picture.id(),
843 make_scoped_ptr(new PictureInfo(picture.internal_texture_id(), 845 make_scoped_ptr(new PictureInfo(picture.internal_texture_ids()[0],
844 picture.texture_id())))); 846 picture.texture_ids()[0]))));
845 } 847 }
846 848
847 // Pictures are not marked as uncleared until after this method returns, and 849 // Pictures are not marked as uncleared until after this method returns, and
848 // they will be broken if they are used before that happens. So, schedule 850 // they will be broken if they are used before that happens. So, schedule
849 // future work after that happens. 851 // future work after that happens.
850 gpu_task_runner_->PostTask(FROM_HERE, base::Bind( 852 gpu_task_runner_->PostTask(FROM_HERE, base::Bind(
851 &VTVideoDecodeAccelerator::ProcessWorkQueues, weak_this_)); 853 &VTVideoDecodeAccelerator::ProcessWorkQueues, weak_this_));
852 } 854 }
853 855
854 void VTVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_id) { 856 void VTVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_id) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 // size passed to ProvidePictureBuffers() is meaningless. 993 // size passed to ProvidePictureBuffers() is meaningless.
992 if (picture_size_ != frame.coded_size) { 994 if (picture_size_ != frame.coded_size) {
993 // Dismiss current pictures. 995 // Dismiss current pictures.
994 for (int32_t picture_id : assigned_picture_ids_) 996 for (int32_t picture_id : assigned_picture_ids_)
995 client_->DismissPictureBuffer(picture_id); 997 client_->DismissPictureBuffer(picture_id);
996 assigned_picture_ids_.clear(); 998 assigned_picture_ids_.clear();
997 available_picture_ids_.clear(); 999 available_picture_ids_.clear();
998 1000
999 // Request new pictures. 1001 // Request new pictures.
1000 picture_size_ = frame.coded_size; 1002 picture_size_ = frame.coded_size;
1001 client_->ProvidePictureBuffers( 1003 client_->ProvidePictureBuffers(kNumPictureBuffers, 1, coded_size_,
1002 kNumPictureBuffers, coded_size_, GL_TEXTURE_RECTANGLE_ARB); 1004 GL_TEXTURE_RECTANGLE_ARB);
1003 return false; 1005 return false;
1004 } 1006 }
1005 if (!SendFrame(frame)) 1007 if (!SendFrame(frame))
1006 return false; 1008 return false;
1007 } 1009 }
1008 1010
1009 return true; 1011 return true;
1010 } 1012 }
1011 1013
1012 bool VTVideoDecodeAccelerator::SendFrame(const Frame& frame) { 1014 bool VTVideoDecodeAccelerator::SendFrame(const Frame& frame) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 SupportedProfile profile; 1132 SupportedProfile profile;
1131 profile.profile = supported_profile; 1133 profile.profile = supported_profile;
1132 profile.min_resolution.SetSize(16, 16); 1134 profile.min_resolution.SetSize(16, 16);
1133 profile.max_resolution.SetSize(4096, 2160); 1135 profile.max_resolution.SetSize(4096, 2160);
1134 profiles.push_back(profile); 1136 profiles.push_back(profile);
1135 } 1137 }
1136 return profiles; 1138 return profiles;
1137 } 1139 }
1138 1140
1139 } // namespace content 1141 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698