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 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/common/gpu/media/shared_memory_region.h" |
17 #include "content/common/gpu/media/v4l2_device.h" | 18 #include "content/common/gpu/media/v4l2_device.h" |
18 #include "media/base/bitstream_buffer.h" | 19 #include "media/base/bitstream_buffer.h" |
19 #include "media/base/video_frame.h" | 20 #include "media/base/video_frame.h" |
20 #include "media/video/jpeg_decode_accelerator.h" | 21 #include "media/video/jpeg_decode_accelerator.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 class CONTENT_EXPORT V4L2JpegDecodeAccelerator | 25 class CONTENT_EXPORT V4L2JpegDecodeAccelerator |
25 : public media::JpegDecodeAccelerator { | 26 : public media::JpegDecodeAccelerator { |
26 public: | 27 public: |
(...skipping 20 matching lines...) Expand all Loading... |
47 bool at_device; | 48 bool at_device; |
48 }; | 49 }; |
49 | 50 |
50 // Job record. Jobs are processed in a FIFO order. This is separate from | 51 // Job record. Jobs are processed in a FIFO order. This is separate from |
51 // BufferRecord of input, because a BufferRecord of input may be returned | 52 // BufferRecord of input, because a BufferRecord of input may be returned |
52 // before we dequeue the corresponding output buffer. It can't always be | 53 // before we dequeue the corresponding output buffer. It can't always be |
53 // associated with a BufferRecord of output immediately either, because at | 54 // associated with a BufferRecord of output immediately either, because at |
54 // the time of submission we may not have one available (and don't need one | 55 // the time of submission we may not have one available (and don't need one |
55 // to submit input to the device). | 56 // to submit input to the device). |
56 struct JobRecord { | 57 struct JobRecord { |
57 JobRecord(media::BitstreamBuffer bitstream_buffer, | 58 JobRecord(const media::BitstreamBuffer& bitstream_buffer, |
58 scoped_refptr<media::VideoFrame> video_frame); | 59 scoped_refptr<media::VideoFrame> video_frame); |
59 ~JobRecord(); | 60 ~JobRecord(); |
60 | 61 |
61 // Input image buffer. | 62 // Input image buffer ID. |
62 media::BitstreamBuffer bitstream_buffer; | 63 int32_t bitstream_buffer_id; |
| 64 // Memory mapped from |bitstream_buffer|. |
| 65 SharedMemoryRegion shm; |
63 // Output frame buffer. | 66 // Output frame buffer. |
64 scoped_refptr<media::VideoFrame> out_frame; | 67 scoped_refptr<media::VideoFrame> out_frame; |
65 // Memory mapped from |bitstream_buffer|. | |
66 scoped_ptr<base::SharedMemory> shm; | |
67 }; | 68 }; |
68 | 69 |
69 void EnqueueInput(); | 70 void EnqueueInput(); |
70 void EnqueueOutput(); | 71 void EnqueueOutput(); |
71 void Dequeue(); | 72 void Dequeue(); |
72 bool EnqueueInputRecord(); | 73 bool EnqueueInputRecord(); |
73 bool EnqueueOutputRecord(); | 74 bool EnqueueOutputRecord(); |
74 bool CreateInputBuffers(); | 75 bool CreateInputBuffers(); |
75 bool CreateOutputBuffers(); | 76 bool CreateOutputBuffers(); |
76 void DestroyInputBuffers(); | 77 void DestroyInputBuffers(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // Point to |this| for use in posting tasks from the decoder thread back to | 169 // Point to |this| for use in posting tasks from the decoder thread back to |
169 // the ChildThread. | 170 // the ChildThread. |
170 base::WeakPtr<V4L2JpegDecodeAccelerator> weak_ptr_; | 171 base::WeakPtr<V4L2JpegDecodeAccelerator> weak_ptr_; |
171 | 172 |
172 DISALLOW_COPY_AND_ASSIGN(V4L2JpegDecodeAccelerator); | 173 DISALLOW_COPY_AND_ASSIGN(V4L2JpegDecodeAccelerator); |
173 }; | 174 }; |
174 | 175 |
175 } // namespace content | 176 } // namespace content |
176 | 177 |
177 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ | 178 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ |
OLD | NEW |