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

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: fix many thread issues 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_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
7
8 #include <map>
9 #include <vector>
10
11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/non_thread_safe.h"
13 #include "ipc/ipc_listener.h"
14 #include "media/video/jpeg_decode_accelerator.h"
15 #include "ui/gfx/geometry/size.h"
16
17 namespace content {
18 class GpuChannelHost;
19
20 // This class is used to talk to JpegDecodeAccelerator in the GPU process
21 // through IPC messages.
22 class GpuJpegDecodeAcceleratorHost
23 : public IPC::Listener,
24 public media::JpegDecodeAccelerator,
25 public base::NonThreadSafe,
26 public base::SupportsWeakPtr<GpuJpegDecodeAcceleratorHost> {
27 public:
28 // |this| is guaranteed not to outlive |channel|. (See comments for
29 // |channel_|.)
30 GpuJpegDecodeAcceleratorHost(GpuChannelHost* channel, int32 route_id);
31
32 // IPC::Listener implementation.
33 void OnChannelError() override;
34 bool OnMessageReceived(const IPC::Message& message) override;
35
36 // media::JpegDecodeAccelerator implementation.
37 bool Initialize(
38 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 // Notify |client_| of an error. Posts a task to avoid re-entrancy.
48 void PostNotifyError(int32_t bitstream_buffer_id, Error error);
49
50 void Send(IPC::Message* message);
51
52 void OnVideoFrameReady(int32_t bitstream_buffer_id);
53 void OnNotifyError(int32_t bitstream_buffer_id, Error error);
54
55 // Unowned reference to the GpuChannelHost to send IPC messages to the GPU
56 // process. |channel_| is always valid as long as it is not NULL.
57 GpuChannelHost* channel_;
58
59 Client* client_;
60
61 // Route ID for the associated decoder in the GPU process.
62 int32 decoder_route_id_;
63
64 // WeakPtr factory for posting tasks back to itself.
65 base::WeakPtrFactory<GpuJpegDecodeAcceleratorHost> weak_this_factory_;
66
67 DISALLOW_COPY_AND_ASSIGN(GpuJpegDecodeAcceleratorHost);
68 };
69
70 } // namespace content
71
72 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698