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

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

Issue 1706023003: Moving the validation of bitstream_buffer into VDA implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review Created 4 years, 10 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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 } 822 }
823 823
824 void VTVideoDecodeAccelerator::FlushDone(TaskType type) { 824 void VTVideoDecodeAccelerator::FlushDone(TaskType type) {
825 DCHECK(gpu_thread_checker_.CalledOnValidThread()); 825 DCHECK(gpu_thread_checker_.CalledOnValidThread());
826 task_queue_.push(Task(type)); 826 task_queue_.push(Task(type));
827 ProcessWorkQueues(); 827 ProcessWorkQueues();
828 } 828 }
829 829
830 void VTVideoDecodeAccelerator::Decode(const media::BitstreamBuffer& bitstream) { 830 void VTVideoDecodeAccelerator::Decode(const media::BitstreamBuffer& bitstream) {
831 DCHECK(gpu_thread_checker_.CalledOnValidThread()); 831 DCHECK(gpu_thread_checker_.CalledOnValidThread());
832 if (bitstream.id() < 0) {
833 DLOG(ERROR) << "Invalid bitstream, id: " << bitstream.id();
834 if (base::SharedMemory::IsHandleValid(bitstream.handle()))
835 base::SharedMemory::CloseHandle(bitstream.handle());
836 NotifyError(INVALID_ARGUMENT, SFT_INVALID_STREAM);
837 return;
838 }
832 DCHECK_EQ(0u, assigned_bitstream_ids_.count(bitstream.id())); 839 DCHECK_EQ(0u, assigned_bitstream_ids_.count(bitstream.id()));
833 assigned_bitstream_ids_.insert(bitstream.id()); 840 assigned_bitstream_ids_.insert(bitstream.id());
834 Frame* frame = new Frame(bitstream.id()); 841 Frame* frame = new Frame(bitstream.id());
835 pending_frames_[frame->bitstream_id] = make_linked_ptr(frame); 842 pending_frames_[frame->bitstream_id] = make_linked_ptr(frame);
836 decoder_thread_.task_runner()->PostTask( 843 decoder_thread_.task_runner()->PostTask(
837 FROM_HERE, base::Bind(&VTVideoDecodeAccelerator::DecodeTask, 844 FROM_HERE, base::Bind(&VTVideoDecodeAccelerator::DecodeTask,
838 base::Unretained(this), bitstream, frame)); 845 base::Unretained(this), bitstream, frame));
839 } 846 }
840 847
841 void VTVideoDecodeAccelerator::AssignPictureBuffers( 848 void VTVideoDecodeAccelerator::AssignPictureBuffers(
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 SupportedProfile profile; 1166 SupportedProfile profile;
1160 profile.profile = supported_profile; 1167 profile.profile = supported_profile;
1161 profile.min_resolution.SetSize(16, 16); 1168 profile.min_resolution.SetSize(16, 16);
1162 profile.max_resolution.SetSize(4096, 2160); 1169 profile.max_resolution.SetSize(4096, 2160);
1163 profiles.push_back(profile); 1170 profiles.push_back(profile);
1164 } 1171 }
1165 return profiles; 1172 return profiles;
1166 } 1173 }
1167 1174
1168 } // namespace content 1175 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698