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

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

Issue 1541353002: Add offset support to BitstreamBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 <sys/mman.h> 7 #include <sys/mman.h>
8 8
9 #include "base/big_endian.h" 9 #include "base/big_endian.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 for (; device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) { 253 for (; device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) {
254 if (fmtdesc.pixelformat == V4L2_PIX_FMT_JPEG) 254 if (fmtdesc.pixelformat == V4L2_PIX_FMT_JPEG)
255 return true; 255 return true;
256 } 256 }
257 return false; 257 return false;
258 } 258 }
259 259
260 void V4L2JpegDecodeAccelerator::DecodeTask(scoped_ptr<JobRecord> job_record) { 260 void V4L2JpegDecodeAccelerator::DecodeTask(scoped_ptr<JobRecord> job_record) {
261 DCHECK(decoder_task_runner_->BelongsToCurrentThread()); 261 DCHECK(decoder_task_runner_->BelongsToCurrentThread());
262 job_record->shm.reset( 262 media::BitstreamBuffer* buffer = &job_record->bitstream_buffer;
263 new base::SharedMemory(job_record->bitstream_buffer.handle(), true)); 263 job_record->shm.reset(new base::SharedMemory(buffer->handle(), true));
264 if (!job_record->shm->Map(job_record->bitstream_buffer.size())) { 264 if (!job_record->shm->MapAt(buffer->offset(), buffer->size())) {
265 PLOG(ERROR) << __func__ << ": could not map bitstream_buffer"; 265 PLOG(ERROR) << __func__ << ": could not map bitstream_buffer";
266 PostNotifyError(job_record->bitstream_buffer.id(), UNREADABLE_INPUT); 266 PostNotifyError(job_record->bitstream_buffer.id(), UNREADABLE_INPUT);
267 return; 267 return;
268 } 268 }
269 input_jobs_.push(make_linked_ptr(job_record.release())); 269 input_jobs_.push(make_linked_ptr(job_record.release()));
270 270
271 ServiceDeviceTask(false); 271 ServiceDeviceTask(false);
272 } 272 }
273 273
274 size_t V4L2JpegDecodeAccelerator::InputBufferQueuedCount() { 274 size_t V4L2JpegDecodeAccelerator::InputBufferQueuedCount() {
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 device_poll_thread_.Stop(); 883 device_poll_thread_.Stop();
884 884
885 // Clear the interrupt now, to be sure. 885 // Clear the interrupt now, to be sure.
886 if (!device_->ClearDevicePollInterrupt()) 886 if (!device_->ClearDevicePollInterrupt())
887 return false; 887 return false;
888 888
889 return true; 889 return true;
890 } 890 }
891 891
892 } // namespace content 892 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698