OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_GPU_FAKE_JPEG_DECODE_ACCELERATOR_H_ | |
6 #define MEDIA_GPU_FAKE_JPEG_DECODE_ACCELERATOR_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | |
11 | |
12 #include "base/macros.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "base/single_thread_task_runner.h" | |
15 #include "media/base/bitstream_buffer.h" | |
16 #include "media/gpu/media_gpu_export.h" | |
17 #include "media/video/jpeg_decode_accelerator.h" | |
18 | |
19 namespace media { | |
20 | |
21 // Uses software-based decoding. The purpose of this class is to enable testing | |
22 // of communication to the JpegDecodeAccelerator without requiring an actual | |
23 // hardware decoder. | |
24 class MEDIA_GPU_EXPORT FakeJpegDecodeAccelerator | |
25 : public JpegDecodeAccelerator { | |
26 public: | |
27 FakeJpegDecodeAccelerator( | |
28 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | |
29 ~FakeJpegDecodeAccelerator() override; | |
30 | |
31 // JpegDecodeAccelerator implementation. | |
32 bool Initialize(JpegDecodeAccelerator::Client* client) override; | |
33 void Decode(const BitstreamBuffer& bitstream_buffer, | |
34 const scoped_refptr<VideoFrame>& video_frame) override; | |
35 bool IsSupported() override; | |
36 | |
37 private: | |
38 void NotifyErrorFromIoThread(int32_t bitstream_buffer_id, Error error); | |
39 void OnNotifyErrorOnClientThread(int32_t bitstream_buffer_id, Error error); | |
40 void OnDecodeDoneOnClientThread(int32_t input_buffer_id); | |
41 | |
42 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
mcasas
2017/03/07 19:39:38
nit: Forward declare SingleThreadTaskRunner
chfremer
2017/03/07 22:30:38
Done.
| |
43 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
44 Client* client_ = nullptr; | |
45 | |
46 base::WeakPtrFactory<FakeJpegDecodeAccelerator> weak_factory_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(FakeJpegDecodeAccelerator); | |
49 }; | |
50 | |
51 } // namespace media | |
52 | |
53 #endif // MEDIA_GPU_FAKE_JPEG_DECODE_ACCELERATOR_H_ | |
OLD | NEW |