Index: media/gpu/fake_jpeg_decode_accelerator.h |
diff --git a/media/gpu/fake_jpeg_decode_accelerator.h b/media/gpu/fake_jpeg_decode_accelerator.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8dd4311071335318e83bafcc0300eaf77311d0c4 |
--- /dev/null |
+++ b/media/gpu/fake_jpeg_decode_accelerator.h |
@@ -0,0 +1,53 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_GPU_FAKE_JPEG_DECODE_ACCELERATOR_H_ |
+#define MEDIA_GPU_FAKE_JPEG_DECODE_ACCELERATOR_H_ |
+ |
+#include <stdint.h> |
+ |
+#include <memory> |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/single_thread_task_runner.h" |
+#include "media/base/bitstream_buffer.h" |
+#include "media/gpu/media_gpu_export.h" |
+#include "media/video/jpeg_decode_accelerator.h" |
+ |
+namespace media { |
+ |
+// Uses software-based decoding. The purpose of this class is to enable testing |
+// of communication to the JpegDecodeAccelerator without requiring an actual |
+// hardware decoder. |
+class MEDIA_GPU_EXPORT FakeJpegDecodeAccelerator |
+ : public JpegDecodeAccelerator { |
+ public: |
+ FakeJpegDecodeAccelerator( |
+ const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
+ ~FakeJpegDecodeAccelerator() override; |
+ |
+ // JpegDecodeAccelerator implementation. |
+ bool Initialize(JpegDecodeAccelerator::Client* client) override; |
+ void Decode(const BitstreamBuffer& bitstream_buffer, |
+ const scoped_refptr<VideoFrame>& video_frame) override; |
+ bool IsSupported() override; |
+ |
+ private: |
+ void NotifyErrorFromIoThread(int32_t bitstream_buffer_id, Error error); |
+ void OnNotifyErrorOnClientThread(int32_t bitstream_buffer_id, Error error); |
+ void OnDecodeDoneOnClientThread(int32_t input_buffer_id); |
+ |
+ 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.
|
+ const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
+ Client* client_ = nullptr; |
+ |
+ base::WeakPtrFactory<FakeJpegDecodeAccelerator> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FakeJpegDecodeAccelerator); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_GPU_FAKE_JPEG_DECODE_ACCELERATOR_H_ |