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

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: fix coded size, shm handle Created 5 years, 9 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 <map>
9 #include <vector>
10
11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/shared_memory.h"
14 #include "base/synchronization/waitable_event.h"
15 #include "ipc/ipc_listener.h"
16 #include "ipc/ipc_sender.h"
17 #include "media/video/jpeg_decode_accelerator.h"
18 #include "ui/gfx/geometry/size.h"
19
20 struct AcceleratedJpegDecoderMsg_Decode_Params;
21
22 namespace base {
23 class MessageLoopProxy;
24 }
25
26 namespace content {
27 class GpuChannel;
28
29 class GpuJpegDecodeAccelerator
30 : public IPC::Listener,
31 public IPC::Sender,
32 public media::JpegDecodeAccelerator::Client {
33 public:
34 // Each of the arguments to the constructor must outlive this object.
35 // |stub->decoder()| will be made current around any operation that touches
36 // the underlying VDA so that it can make GL calls safely.
37 GpuJpegDecodeAccelerator(
38 GpuChannel* channel,
39 int32 host_route_id,
40 const scoped_refptr<base::MessageLoopProxy>& io_message_loop);
41
42 // IPC::Listener implementation.
43 bool OnMessageReceived(const IPC::Message& message) override;
44
45 // media::JpegDecodeAccelerator::Client implementation.
46 void VideoFrameReady(int32_t bitstream_buffer_id) override;
47 void NotifyError(int32_t bitstream_buffer_id,
48 media::JpegDecodeAccelerator::Error error) override;
49
50
51 // Function to delegate sending to actual sender.
52 bool Send(IPC::Message* message) override;
53
54 bool Initialize();
55
56 private:
57 class MessageFilter;
58
59 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there.
60 ~GpuJpegDecodeAccelerator() override;
61
62 // Handlers for IPC messages.
63 void OnDecode(const AcceleratedJpegDecoderMsg_Decode_Params& params);
64 void OnDestroy();
65
66
67 // Called on IO thread when |filter_| has been removed.
68 void OnFilterRemoved();
69
70 // The lifetime of objects of this class is managed by a GpuChannel. The
71 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they
72 // are destroyed. So a raw pointer is safe.
73 GpuChannel* channel_;
74
75 // Route ID to communicate with the host.
76 int32 host_route_id_;
77
78 // The underlying JpegDecodeAccelerator.
79 scoped_ptr<media::JpegDecodeAccelerator> jpeg_decode_accelerator_;
80
81 // The message filter to run VDA::Decode on IO thread if VDA supports it.
wuchengli 2015/03/23 06:30:15 update the comment
kcwu 2015/04/14 20:02:34 Done.
82 scoped_refptr<MessageFilter> filter_;
83
84 // Used to wait on for |filter_| to be removed, before we can safely
85 // destroy the VDA.
86 base::WaitableEvent filter_removed_;
87
88 // GPU child message loop.
89 scoped_refptr<base::MessageLoopProxy> child_message_loop_;
90
91 // GPU IO message loop.
92 scoped_refptr<base::MessageLoopProxy> io_message_loop_;
93
94 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator);
95 };
96
97 } // namespace content
98
99 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698