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

Side by Side Diff: content/common/gpu/media/v4l2_jpeg_decode_accelerator.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: fix compiling errors on windows 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <errno.h> 5 #include <errno.h>
6 #include <linux/videodev2.h> 6 #include <linux/videodev2.h>
7 #include <string.h> 7 #include <string.h>
8 #include <sys/mman.h> 8 #include <sys/mman.h>
9 9
10 #include "base/big_endian.h" 10 #include "base/big_endian.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 return true; 226 return true;
227 } 227 }
228 228
229 void V4L2JpegDecodeAccelerator::Decode( 229 void V4L2JpegDecodeAccelerator::Decode(
230 const media::BitstreamBuffer& bitstream_buffer, 230 const media::BitstreamBuffer& bitstream_buffer,
231 const scoped_refptr<media::VideoFrame>& video_frame) { 231 const scoped_refptr<media::VideoFrame>& video_frame) {
232 DVLOG(1) << "Decode(): input_id=" << bitstream_buffer.id() 232 DVLOG(1) << "Decode(): input_id=" << bitstream_buffer.id()
233 << ", size=" << bitstream_buffer.size(); 233 << ", size=" << bitstream_buffer.size();
234 DCHECK(io_task_runner_->BelongsToCurrentThread()); 234 DCHECK(io_task_runner_->BelongsToCurrentThread());
235 235
236 if (bitstream_buffer.id() < 0) {
237 LOG(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id();
238 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle()))
239 base::SharedMemory::CloseHandle(bitstream_buffer.handle());
240 PostNotifyError(bitstream_buffer.id(), INVALID_ARGUMENT);
241 return;
242 }
243
236 if (video_frame->format() != media::PIXEL_FORMAT_I420) { 244 if (video_frame->format() != media::PIXEL_FORMAT_I420) {
237 PostNotifyError(bitstream_buffer.id(), UNSUPPORTED_JPEG); 245 PostNotifyError(bitstream_buffer.id(), UNSUPPORTED_JPEG);
238 return; 246 return;
239 } 247 }
240 248
241 scoped_ptr<JobRecord> job_record( 249 scoped_ptr<JobRecord> job_record(
242 new JobRecord(bitstream_buffer, video_frame)); 250 new JobRecord(bitstream_buffer, video_frame));
243 251
244 decoder_task_runner_->PostTask( 252 decoder_task_runner_->PostTask(
245 FROM_HERE, base::Bind(&V4L2JpegDecodeAccelerator::DecodeTask, 253 FROM_HERE, base::Bind(&V4L2JpegDecodeAccelerator::DecodeTask,
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 device_poll_thread_.Stop(); 892 device_poll_thread_.Stop();
885 893
886 // Clear the interrupt now, to be sure. 894 // Clear the interrupt now, to be sure.
887 if (!device_->ClearDevicePollInterrupt()) 895 if (!device_->ClearDevicePollInterrupt())
888 return false; 896 return false;
889 897
890 return true; 898 return true;
891 } 899 }
892 900
893 } // namespace content 901 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698