OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |