Chromium Code Reviews| 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 "media/base/bitstream_buffer.h" | |
| 15 #include "media/gpu/media_gpu_export.h" | |
| 16 #include "media/video/jpeg_decode_accelerator.h" | |
| 17 | |
| 18 namespace base { | |
| 19 class SingleThreadTaskRunner; | |
| 20 } | |
| 21 | |
| 22 namespace media { | |
| 23 | |
| 24 // Uses software-based decoding. The purpose of this class is to enable testing | |
| 25 // of communication to the JpegDecodeAccelerator without requiring an actual | |
| 26 // hardware decoder. | |
| 27 class MEDIA_GPU_EXPORT FakeJpegDecodeAccelerator | |
| 28 : public JpegDecodeAccelerator { | |
| 29 public: | |
| 30 FakeJpegDecodeAccelerator( | |
| 31 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | |
| 32 ~FakeJpegDecodeAccelerator() override; | |
| 33 | |
| 34 // JpegDecodeAccelerator implementation. | |
| 35 bool Initialize(JpegDecodeAccelerator::Client* client) override; | |
| 36 void Decode(const BitstreamBuffer& bitstream_buffer, | |
| 37 const scoped_refptr<VideoFrame>& video_frame) override; | |
| 38 bool IsSupported() override; | |
| 39 | |
| 40 private: | |
| 41 void NotifyError(int32_t bitstream_buffer_id, Error error); | |
| 42 void NotifyErrorOnClientThread(int32_t bitstream_buffer_id, Error error); | |
| 43 void OnDecodeDoneOnClientThread(int32_t input_buffer_id); | |
| 44 | |
| 45 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
|
emircan
2017/03/09 23:44:25
Is this supposed to be GPU main thread task runner
chfremer
2017/03/10 18:30:49
Done.
| |
| 46 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
| 47 Client* client_ = nullptr; | |
| 48 | |
| 49 base::WeakPtrFactory<FakeJpegDecodeAccelerator> weak_factory_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(FakeJpegDecodeAccelerator); | |
| 52 }; | |
| 53 | |
| 54 } // namespace media | |
| 55 | |
| 56 #endif // MEDIA_GPU_FAKE_JPEG_DECODE_ACCELERATOR_H_ | |
| OLD | NEW |