| 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 "media/gpu/v4l2_video_decode_accelerator.h" | 5 #include "media/gpu/v4l2_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <linux/videodev2.h> | 10 #include <linux/videodev2.h> |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 return false; | 283 return false; |
| 284 | 284 |
| 285 if (!decoder_thread_.Start()) { | 285 if (!decoder_thread_.Start()) { |
| 286 LOGF(ERROR) << "decoder thread failed to start"; | 286 LOGF(ERROR) << "decoder thread failed to start"; |
| 287 return false; | 287 return false; |
| 288 } | 288 } |
| 289 | 289 |
| 290 decoder_state_ = kInitialized; | 290 decoder_state_ = kInitialized; |
| 291 | 291 |
| 292 // StartDevicePoll will NOTIFY_ERROR on failure, so IgnoreResult is fine here. | 292 // StartDevicePoll will NOTIFY_ERROR on failure, so IgnoreResult is fine here. |
| 293 decoder_thread_.message_loop()->PostTask( | 293 decoder_thread_.task_runner()->PostTask( |
| 294 FROM_HERE, base::Bind(base::IgnoreResult( | 294 FROM_HERE, base::Bind(base::IgnoreResult( |
| 295 &V4L2VideoDecodeAccelerator::StartDevicePoll), | 295 &V4L2VideoDecodeAccelerator::StartDevicePoll), |
| 296 base::Unretained(this))); | 296 base::Unretained(this))); |
| 297 | 297 |
| 298 return true; | 298 return true; |
| 299 } | 299 } |
| 300 | 300 |
| 301 void V4L2VideoDecodeAccelerator::Decode( | 301 void V4L2VideoDecodeAccelerator::Decode( |
| 302 const BitstreamBuffer& bitstream_buffer) { | 302 const BitstreamBuffer& bitstream_buffer) { |
| 303 DVLOGF(1) << "input_id=" << bitstream_buffer.id() | 303 DVLOGF(1) << "input_id=" << bitstream_buffer.id() |
| 304 << ", size=" << bitstream_buffer.size(); | 304 << ", size=" << bitstream_buffer.size(); |
| 305 DCHECK(decode_task_runner_->BelongsToCurrentThread()); | 305 DCHECK(decode_task_runner_->BelongsToCurrentThread()); |
| 306 | 306 |
| 307 if (bitstream_buffer.id() < 0) { | 307 if (bitstream_buffer.id() < 0) { |
| 308 LOGF(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id(); | 308 LOGF(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id(); |
| 309 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) | 309 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) |
| 310 base::SharedMemory::CloseHandle(bitstream_buffer.handle()); | 310 base::SharedMemory::CloseHandle(bitstream_buffer.handle()); |
| 311 NOTIFY_ERROR(INVALID_ARGUMENT); | 311 NOTIFY_ERROR(INVALID_ARGUMENT); |
| 312 return; | 312 return; |
| 313 } | 313 } |
| 314 | 314 |
| 315 // DecodeTask() will take care of running a DecodeBufferTask(). | 315 // DecodeTask() will take care of running a DecodeBufferTask(). |
| 316 decoder_thread_.message_loop()->PostTask( | 316 decoder_thread_.task_runner()->PostTask( |
| 317 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::DecodeTask, | 317 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::DecodeTask, |
| 318 base::Unretained(this), bitstream_buffer)); | 318 base::Unretained(this), bitstream_buffer)); |
| 319 } | 319 } |
| 320 | 320 |
| 321 void V4L2VideoDecodeAccelerator::AssignPictureBuffers( | 321 void V4L2VideoDecodeAccelerator::AssignPictureBuffers( |
| 322 const std::vector<PictureBuffer>& buffers) { | 322 const std::vector<PictureBuffer>& buffers) { |
| 323 DVLOGF(3) << "buffer_count=" << buffers.size(); | 323 DVLOGF(3) << "buffer_count=" << buffers.size(); |
| 324 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 324 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 325 | 325 |
| 326 decoder_thread_.message_loop()->PostTask( | 326 decoder_thread_.task_runner()->PostTask( |
| 327 FROM_HERE, | 327 FROM_HERE, |
| 328 base::Bind(&V4L2VideoDecodeAccelerator::AssignPictureBuffersTask, | 328 base::Bind(&V4L2VideoDecodeAccelerator::AssignPictureBuffersTask, |
| 329 base::Unretained(this), buffers)); | 329 base::Unretained(this), buffers)); |
| 330 } | 330 } |
| 331 | 331 |
| 332 void V4L2VideoDecodeAccelerator::AssignPictureBuffersTask( | 332 void V4L2VideoDecodeAccelerator::AssignPictureBuffersTask( |
| 333 const std::vector<PictureBuffer>& buffers) { | 333 const std::vector<PictureBuffer>& buffers) { |
| 334 DVLOGF(3); | 334 DVLOGF(3); |
| 335 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); | 335 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
| 336 DCHECK_EQ(decoder_state_, kAwaitingPictureBuffers); | 336 DCHECK_EQ(decoder_state_, kAwaitingPictureBuffers); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 for (EGLImageKHR image : egl_images) { | 435 for (EGLImageKHR image : egl_images) { |
| 436 if (egl_image_device_->DestroyEGLImage(egl_display_, image) != EGL_TRUE) | 436 if (egl_image_device_->DestroyEGLImage(egl_display_, image) != EGL_TRUE) |
| 437 DVLOGF(1) << "DestroyEGLImage failed."; | 437 DVLOGF(1) << "DestroyEGLImage failed."; |
| 438 } | 438 } |
| 439 NOTIFY_ERROR(PLATFORM_FAILURE); | 439 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 440 return; | 440 return; |
| 441 } | 441 } |
| 442 egl_images.push_back(egl_image); | 442 egl_images.push_back(egl_image); |
| 443 } | 443 } |
| 444 | 444 |
| 445 decoder_thread_.message_loop()->PostTask( | 445 decoder_thread_.task_runner()->PostTask( |
| 446 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::AssignEGLImages, | 446 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::AssignEGLImages, |
| 447 base::Unretained(this), buffers, egl_images)); | 447 base::Unretained(this), buffers, egl_images)); |
| 448 } | 448 } |
| 449 | 449 |
| 450 void V4L2VideoDecodeAccelerator::AssignEGLImages( | 450 void V4L2VideoDecodeAccelerator::AssignEGLImages( |
| 451 const std::vector<media::PictureBuffer>& buffers, | 451 const std::vector<media::PictureBuffer>& buffers, |
| 452 const std::vector<EGLImageKHR>& egl_images) { | 452 const std::vector<EGLImageKHR>& egl_images) { |
| 453 DVLOGF(3); | 453 DVLOGF(3); |
| 454 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); | 454 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
| 455 DCHECK_EQ(buffers.size(), egl_images.size()); | 455 DCHECK_EQ(buffers.size(), egl_images.size()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 if (egl_sync == EGL_NO_SYNC_KHR) { | 514 if (egl_sync == EGL_NO_SYNC_KHR) { |
| 515 LOGF(ERROR) << "eglCreateSyncKHR() failed"; | 515 LOGF(ERROR) << "eglCreateSyncKHR() failed"; |
| 516 NOTIFY_ERROR(PLATFORM_FAILURE); | 516 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 517 return; | 517 return; |
| 518 } | 518 } |
| 519 #endif | 519 #endif |
| 520 | 520 |
| 521 std::unique_ptr<EGLSyncKHRRef> egl_sync_ref( | 521 std::unique_ptr<EGLSyncKHRRef> egl_sync_ref( |
| 522 new EGLSyncKHRRef(egl_display_, egl_sync)); | 522 new EGLSyncKHRRef(egl_display_, egl_sync)); |
| 523 | 523 |
| 524 decoder_thread_.message_loop()->PostTask( | 524 decoder_thread_.task_runner()->PostTask( |
| 525 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::ReusePictureBufferTask, | 525 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::ReusePictureBufferTask, |
| 526 base::Unretained(this), picture_buffer_id, | 526 base::Unretained(this), picture_buffer_id, |
| 527 base::Passed(&egl_sync_ref))); | 527 base::Passed(&egl_sync_ref))); |
| 528 } | 528 } |
| 529 | 529 |
| 530 void V4L2VideoDecodeAccelerator::Flush() { | 530 void V4L2VideoDecodeAccelerator::Flush() { |
| 531 DVLOGF(3); | 531 DVLOGF(3); |
| 532 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 532 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 533 decoder_thread_.message_loop()->PostTask( | 533 decoder_thread_.task_runner()->PostTask( |
| 534 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::FlushTask, | 534 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::FlushTask, |
| 535 base::Unretained(this))); | 535 base::Unretained(this))); |
| 536 } | 536 } |
| 537 | 537 |
| 538 void V4L2VideoDecodeAccelerator::Reset() { | 538 void V4L2VideoDecodeAccelerator::Reset() { |
| 539 DVLOGF(3); | 539 DVLOGF(3); |
| 540 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 540 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 541 decoder_thread_.message_loop()->PostTask( | 541 decoder_thread_.task_runner()->PostTask( |
| 542 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::ResetTask, | 542 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::ResetTask, |
| 543 base::Unretained(this))); | 543 base::Unretained(this))); |
| 544 } | 544 } |
| 545 | 545 |
| 546 void V4L2VideoDecodeAccelerator::Destroy() { | 546 void V4L2VideoDecodeAccelerator::Destroy() { |
| 547 DVLOGF(3); | 547 DVLOGF(3); |
| 548 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 548 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 549 | 549 |
| 550 // We're destroying; cancel all callbacks. | 550 // We're destroying; cancel all callbacks. |
| 551 client_ptr_factory_.reset(); | 551 client_ptr_factory_.reset(); |
| 552 weak_this_factory_.InvalidateWeakPtrs(); | 552 weak_this_factory_.InvalidateWeakPtrs(); |
| 553 | 553 |
| 554 // If the decoder thread is running, destroy using posted task. | 554 // If the decoder thread is running, destroy using posted task. |
| 555 if (decoder_thread_.IsRunning()) { | 555 if (decoder_thread_.IsRunning()) { |
| 556 decoder_thread_.message_loop()->PostTask( | 556 decoder_thread_.task_runner()->PostTask( |
| 557 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::DestroyTask, | 557 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::DestroyTask, |
| 558 base::Unretained(this))); | 558 base::Unretained(this))); |
| 559 // DestroyTask() will cause the decoder_thread_ to flush all tasks. | 559 // DestroyTask() will cause the decoder_thread_ to flush all tasks. |
| 560 decoder_thread_.Stop(); | 560 decoder_thread_.Stop(); |
| 561 } else { | 561 } else { |
| 562 // Otherwise, call the destroy task directly. | 562 // Otherwise, call the destroy task directly. |
| 563 DestroyTask(); | 563 DestroyTask(); |
| 564 } | 564 } |
| 565 | 565 |
| 566 delete this; | 566 delete this; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 | 828 |
| 829 void V4L2VideoDecodeAccelerator::ScheduleDecodeBufferTaskIfNeeded() { | 829 void V4L2VideoDecodeAccelerator::ScheduleDecodeBufferTaskIfNeeded() { |
| 830 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); | 830 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
| 831 | 831 |
| 832 // If we're behind on tasks, schedule another one. | 832 // If we're behind on tasks, schedule another one. |
| 833 int buffers_to_decode = decoder_input_queue_.size(); | 833 int buffers_to_decode = decoder_input_queue_.size(); |
| 834 if (decoder_current_bitstream_buffer_ != NULL) | 834 if (decoder_current_bitstream_buffer_ != NULL) |
| 835 buffers_to_decode++; | 835 buffers_to_decode++; |
| 836 if (decoder_decode_buffer_tasks_scheduled_ < buffers_to_decode) { | 836 if (decoder_decode_buffer_tasks_scheduled_ < buffers_to_decode) { |
| 837 decoder_decode_buffer_tasks_scheduled_++; | 837 decoder_decode_buffer_tasks_scheduled_++; |
| 838 decoder_thread_.message_loop()->PostTask( | 838 decoder_thread_.task_runner()->PostTask( |
| 839 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::DecodeBufferTask, | 839 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::DecodeBufferTask, |
| 840 base::Unretained(this))); | 840 base::Unretained(this))); |
| 841 } | 841 } |
| 842 } | 842 } |
| 843 | 843 |
| 844 bool V4L2VideoDecodeAccelerator::DecodeBufferInitial(const void* data, | 844 bool V4L2VideoDecodeAccelerator::DecodeBufferInitial(const void* data, |
| 845 size_t size, | 845 size_t size, |
| 846 size_t* endpos) { | 846 size_t* endpos) { |
| 847 DVLOGF(3) << "data=" << data << ", size=" << size; | 847 DVLOGF(3) << "data=" << data << ", size=" << size; |
| 848 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); | 848 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 poll_device = true; | 1042 poll_device = true; |
| 1043 | 1043 |
| 1044 // ServiceDeviceTask() should only ever be scheduled from DevicePollTask(), | 1044 // ServiceDeviceTask() should only ever be scheduled from DevicePollTask(), |
| 1045 // so either: | 1045 // so either: |
| 1046 // * device_poll_thread_ is running normally | 1046 // * device_poll_thread_ is running normally |
| 1047 // * device_poll_thread_ scheduled us, but then a ResetTask() or DestroyTask() | 1047 // * device_poll_thread_ scheduled us, but then a ResetTask() or DestroyTask() |
| 1048 // shut it down, in which case we're either in kResetting or kError states | 1048 // shut it down, in which case we're either in kResetting or kError states |
| 1049 // respectively, and we should have early-outed already. | 1049 // respectively, and we should have early-outed already. |
| 1050 DCHECK(device_poll_thread_.message_loop()); | 1050 DCHECK(device_poll_thread_.message_loop()); |
| 1051 // Queue the DevicePollTask() now. | 1051 // Queue the DevicePollTask() now. |
| 1052 device_poll_thread_.message_loop()->PostTask( | 1052 device_poll_thread_.task_runner()->PostTask( |
| 1053 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::DevicePollTask, | 1053 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::DevicePollTask, |
| 1054 base::Unretained(this), poll_device)); | 1054 base::Unretained(this), poll_device)); |
| 1055 | 1055 |
| 1056 DVLOG(1) << "ServiceDeviceTask(): buffer counts: DEC[" | 1056 DVLOG(1) << "ServiceDeviceTask(): buffer counts: DEC[" |
| 1057 << decoder_input_queue_.size() << "->" | 1057 << decoder_input_queue_.size() << "->" |
| 1058 << input_ready_queue_.size() << "] => DEVICE[" | 1058 << input_ready_queue_.size() << "] => DEVICE[" |
| 1059 << free_input_buffers_.size() << "+" | 1059 << free_input_buffers_.size() << "+" |
| 1060 << input_buffer_queued_count_ << "/" | 1060 << input_buffer_queued_count_ << "/" |
| 1061 << input_buffer_map_.size() << "->" | 1061 << input_buffer_map_.size() << "->" |
| 1062 << free_output_buffers_.size() << "+" | 1062 << free_output_buffers_.size() << "+" |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 image_processor_bitstream_buffer_ids_.pop(); | 1511 image_processor_bitstream_buffer_ids_.pop(); |
| 1512 | 1512 |
| 1513 // If we were flushing, we'll never return any more BitstreamBuffers or | 1513 // If we were flushing, we'll never return any more BitstreamBuffers or |
| 1514 // PictureBuffers; they have all been dropped and returned by now. | 1514 // PictureBuffers; they have all been dropped and returned by now. |
| 1515 NotifyFlushDoneIfNeeded(); | 1515 NotifyFlushDoneIfNeeded(); |
| 1516 | 1516 |
| 1517 // Mark that we're resetting, then enqueue a ResetDoneTask(). All intervening | 1517 // Mark that we're resetting, then enqueue a ResetDoneTask(). All intervening |
| 1518 // jobs will early-out in the kResetting state. | 1518 // jobs will early-out in the kResetting state. |
| 1519 decoder_state_ = kResetting; | 1519 decoder_state_ = kResetting; |
| 1520 SendPictureReady(); // Send all pending PictureReady. | 1520 SendPictureReady(); // Send all pending PictureReady. |
| 1521 decoder_thread_.message_loop()->PostTask( | 1521 decoder_thread_.task_runner()->PostTask( |
| 1522 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::ResetDoneTask, | 1522 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::ResetDoneTask, |
| 1523 base::Unretained(this))); | 1523 base::Unretained(this))); |
| 1524 } | 1524 } |
| 1525 | 1525 |
| 1526 void V4L2VideoDecodeAccelerator::ResetDoneTask() { | 1526 void V4L2VideoDecodeAccelerator::ResetDoneTask() { |
| 1527 DVLOGF(3); | 1527 DVLOGF(3); |
| 1528 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); | 1528 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
| 1529 TRACE_EVENT0("Video Decoder", "V4L2VDA::ResetDoneTask"); | 1529 TRACE_EVENT0("Video Decoder", "V4L2VDA::ResetDoneTask"); |
| 1530 | 1530 |
| 1531 if (decoder_state_ == kError) { | 1531 if (decoder_state_ == kError) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 DVLOGF(3); | 1583 DVLOGF(3); |
| 1584 DCHECK(!device_poll_thread_.IsRunning()); | 1584 DCHECK(!device_poll_thread_.IsRunning()); |
| 1585 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); | 1585 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
| 1586 | 1586 |
| 1587 // Start up the device poll thread and schedule its first DevicePollTask(). | 1587 // Start up the device poll thread and schedule its first DevicePollTask(). |
| 1588 if (!device_poll_thread_.Start()) { | 1588 if (!device_poll_thread_.Start()) { |
| 1589 LOGF(ERROR) << "Device thread failed to start"; | 1589 LOGF(ERROR) << "Device thread failed to start"; |
| 1590 NOTIFY_ERROR(PLATFORM_FAILURE); | 1590 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 1591 return false; | 1591 return false; |
| 1592 } | 1592 } |
| 1593 device_poll_thread_.message_loop()->PostTask( | 1593 device_poll_thread_.task_runner()->PostTask( |
| 1594 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::DevicePollTask, | 1594 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::DevicePollTask, |
| 1595 base::Unretained(this), 0)); | 1595 base::Unretained(this), 0)); |
| 1596 | 1596 |
| 1597 return true; | 1597 return true; |
| 1598 } | 1598 } |
| 1599 | 1599 |
| 1600 bool V4L2VideoDecodeAccelerator::StopDevicePoll() { | 1600 bool V4L2VideoDecodeAccelerator::StopDevicePoll() { |
| 1601 DVLOGF(3); | 1601 DVLOGF(3); |
| 1602 | 1602 |
| 1603 if (!device_poll_thread_.IsRunning()) | 1603 if (!device_poll_thread_.IsRunning()) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 | 1735 |
| 1736 bool event_pending = false; | 1736 bool event_pending = false; |
| 1737 | 1737 |
| 1738 if (!device_->Poll(poll_device, &event_pending)) { | 1738 if (!device_->Poll(poll_device, &event_pending)) { |
| 1739 NOTIFY_ERROR(PLATFORM_FAILURE); | 1739 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 1740 return; | 1740 return; |
| 1741 } | 1741 } |
| 1742 | 1742 |
| 1743 // All processing should happen on ServiceDeviceTask(), since we shouldn't | 1743 // All processing should happen on ServiceDeviceTask(), since we shouldn't |
| 1744 // touch decoder state from this thread. | 1744 // touch decoder state from this thread. |
| 1745 decoder_thread_.message_loop()->PostTask( | 1745 decoder_thread_.task_runner()->PostTask( |
| 1746 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::ServiceDeviceTask, | 1746 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::ServiceDeviceTask, |
| 1747 base::Unretained(this), event_pending)); | 1747 base::Unretained(this), event_pending)); |
| 1748 } | 1748 } |
| 1749 | 1749 |
| 1750 void V4L2VideoDecodeAccelerator::NotifyError(Error error) { | 1750 void V4L2VideoDecodeAccelerator::NotifyError(Error error) { |
| 1751 DVLOGF(2); | 1751 DVLOGF(2); |
| 1752 | 1752 |
| 1753 if (!child_task_runner_->BelongsToCurrentThread()) { | 1753 if (!child_task_runner_->BelongsToCurrentThread()) { |
| 1754 child_task_runner_->PostTask( | 1754 child_task_runner_->PostTask( |
| 1755 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::NotifyError, | 1755 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::NotifyError, |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2167 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 2167 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 2168 DVLOGF(3); | 2168 DVLOGF(3); |
| 2169 | 2169 |
| 2170 if (!DestroyOutputBuffers()) { | 2170 if (!DestroyOutputBuffers()) { |
| 2171 LOGF(ERROR) << "Failed destroying output buffers."; | 2171 LOGF(ERROR) << "Failed destroying output buffers."; |
| 2172 NOTIFY_ERROR(PLATFORM_FAILURE); | 2172 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 2173 return; | 2173 return; |
| 2174 } | 2174 } |
| 2175 | 2175 |
| 2176 // Finish resolution change on decoder thread. | 2176 // Finish resolution change on decoder thread. |
| 2177 decoder_thread_.message_loop()->PostTask( | 2177 decoder_thread_.task_runner()->PostTask( |
| 2178 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::FinishResolutionChange, | 2178 FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::FinishResolutionChange, |
| 2179 base::Unretained(this))); | 2179 base::Unretained(this))); |
| 2180 } | 2180 } |
| 2181 | 2181 |
| 2182 void V4L2VideoDecodeAccelerator::SendPictureReady() { | 2182 void V4L2VideoDecodeAccelerator::SendPictureReady() { |
| 2183 DVLOGF(3); | 2183 DVLOGF(3); |
| 2184 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); | 2184 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
| 2185 bool resetting_or_flushing = | 2185 bool resetting_or_flushing = |
| 2186 (decoder_state_ == kResetting || decoder_flushing_); | 2186 (decoder_state_ == kResetting || decoder_flushing_); |
| 2187 while (pending_picture_ready_.size() > 0) { | 2187 while (pending_picture_ready_.size() > 0) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2271 Enqueue(); | 2271 Enqueue(); |
| 2272 } | 2272 } |
| 2273 } | 2273 } |
| 2274 | 2274 |
| 2275 void V4L2VideoDecodeAccelerator::ImageProcessorError() { | 2275 void V4L2VideoDecodeAccelerator::ImageProcessorError() { |
| 2276 LOGF(ERROR) << "Image processor error"; | 2276 LOGF(ERROR) << "Image processor error"; |
| 2277 NOTIFY_ERROR(PLATFORM_FAILURE); | 2277 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 2278 } | 2278 } |
| 2279 | 2279 |
| 2280 } // namespace media | 2280 } // namespace media |
| OLD | NEW |