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_VAAPI_JPEG_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_JPEG_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_JPEG_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_JPEG_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/common/gpu/media/shared_memory_region.h" |
15 #include "content/common/gpu/media/vaapi_jpeg_decoder.h" | 16 #include "content/common/gpu/media/vaapi_jpeg_decoder.h" |
16 #include "content/common/gpu/media/vaapi_wrapper.h" | 17 #include "content/common/gpu/media/vaapi_wrapper.h" |
17 #include "media/base/bitstream_buffer.h" | 18 #include "media/base/bitstream_buffer.h" |
18 #include "media/video/jpeg_decode_accelerator.h" | 19 #include "media/video/jpeg_decode_accelerator.h" |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 // Class to provide JPEG decode acceleration for Intel systems with hardware | 23 // Class to provide JPEG decode acceleration for Intel systems with hardware |
23 // support for it, and on which libva is available. | 24 // support for it, and on which libva is available. |
24 // Decoding tasks are performed in a separate decoding thread. | 25 // Decoding tasks are performed in a separate decoding thread. |
(...skipping 12 matching lines...) Expand all Loading... |
37 // media::JpegDecodeAccelerator implementation. | 38 // media::JpegDecodeAccelerator implementation. |
38 bool Initialize(media::JpegDecodeAccelerator::Client* client) override; | 39 bool Initialize(media::JpegDecodeAccelerator::Client* client) override; |
39 void Decode(const media::BitstreamBuffer& bitstream_buffer, | 40 void Decode(const media::BitstreamBuffer& bitstream_buffer, |
40 const scoped_refptr<media::VideoFrame>& video_frame) override; | 41 const scoped_refptr<media::VideoFrame>& video_frame) override; |
41 bool IsSupported() override; | 42 bool IsSupported() override; |
42 | 43 |
43 private: | 44 private: |
44 // An input buffer and the corresponding output video frame awaiting | 45 // An input buffer and the corresponding output video frame awaiting |
45 // consumption, provided by the client. | 46 // consumption, provided by the client. |
46 struct DecodeRequest { | 47 struct DecodeRequest { |
47 DecodeRequest(const media::BitstreamBuffer& bitstream_buffer, | 48 DecodeRequest(int32_t bitstream_buffer_id, |
48 scoped_ptr<base::SharedMemory> shm, | 49 scoped_ptr<SharedMemoryRegion> shm, |
49 const scoped_refptr<media::VideoFrame>& video_frame); | 50 const scoped_refptr<media::VideoFrame>& video_frame); |
50 ~DecodeRequest(); | 51 ~DecodeRequest(); |
51 | 52 |
52 media::BitstreamBuffer bitstream_buffer; | 53 int32_t bitstream_buffer_id; |
53 scoped_ptr<base::SharedMemory> shm; | 54 scoped_ptr<SharedMemoryRegion> shm; |
54 scoped_refptr<media::VideoFrame> video_frame; | 55 scoped_refptr<media::VideoFrame> video_frame; |
55 }; | 56 }; |
56 | 57 |
57 // Notifies the client that an error has occurred and decoding cannot | 58 // Notifies the client that an error has occurred and decoding cannot |
58 // continue. | 59 // continue. |
59 void NotifyError(int32_t bitstream_buffer_id, Error error); | 60 void NotifyError(int32_t bitstream_buffer_id, Error error); |
60 void NotifyErrorFromDecoderThread(int32_t bitstream_buffer_id, Error error); | 61 void NotifyErrorFromDecoderThread(int32_t bitstream_buffer_id, Error error); |
61 void VideoFrameReady(int32_t bitstream_buffer_id); | 62 void VideoFrameReady(int32_t bitstream_buffer_id); |
62 | 63 |
63 // Processes one decode |request|. | 64 // Processes one decode |request|. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 108 |
108 // The WeakPtrFactory for |weak_this_|. | 109 // The WeakPtrFactory for |weak_this_|. |
109 base::WeakPtrFactory<VaapiJpegDecodeAccelerator> weak_this_factory_; | 110 base::WeakPtrFactory<VaapiJpegDecodeAccelerator> weak_this_factory_; |
110 | 111 |
111 DISALLOW_COPY_AND_ASSIGN(VaapiJpegDecodeAccelerator); | 112 DISALLOW_COPY_AND_ASSIGN(VaapiJpegDecodeAccelerator); |
112 }; | 113 }; |
113 | 114 |
114 } // namespace content | 115 } // namespace content |
115 | 116 |
116 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_JPEG_DECODE_ACCELERATOR_H_ | 117 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_JPEG_DECODE_ACCELERATOR_H_ |
OLD | NEW |