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

Side by Side Diff: content/common/gpu/media/gpu_jpeg_decode_accelerator.h

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address most comments Created 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/shared_memory.h"
11 #include "base/synchronization/waitable_event.h"
12 #include "ipc/ipc_listener.h"
13 #include "ipc/ipc_sender.h"
14 #include "media/video/jpeg_decode_accelerator.h"
15
16 struct AcceleratedJpegDecoderMsg_Decode_Params;
17
18 namespace base {
19 class MessageLoopProxy;
20 }
21
22 namespace content {
23 class GpuChannel;
24
25 class GpuJpegDecodeAccelerator : public IPC::Listener,
26 public IPC::Sender,
27 public media::JpegDecodeAccelerator::Client {
28 public:
29 // Each of the arguments to the constructor must outlive this object.
wuchengli 2015/04/15 07:11:58 Just say "|channel| must outlive this object". |ho
kcwu 2015/04/16 14:38:28 Done.
30 GpuJpegDecodeAccelerator(
31 GpuChannel* channel,
32 int32 host_route_id,
33 const scoped_refptr<base::MessageLoopProxy>& io_message_loop);
34
35 void Destroy();
36
37 // IPC::Listener implementation.
38 bool OnMessageReceived(const IPC::Message& message) override;
39
40 // media::JpegDecodeAccelerator::Client implementation.
41 void VideoFrameReady(int32_t bitstream_buffer_id) override;
42 void NotifyError(int32_t bitstream_buffer_id,
43 media::JpegDecodeAccelerator::Error error) override;
44
45 // Function to delegate sending to actual sender.
46 bool Send(IPC::Message* message) override;
47
48 bool Initialize();
49
50 private:
51 ~GpuJpegDecodeAccelerator();
52 class MessageFilter;
53
54 // Handlers for IPC messages.
55 void OnDecode(const AcceleratedJpegDecoderMsg_Decode_Params& params);
56 void OnDestroy();
57
58 // Called on IO thread when |filter_| has been removed.
59 void OnFilterRemoved();
60
61 // The lifetime of objects of this class is managed by a GpuChannel. The
62 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they
wuchengli 2015/04/15 07:11:58 update the comment
kcwu 2015/04/20 17:47:59 Done.
63 // are destroyed. So a raw pointer is safe.
64 GpuChannel* channel_;
65
66 // Route ID to communicate with the host.
67 int32 host_route_id_;
68
69 // The underlying JpegDecodeAccelerator.
70 scoped_ptr<media::JpegDecodeAccelerator> jpeg_decode_accelerator_;
71
72 // The message filter to run JDA::Decode on IO thread.
73 scoped_refptr<MessageFilter> filter_;
74
75 // Used to wait on for |filter_| to be removed, before we can safely
76 // destroy the JDA.
77 base::WaitableEvent filter_removed_;
78
79 // GPU child message loop.
80 scoped_refptr<base::MessageLoopProxy> child_message_loop_;
81
82 // GPU IO message loop.
83 scoped_refptr<base::MessageLoopProxy> io_message_loop_;
84
85 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator);
86 };
87
88 } // namespace content
89
90 namespace base {
91
92 template <class T>
93 struct DefaultDeleter;
94
95 // Specialize DefaultDeleter so that scoped_ptr<GpuJpegDecodeAccelerator> always
96 // uses "Destroy()" instead of trying to use the destructor.
97 template <>
98 struct MEDIA_EXPORT DefaultDeleter<content::GpuJpegDecodeAccelerator> {
99 public:
100 void operator()(void* jpeg_decode_accelerator) const;
101 };
102
103 } // namespace base
104
105 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698