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