| OLD | NEW |
| 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 "media/gpu/v4l2_slice_video_decode_accelerator.h" | 5 #include "media/gpu/v4l2_slice_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <linux/videodev2.h> | 9 #include <linux/videodev2.h> |
| 10 #include <poll.h> | 10 #include <poll.h> |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 | 1831 |
| 1832 decoder_thread_task_runner_->PostTask( | 1832 decoder_thread_task_runner_->PostTask( |
| 1833 FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::FlushTask, | 1833 FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::FlushTask, |
| 1834 base::Unretained(this))); | 1834 base::Unretained(this))); |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 void V4L2SliceVideoDecodeAccelerator::FlushTask() { | 1837 void V4L2SliceVideoDecodeAccelerator::FlushTask() { |
| 1838 DVLOGF(3); | 1838 DVLOGF(3); |
| 1839 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); | 1839 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
| 1840 | 1840 |
| 1841 if (!decoder_input_queue_.empty()) { | 1841 // Queue an empty buffer which - when reached - will trigger flush sequence. |
| 1842 // We are not done with pending inputs, so queue an empty buffer, | 1842 decoder_input_queue_.push( |
| 1843 // which - when reached - will trigger flush sequence. | 1843 linked_ptr<BitstreamBufferRef>(new BitstreamBufferRef( |
| 1844 decoder_input_queue_.push( | 1844 decode_client_, decode_task_runner_, nullptr, kFlushBufferId))); |
| 1845 linked_ptr<BitstreamBufferRef>(new BitstreamBufferRef( | |
| 1846 decode_client_, decode_task_runner_, nullptr, kFlushBufferId))); | |
| 1847 return; | |
| 1848 } | |
| 1849 | 1845 |
| 1850 // No more inputs pending, so just finish flushing here. | 1846 ScheduleDecodeBufferTaskIfNeeded(); |
| 1851 InitiateFlush(); | |
| 1852 } | 1847 } |
| 1853 | 1848 |
| 1854 void V4L2SliceVideoDecodeAccelerator::InitiateFlush() { | 1849 void V4L2SliceVideoDecodeAccelerator::InitiateFlush() { |
| 1855 DVLOGF(3); | 1850 DVLOGF(3); |
| 1856 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); | 1851 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
| 1857 | 1852 |
| 1858 // This will trigger output for all remaining surfaces in the decoder. | 1853 // This will trigger output for all remaining surfaces in the decoder. |
| 1859 // However, not all of them may be decoded yet (they would be queued | 1854 // However, not all of them may be decoded yet (they would be queued |
| 1860 // in hardware then). | 1855 // in hardware then). |
| 1861 if (!decoder_->Flush()) { | 1856 if (!decoder_->Flush()) { |
| (...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2805 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 2800 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
| 2806 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 2801 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
| 2807 if (!device) | 2802 if (!device) |
| 2808 return SupportedProfiles(); | 2803 return SupportedProfiles(); |
| 2809 | 2804 |
| 2810 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 2805 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
| 2811 supported_input_fourccs_); | 2806 supported_input_fourccs_); |
| 2812 } | 2807 } |
| 2813 | 2808 |
| 2814 } // namespace media | 2809 } // namespace media |
| OLD | NEW |