Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: media/gpu/fake_jpeg_decode_accelerator.h

Issue 2772963002: Reland [Mojo Video Capture] Add test coverage for accelerated jpeg decoding (Closed)
Patch Set: Rebase to March 30 Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/gpu/BUILD.gn ('k') | media/gpu/fake_jpeg_decode_accelerator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/threading/thread.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 base {
20 class SingleThreadTaskRunner;
21 }
22
23 namespace media {
24
25 class SharedMemoryRegion;
26
27 // Uses software-based decoding. The purpose of this class is to enable testing
28 // of communication to the JpegDecodeAccelerator without requiring an actual
29 // hardware decoder.
30 class MEDIA_GPU_EXPORT FakeJpegDecodeAccelerator
31 : public JpegDecodeAccelerator {
32 public:
33 FakeJpegDecodeAccelerator(
34 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
35 ~FakeJpegDecodeAccelerator() override;
36
37 // JpegDecodeAccelerator implementation.
38 bool Initialize(JpegDecodeAccelerator::Client* client) override;
39 void Decode(const BitstreamBuffer& bitstream_buffer,
40 const scoped_refptr<VideoFrame>& video_frame) override;
41 bool IsSupported() override;
42
43 private:
44 void DecodeOnDecoderThread(const BitstreamBuffer& bitstream_buffer,
45 const scoped_refptr<VideoFrame>& video_frame,
46 std::unique_ptr<SharedMemoryRegion> src_shm);
47 void NotifyError(int32_t bitstream_buffer_id, Error error);
48 void NotifyErrorOnClientThread(int32_t bitstream_buffer_id, Error error);
49 void OnDecodeDoneOnClientThread(int32_t input_buffer_id);
50
51 // Task runner for calls to |client_|.
52 const scoped_refptr<base::SingleThreadTaskRunner> client_task_runner_;
53
54 // GPU IO task runner.
55 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
56
57 Client* client_ = nullptr;
58
59 base::Thread decoder_thread_;
60 scoped_refptr<base::SingleThreadTaskRunner> decoder_task_runner_;
61
62 base::WeakPtrFactory<FakeJpegDecodeAccelerator> weak_factory_;
63
64 DISALLOW_COPY_AND_ASSIGN(FakeJpegDecodeAccelerator);
65 };
66
67 } // namespace media
68
69 #endif // MEDIA_GPU_FAKE_JPEG_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « media/gpu/BUILD.gn ('k') | media/gpu/fake_jpeg_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698