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

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

Powered by Google App Engine
This is Rietveld 408576698