| 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 <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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 V4L2VideoDecodeAccelerator::EGLSyncKHRRef::~EGLSyncKHRRef() { | 120 V4L2VideoDecodeAccelerator::EGLSyncKHRRef::~EGLSyncKHRRef() { |
| 121 // We don't check for eglDestroySyncKHR failures, because if we get here | 121 // We don't check for eglDestroySyncKHR failures, because if we get here |
| 122 // with a valid sync object, something went wrong and we are getting | 122 // with a valid sync object, something went wrong and we are getting |
| 123 // destroyed anyway. | 123 // destroyed anyway. |
| 124 if (egl_sync != EGL_NO_SYNC_KHR) | 124 if (egl_sync != EGL_NO_SYNC_KHR) |
| 125 eglDestroySyncKHR(egl_display, egl_sync); | 125 eglDestroySyncKHR(egl_display, egl_sync); |
| 126 } | 126 } |
| 127 | 127 |
| 128 V4L2VideoDecodeAccelerator::InputRecord::InputRecord() | 128 V4L2VideoDecodeAccelerator::InputRecord::InputRecord() |
| 129 : at_device(false), | 129 : at_device(false), |
| 130 address(NULL), | 130 address(nullptr), |
| 131 length(0), | 131 length(0), |
| 132 bytes_used(0), | 132 bytes_used(0), |
| 133 input_id(-1) { | 133 input_id(-1) { |
| 134 } | 134 } |
| 135 | 135 |
| 136 V4L2VideoDecodeAccelerator::InputRecord::~InputRecord() { | 136 V4L2VideoDecodeAccelerator::InputRecord::~InputRecord() { |
| 137 } | 137 } |
| 138 | 138 |
| 139 V4L2VideoDecodeAccelerator::OutputRecord::OutputRecord() | 139 V4L2VideoDecodeAccelerator::OutputRecord::OutputRecord() |
| 140 : at_device(false), | 140 : at_device(false), |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // Must be run on child thread, as we'll insert a sync in the EGL context. | 388 // Must be run on child thread, as we'll insert a sync in the EGL context. |
| 389 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); | 389 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); |
| 390 | 390 |
| 391 if (!make_context_current_.Run()) { | 391 if (!make_context_current_.Run()) { |
| 392 LOG(ERROR) << "ReusePictureBuffer(): could not make context current"; | 392 LOG(ERROR) << "ReusePictureBuffer(): could not make context current"; |
| 393 NOTIFY_ERROR(PLATFORM_FAILURE); | 393 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 394 return; | 394 return; |
| 395 } | 395 } |
| 396 | 396 |
| 397 EGLSyncKHR egl_sync = | 397 EGLSyncKHR egl_sync = |
| 398 eglCreateSyncKHR(egl_display_, EGL_SYNC_FENCE_KHR, NULL); | 398 eglCreateSyncKHR(egl_display_, EGL_SYNC_FENCE_KHR, nullptr); |
| 399 if (egl_sync == EGL_NO_SYNC_KHR) { | 399 if (egl_sync == EGL_NO_SYNC_KHR) { |
| 400 LOG(ERROR) << "ReusePictureBuffer(): eglCreateSyncKHR() failed"; | 400 LOG(ERROR) << "ReusePictureBuffer(): eglCreateSyncKHR() failed"; |
| 401 NOTIFY_ERROR(PLATFORM_FAILURE); | 401 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 402 return; | 402 return; |
| 403 } | 403 } |
| 404 | 404 |
| 405 scoped_ptr<EGLSyncKHRRef> egl_sync_ref(new EGLSyncKHRRef( | 405 scoped_ptr<EGLSyncKHRRef> egl_sync_ref(new EGLSyncKHRRef( |
| 406 egl_display_, egl_sync)); | 406 egl_display_, egl_sync)); |
| 407 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 407 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
| 408 &V4L2VideoDecodeAccelerator::ReusePictureBufferTask, | 408 &V4L2VideoDecodeAccelerator::ReusePictureBufferTask, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 DVLOG(2) << "DecodeBufferTask(): early out: kResetting state"; | 501 DVLOG(2) << "DecodeBufferTask(): early out: kResetting state"; |
| 502 return; | 502 return; |
| 503 } else if (decoder_state_ == kError) { | 503 } else if (decoder_state_ == kError) { |
| 504 DVLOG(2) << "DecodeBufferTask(): early out: kError state"; | 504 DVLOG(2) << "DecodeBufferTask(): early out: kError state"; |
| 505 return; | 505 return; |
| 506 } else if (decoder_state_ == kChangingResolution) { | 506 } else if (decoder_state_ == kChangingResolution) { |
| 507 DVLOG(2) << "DecodeBufferTask(): early out: resolution change pending"; | 507 DVLOG(2) << "DecodeBufferTask(): early out: resolution change pending"; |
| 508 return; | 508 return; |
| 509 } | 509 } |
| 510 | 510 |
| 511 if (decoder_current_bitstream_buffer_ == NULL) { | 511 if (decoder_current_bitstream_buffer_ == nullptr) { |
| 512 if (decoder_input_queue_.empty()) { | 512 if (decoder_input_queue_.empty()) { |
| 513 // We're waiting for a new buffer -- exit without scheduling a new task. | 513 // We're waiting for a new buffer -- exit without scheduling a new task. |
| 514 return; | 514 return; |
| 515 } | 515 } |
| 516 linked_ptr<BitstreamBufferRef>& buffer_ref = decoder_input_queue_.front(); | 516 linked_ptr<BitstreamBufferRef>& buffer_ref = decoder_input_queue_.front(); |
| 517 if (decoder_delay_bitstream_buffer_id_ == buffer_ref->input_id) { | 517 if (decoder_delay_bitstream_buffer_id_ == buffer_ref->input_id) { |
| 518 // We're asked to delay decoding on this and subsequent buffers. | 518 // We're asked to delay decoding on this and subsequent buffers. |
| 519 return; | 519 return; |
| 520 } | 520 } |
| 521 | 521 |
| 522 // Setup to use the next buffer. | 522 // Setup to use the next buffer. |
| 523 decoder_current_bitstream_buffer_.reset(buffer_ref.release()); | 523 decoder_current_bitstream_buffer_.reset(buffer_ref.release()); |
| 524 decoder_input_queue_.pop(); | 524 decoder_input_queue_.pop(); |
| 525 DVLOG(3) << "DecodeBufferTask(): reading input_id=" | 525 DVLOG(3) << "DecodeBufferTask(): reading input_id=" |
| 526 << decoder_current_bitstream_buffer_->input_id | 526 << decoder_current_bitstream_buffer_->input_id |
| 527 << ", addr=" << (decoder_current_bitstream_buffer_->shm ? | 527 << ", addr=" << (decoder_current_bitstream_buffer_->shm ? |
| 528 decoder_current_bitstream_buffer_->shm->memory() : | 528 decoder_current_bitstream_buffer_->shm->memory() : |
| 529 NULL) | 529 nullptr) |
| 530 << ", size=" << decoder_current_bitstream_buffer_->size; | 530 << ", size=" << decoder_current_bitstream_buffer_->size; |
| 531 } | 531 } |
| 532 bool schedule_task = false; | 532 bool schedule_task = false; |
| 533 const size_t size = decoder_current_bitstream_buffer_->size; | 533 const size_t size = decoder_current_bitstream_buffer_->size; |
| 534 size_t decoded_size = 0; | 534 size_t decoded_size = 0; |
| 535 if (size == 0) { | 535 if (size == 0) { |
| 536 const int32 input_id = decoder_current_bitstream_buffer_->input_id; | 536 const int32 input_id = decoder_current_bitstream_buffer_->input_id; |
| 537 if (input_id >= 0) { | 537 if (input_id >= 0) { |
| 538 // This is a buffer queued from the client that has zero size. Skip. | 538 // This is a buffer queued from the client that has zero size. Skip. |
| 539 schedule_task = true; | 539 schedule_task = true; |
| 540 } else { | 540 } else { |
| 541 // This is a buffer of zero size, queued to flush the pipe. Flush. | 541 // This is a buffer of zero size, queued to flush the pipe. Flush. |
| 542 DCHECK_EQ(decoder_current_bitstream_buffer_->shm.get(), | 542 DCHECK_EQ(decoder_current_bitstream_buffer_->shm.get(), |
| 543 static_cast<base::SharedMemory*>(NULL)); | 543 static_cast<base::SharedMemory*>(nullptr)); |
| 544 // Enqueue a buffer guaranteed to be empty. To do that, we flush the | 544 // Enqueue a buffer guaranteed to be empty. To do that, we flush the |
| 545 // current input, enqueue no data to the next frame, then flush that down. | 545 // current input, enqueue no data to the next frame, then flush that down. |
| 546 schedule_task = true; | 546 schedule_task = true; |
| 547 if (decoder_current_input_buffer_ != -1 && | 547 if (decoder_current_input_buffer_ != -1 && |
| 548 input_buffer_map_[decoder_current_input_buffer_].input_id != | 548 input_buffer_map_[decoder_current_input_buffer_].input_id != |
| 549 kFlushBufferId) | 549 kFlushBufferId) |
| 550 schedule_task = FlushInputFrame(); | 550 schedule_task = FlushInputFrame(); |
| 551 | 551 |
| 552 if (schedule_task && AppendToInputFrame(NULL, 0) && FlushInputFrame()) { | 552 if (schedule_task && AppendToInputFrame(nullptr, 0) && |
| 553 FlushInputFrame()) { |
| 553 DVLOG(2) << "DecodeBufferTask(): enqueued flush buffer"; | 554 DVLOG(2) << "DecodeBufferTask(): enqueued flush buffer"; |
| 554 decoder_partial_frame_pending_ = false; | 555 decoder_partial_frame_pending_ = false; |
| 555 schedule_task = true; | 556 schedule_task = true; |
| 556 } else { | 557 } else { |
| 557 // If we failed to enqueue the empty buffer (due to pipeline | 558 // If we failed to enqueue the empty buffer (due to pipeline |
| 558 // backpressure), don't advance the bitstream buffer queue, and don't | 559 // backpressure), don't advance the bitstream buffer queue, and don't |
| 559 // schedule the next task. This bitstream buffer queue entry will get | 560 // schedule the next task. This bitstream buffer queue entry will get |
| 560 // reprocessed when the pipeline frees up. | 561 // reprocessed when the pipeline frees up. |
| 561 schedule_task = false; | 562 schedule_task = false; |
| 562 } | 563 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 decoder_partial_frame_pending_ = false; | 696 decoder_partial_frame_pending_ = false; |
| 696 return true; | 697 return true; |
| 697 } | 698 } |
| 698 } | 699 } |
| 699 | 700 |
| 700 void V4L2VideoDecodeAccelerator::ScheduleDecodeBufferTaskIfNeeded() { | 701 void V4L2VideoDecodeAccelerator::ScheduleDecodeBufferTaskIfNeeded() { |
| 701 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 702 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
| 702 | 703 |
| 703 // If we're behind on tasks, schedule another one. | 704 // If we're behind on tasks, schedule another one. |
| 704 int buffers_to_decode = decoder_input_queue_.size(); | 705 int buffers_to_decode = decoder_input_queue_.size(); |
| 705 if (decoder_current_bitstream_buffer_ != NULL) | 706 if (decoder_current_bitstream_buffer_ != nullptr) |
| 706 buffers_to_decode++; | 707 buffers_to_decode++; |
| 707 if (decoder_decode_buffer_tasks_scheduled_ < buffers_to_decode) { | 708 if (decoder_decode_buffer_tasks_scheduled_ < buffers_to_decode) { |
| 708 decoder_decode_buffer_tasks_scheduled_++; | 709 decoder_decode_buffer_tasks_scheduled_++; |
| 709 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 710 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
| 710 &V4L2VideoDecodeAccelerator::DecodeBufferTask, | 711 &V4L2VideoDecodeAccelerator::DecodeBufferTask, |
| 711 base::Unretained(this))); | 712 base::Unretained(this))); |
| 712 } | 713 } |
| 713 } | 714 } |
| 714 | 715 |
| 715 bool V4L2VideoDecodeAccelerator::DecodeBufferInitial( | 716 bool V4L2VideoDecodeAccelerator::DecodeBufferInitial( |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 (decoder_partial_frame_pending_ || FlushInputFrame())); | 781 (decoder_partial_frame_pending_ || FlushInputFrame())); |
| 781 } | 782 } |
| 782 | 783 |
| 783 bool V4L2VideoDecodeAccelerator::AppendToInputFrame( | 784 bool V4L2VideoDecodeAccelerator::AppendToInputFrame( |
| 784 const void* data, size_t size) { | 785 const void* data, size_t size) { |
| 785 DVLOG(3) << "AppendToInputFrame()"; | 786 DVLOG(3) << "AppendToInputFrame()"; |
| 786 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 787 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
| 787 DCHECK_NE(decoder_state_, kUninitialized); | 788 DCHECK_NE(decoder_state_, kUninitialized); |
| 788 DCHECK_NE(decoder_state_, kResetting); | 789 DCHECK_NE(decoder_state_, kResetting); |
| 789 DCHECK_NE(decoder_state_, kError); | 790 DCHECK_NE(decoder_state_, kError); |
| 790 // This routine can handle data == NULL and size == 0, which occurs when | 791 // This routine can handle data == nullptr and size == 0, which occurs when |
| 791 // we queue an empty buffer for the purposes of flushing the pipe. | 792 // we queue an empty buffer for the purposes of flushing the pipe. |
| 792 | 793 |
| 793 // Flush if we're too big | 794 // Flush if we're too big |
| 794 if (decoder_current_input_buffer_ != -1) { | 795 if (decoder_current_input_buffer_ != -1) { |
| 795 InputRecord& input_record = | 796 InputRecord& input_record = |
| 796 input_buffer_map_[decoder_current_input_buffer_]; | 797 input_buffer_map_[decoder_current_input_buffer_]; |
| 797 if (input_record.bytes_used + size > input_record.length) { | 798 if (input_record.bytes_used + size > input_record.length) { |
| 798 if (!FlushInputFrame()) | 799 if (!FlushInputFrame()) |
| 799 return false; | 800 return false; |
| 800 decoder_current_input_buffer_ = -1; | 801 decoder_current_input_buffer_ = -1; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 811 DVLOG(2) << "AppendToInputFrame(): stalled for input buffers"; | 812 DVLOG(2) << "AppendToInputFrame(): stalled for input buffers"; |
| 812 return false; | 813 return false; |
| 813 } | 814 } |
| 814 } | 815 } |
| 815 decoder_current_input_buffer_ = free_input_buffers_.back(); | 816 decoder_current_input_buffer_ = free_input_buffers_.back(); |
| 816 free_input_buffers_.pop_back(); | 817 free_input_buffers_.pop_back(); |
| 817 InputRecord& input_record = | 818 InputRecord& input_record = |
| 818 input_buffer_map_[decoder_current_input_buffer_]; | 819 input_buffer_map_[decoder_current_input_buffer_]; |
| 819 DCHECK_EQ(input_record.bytes_used, 0); | 820 DCHECK_EQ(input_record.bytes_used, 0); |
| 820 DCHECK_EQ(input_record.input_id, -1); | 821 DCHECK_EQ(input_record.input_id, -1); |
| 821 DCHECK(decoder_current_bitstream_buffer_ != NULL); | 822 DCHECK(decoder_current_bitstream_buffer_ != nullptr); |
| 822 input_record.input_id = decoder_current_bitstream_buffer_->input_id; | 823 input_record.input_id = decoder_current_bitstream_buffer_->input_id; |
| 823 } | 824 } |
| 824 | 825 |
| 825 DCHECK(data != NULL || size == 0); | 826 DCHECK(data != nullptr || size == 0); |
| 826 if (size == 0) { | 827 if (size == 0) { |
| 827 // If we asked for an empty buffer, return now. We return only after | 828 // If we asked for an empty buffer, return now. We return only after |
| 828 // getting the next input buffer, since we might actually want an empty | 829 // getting the next input buffer, since we might actually want an empty |
| 829 // input buffer for flushing purposes. | 830 // input buffer for flushing purposes. |
| 830 return true; | 831 return true; |
| 831 } | 832 } |
| 832 | 833 |
| 833 // Copy in to the buffer. | 834 // Copy in to the buffer. |
| 834 InputRecord& input_record = | 835 InputRecord& input_record = |
| 835 input_buffer_map_[decoder_current_input_buffer_]; | 836 input_buffer_map_[decoder_current_input_buffer_]; |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 DVLOG(2) << "FlushTask(): early out: kError state"; | 1252 DVLOG(2) << "FlushTask(): early out: kError state"; |
| 1252 return; | 1253 return; |
| 1253 } | 1254 } |
| 1254 | 1255 |
| 1255 // We don't support stacked flushing. | 1256 // We don't support stacked flushing. |
| 1256 DCHECK(!decoder_flushing_); | 1257 DCHECK(!decoder_flushing_); |
| 1257 | 1258 |
| 1258 // Queue up an empty buffer -- this triggers the flush. | 1259 // Queue up an empty buffer -- this triggers the flush. |
| 1259 decoder_input_queue_.push( | 1260 decoder_input_queue_.push( |
| 1260 linked_ptr<BitstreamBufferRef>(new BitstreamBufferRef( | 1261 linked_ptr<BitstreamBufferRef>(new BitstreamBufferRef( |
| 1261 io_client_, io_message_loop_proxy_, NULL, 0, kFlushBufferId))); | 1262 io_client_, io_message_loop_proxy_, nullptr, 0, kFlushBufferId))); |
| 1262 decoder_flushing_ = true; | 1263 decoder_flushing_ = true; |
| 1263 SendPictureReady(); // Send all pending PictureReady. | 1264 SendPictureReady(); // Send all pending PictureReady. |
| 1264 | 1265 |
| 1265 ScheduleDecodeBufferTaskIfNeeded(); | 1266 ScheduleDecodeBufferTaskIfNeeded(); |
| 1266 } | 1267 } |
| 1267 | 1268 |
| 1268 void V4L2VideoDecodeAccelerator::NotifyFlushDoneIfNeeded() { | 1269 void V4L2VideoDecodeAccelerator::NotifyFlushDoneIfNeeded() { |
| 1269 if (!decoder_flushing_) | 1270 if (!decoder_flushing_) |
| 1270 return; | 1271 return; |
| 1271 | 1272 |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 client_->NotifyError(error); | 1603 client_->NotifyError(error); |
| 1603 client_ptr_factory_.reset(); | 1604 client_ptr_factory_.reset(); |
| 1604 } | 1605 } |
| 1605 } | 1606 } |
| 1606 | 1607 |
| 1607 void V4L2VideoDecodeAccelerator::SetDecoderState(State state) { | 1608 void V4L2VideoDecodeAccelerator::SetDecoderState(State state) { |
| 1608 DVLOG(3) << "SetDecoderState(): state=" << state; | 1609 DVLOG(3) << "SetDecoderState(): state=" << state; |
| 1609 | 1610 |
| 1610 // We can touch decoder_state_ only if this is the decoder thread or the | 1611 // We can touch decoder_state_ only if this is the decoder thread or the |
| 1611 // decoder thread isn't running. | 1612 // decoder thread isn't running. |
| 1612 if (decoder_thread_.message_loop() != NULL && | 1613 if (decoder_thread_.message_loop() != nullptr && |
| 1613 decoder_thread_.message_loop() != base::MessageLoop::current()) { | 1614 decoder_thread_.message_loop() != base::MessageLoop::current()) { |
| 1614 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 1615 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
| 1615 &V4L2VideoDecodeAccelerator::SetDecoderState, | 1616 &V4L2VideoDecodeAccelerator::SetDecoderState, |
| 1616 base::Unretained(this), state)); | 1617 base::Unretained(this), state)); |
| 1617 } else { | 1618 } else { |
| 1618 decoder_state_ = state; | 1619 decoder_state_ = state; |
| 1619 } | 1620 } |
| 1620 } | 1621 } |
| 1621 | 1622 |
| 1622 bool V4L2VideoDecodeAccelerator::GetFormatInfo(struct v4l2_format* format, | 1623 bool V4L2VideoDecodeAccelerator::GetFormatInfo(struct v4l2_format* format, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1695 struct v4l2_plane planes[1]; | 1696 struct v4l2_plane planes[1]; |
| 1696 struct v4l2_buffer buffer; | 1697 struct v4l2_buffer buffer; |
| 1697 memset(&buffer, 0, sizeof(buffer)); | 1698 memset(&buffer, 0, sizeof(buffer)); |
| 1698 memset(planes, 0, sizeof(planes)); | 1699 memset(planes, 0, sizeof(planes)); |
| 1699 buffer.index = i; | 1700 buffer.index = i; |
| 1700 buffer.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | 1701 buffer.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; |
| 1701 buffer.memory = V4L2_MEMORY_MMAP; | 1702 buffer.memory = V4L2_MEMORY_MMAP; |
| 1702 buffer.m.planes = planes; | 1703 buffer.m.planes = planes; |
| 1703 buffer.length = 1; | 1704 buffer.length = 1; |
| 1704 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYBUF, &buffer); | 1705 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYBUF, &buffer); |
| 1705 void* address = device_->Mmap(NULL, | 1706 void* address = device_->Mmap(nullptr, |
| 1706 buffer.m.planes[0].length, | 1707 buffer.m.planes[0].length, |
| 1707 PROT_READ | PROT_WRITE, | 1708 PROT_READ | PROT_WRITE, |
| 1708 MAP_SHARED, | 1709 MAP_SHARED, |
| 1709 buffer.m.planes[0].m.mem_offset); | 1710 buffer.m.planes[0].m.mem_offset); |
| 1710 if (address == MAP_FAILED) { | 1711 if (address == MAP_FAILED) { |
| 1711 PLOG(ERROR) << "CreateInputBuffers(): mmap() failed"; | 1712 PLOG(ERROR) << "CreateInputBuffers(): mmap() failed"; |
| 1712 return false; | 1713 return false; |
| 1713 } | 1714 } |
| 1714 input_buffer_map_[i].address = address; | 1715 input_buffer_map_[i].address = address; |
| 1715 input_buffer_map_[i].length = buffer.m.planes[0].length; | 1716 input_buffer_map_[i].length = buffer.m.planes[0].length; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 Enqueue(); | 1774 Enqueue(); |
| 1774 return true; | 1775 return true; |
| 1775 } | 1776 } |
| 1776 | 1777 |
| 1777 void V4L2VideoDecodeAccelerator::DestroyInputBuffers() { | 1778 void V4L2VideoDecodeAccelerator::DestroyInputBuffers() { |
| 1778 DVLOG(3) << "DestroyInputBuffers()"; | 1779 DVLOG(3) << "DestroyInputBuffers()"; |
| 1779 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); | 1780 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); |
| 1780 DCHECK(!input_streamon_); | 1781 DCHECK(!input_streamon_); |
| 1781 | 1782 |
| 1782 for (size_t i = 0; i < input_buffer_map_.size(); ++i) { | 1783 for (size_t i = 0; i < input_buffer_map_.size(); ++i) { |
| 1783 if (input_buffer_map_[i].address != NULL) { | 1784 if (input_buffer_map_[i].address != nullptr) { |
| 1784 device_->Munmap(input_buffer_map_[i].address, | 1785 device_->Munmap(input_buffer_map_[i].address, |
| 1785 input_buffer_map_[i].length); | 1786 input_buffer_map_[i].length); |
| 1786 } | 1787 } |
| 1787 } | 1788 } |
| 1788 | 1789 |
| 1789 struct v4l2_requestbuffers reqbufs; | 1790 struct v4l2_requestbuffers reqbufs; |
| 1790 memset(&reqbufs, 0, sizeof(reqbufs)); | 1791 memset(&reqbufs, 0, sizeof(reqbufs)); |
| 1791 reqbufs.count = 0; | 1792 reqbufs.count = 0; |
| 1792 reqbufs.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | 1793 reqbufs.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; |
| 1793 reqbufs.memory = V4L2_MEMORY_MMAP; | 1794 reqbufs.memory = V4L2_MEMORY_MMAP; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 gfx::Size new_size(base::checked_cast<int>(format.fmt.pix_mp.width), | 1935 gfx::Size new_size(base::checked_cast<int>(format.fmt.pix_mp.width), |
| 1935 base::checked_cast<int>(format.fmt.pix_mp.height)); | 1936 base::checked_cast<int>(format.fmt.pix_mp.height)); |
| 1936 if (frame_buffer_size_ != new_size) { | 1937 if (frame_buffer_size_ != new_size) { |
| 1937 DVLOG(3) << "IsResolutionChangeNecessary(): Resolution change detected"; | 1938 DVLOG(3) << "IsResolutionChangeNecessary(): Resolution change detected"; |
| 1938 return true; | 1939 return true; |
| 1939 } | 1940 } |
| 1940 return false; | 1941 return false; |
| 1941 } | 1942 } |
| 1942 | 1943 |
| 1943 } // namespace content | 1944 } // namespace content |
| OLD | NEW |