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

Side by Side Diff: content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reuse VASurface Created 5 years, 7 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_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/non_thread_safe.h"
11 #include "ipc/ipc_listener.h"
12 #include "media/video/jpeg_decode_accelerator.h"
13 #include "ui/gfx/geometry/size.h"
14
15 namespace content {
16 class GpuChannelHost;
17
18 // This class is used to talk to JpegDecodeAccelerator in the GPU process
19 // through IPC messages.
20 class GpuJpegDecodeAcceleratorHost
21 : public IPC::Listener,
22 public media::JpegDecodeAccelerator,
23 public base::NonThreadSafe,
24 public base::SupportsWeakPtr<GpuJpegDecodeAcceleratorHost> {
25 public:
26 // |this| is guaranteed not to outlive |channel|. (See comments for
27 // |channel_|.)
28 GpuJpegDecodeAcceleratorHost(
29 GpuChannelHost* channel,
30 int32 route_id,
31 const scoped_refptr<base::MessageLoopProxy>& io_message_loop);
32
33 // IPC::Listener implementation.
34 void OnChannelError() override;
35 bool OnMessageReceived(const IPC::Message& message) override;
36
37 // media::JpegDecodeAccelerator implementation.
38 bool Initialize(media::JpegDecodeAccelerator::Client* client) override;
39 void Decode(const media::BitstreamBuffer& bitstream_buffer,
40 const scoped_refptr<media::VideoFrame>& video_frame) override;
41 void Destroy() override;
42
43 private:
44 // Only Destroy() should be deleting |this|.
45 ~GpuJpegDecodeAcceleratorHost() override;
46
47 // Post to IO thread to notify |client_| of an error.
48 void PostNotifyError(int32_t bitstream_buffer_id, Error error);
49
50 // Disconnects channel. No more IPC messages received after this call.
51 void DisconnectChannelOnIOThread();
52
53 void Send(IPC::Message* message);
54
55 void OnVideoFrameReady(int32_t bitstream_buffer_id);
56 void OnNotifyError(int32_t bitstream_buffer_id, Error error);
57
58 // Guards |channel_|.
59 base::Lock channel_lock_;
60
61 // Unowned reference to the GpuChannelHost to send IPC messages to the GPU
62 // process. |channel_| is always valid as long as it is not NULL.
63 GpuChannelHost* channel_;
64
65 // Used to wait on for avoiding more incoming IPC messages, before we can
66 // safely delete |this|.
67 base::WaitableEvent channel_disconnected_;
68
69 Client* client_;
70
71 // Route ID for the associated decoder in the GPU process.
72 int32 decoder_route_id_;
73
74 // IO message loop. Used for thread checking.
75 const scoped_refptr<base::MessageLoopProxy> io_message_loop_;
76
77 // WeakPtr factory for posting tasks back to itself.
78 base::WeakPtrFactory<GpuJpegDecodeAcceleratorHost> weak_this_factory_;
79
80 DISALLOW_COPY_AND_ASSIGN(GpuJpegDecodeAcceleratorHost);
81 };
82
83 } // namespace content
84
85 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698