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

Side by Side Diff: content/common/gpu/media/v4l2_video_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 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 <dlfcn.h> 5 #include <dlfcn.h>
6 #include <errno.h> 6 #include <errno.h>
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <linux/videodev2.h> 8 #include <linux/videodev2.h>
9 #include <poll.h> 9 #include <poll.h>
10 #include <sys/eventfd.h> 10 #include <sys/eventfd.h>
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 DVLOG(3) << "DecodeTask(): input_id=" << bitstream_buffer.id(); 480 DVLOG(3) << "DecodeTask(): input_id=" << bitstream_buffer.id();
481 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); 481 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current());
482 DCHECK_NE(decoder_state_, kUninitialized); 482 DCHECK_NE(decoder_state_, kUninitialized);
483 TRACE_EVENT1("Video Decoder", "V4L2VDA::DecodeTask", "input_id", 483 TRACE_EVENT1("Video Decoder", "V4L2VDA::DecodeTask", "input_id",
484 bitstream_buffer.id()); 484 bitstream_buffer.id());
485 485
486 scoped_ptr<BitstreamBufferRef> bitstream_record(new BitstreamBufferRef( 486 scoped_ptr<BitstreamBufferRef> bitstream_record(new BitstreamBufferRef(
487 io_client_, io_task_runner_, 487 io_client_, io_task_runner_,
488 new base::SharedMemory(bitstream_buffer.handle(), true), 488 new base::SharedMemory(bitstream_buffer.handle(), true),
489 bitstream_buffer.size(), bitstream_buffer.id())); 489 bitstream_buffer.size(), bitstream_buffer.id()));
490 if (!bitstream_record->shm->Map(bitstream_buffer.size())) { 490 if (!bitstream_record->shm->MapAt(bitstream_buffer.offset(),
491 bitstream_buffer.size())) {
491 LOG(ERROR) << "Decode(): could not map bitstream_buffer"; 492 LOG(ERROR) << "Decode(): could not map bitstream_buffer";
492 NOTIFY_ERROR(UNREADABLE_INPUT); 493 NOTIFY_ERROR(UNREADABLE_INPUT);
493 return; 494 return;
494 } 495 }
495 DVLOG(3) << "DecodeTask(): mapped at=" << bitstream_record->shm->memory(); 496 DVLOG(3) << "DecodeTask(): mapped at=" << bitstream_record->shm->memory();
496 497
497 if (decoder_state_ == kResetting || decoder_flushing_) { 498 if (decoder_state_ == kResetting || decoder_flushing_) {
498 // In the case that we're resetting or flushing, we need to delay decoding 499 // In the case that we're resetting or flushing, we need to delay decoding
499 // the BitstreamBuffers that come after the Reset() or Flush() call. When 500 // the BitstreamBuffers that come after the Reset() or Flush() call. When
500 // we're here, we know that this DecodeTask() was scheduled by a Decode() 501 // we're here, we know that this DecodeTask() was scheduled by a Decode()
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 2045
2045 void V4L2VideoDecodeAccelerator::PictureCleared() { 2046 void V4L2VideoDecodeAccelerator::PictureCleared() {
2046 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; 2047 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_;
2047 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); 2048 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current());
2048 DCHECK_GT(picture_clearing_count_, 0); 2049 DCHECK_GT(picture_clearing_count_, 0);
2049 picture_clearing_count_--; 2050 picture_clearing_count_--;
2050 SendPictureReady(); 2051 SendPictureReady();
2051 } 2052 }
2052 2053
2053 } // namespace content 2054 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698