blob: 53465f3aee75fa5a01887e50b7509ef67fdf477a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
#define CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
#include <stdint.h>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "media/video/jpeg_decode_accelerator.h"
namespace base {
class SingleThreadTaskRunner;
}
namespace IPC {
class Listener;
class Message;
}
namespace content {
class GpuChannelHost;
// This class is used to talk to JpegDecodeAccelerator in the GPU process
// through IPC messages.
class GpuJpegDecodeAcceleratorHost : public media::JpegDecodeAccelerator,
public base::NonThreadSafe {
public:
// VideoCaptureGpuJpegDecoder owns |this| and |channel|. And
// VideoCaptureGpuJpegDecoder delete |this| before |channel|. So |this| is
// guaranteed not to outlive |channel|.
GpuJpegDecodeAcceleratorHost(
GpuChannelHost* channel,
int32_t route_id,
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
~GpuJpegDecodeAcceleratorHost() override;
// media::JpegDecodeAccelerator implementation.
// |client| is called on the IO thread, but is never called into after the
// GpuJpegDecodeAcceleratorHost is destroyed.
bool Initialize(media::JpegDecodeAccelerator::Client* client) override;
void Decode(const media::BitstreamBuffer& bitstream_buffer,
const scoped_refptr<media::VideoFrame>& video_frame) override;
bool IsSupported() override;
base::WeakPtr<IPC::Listener> GetReceiver();
private:
class Receiver;
void Send(IPC::Message* message);
// Unowned reference to the GpuChannelHost to send IPC messages to the GPU
// process.
GpuChannelHost* channel_;
// Route ID for the associated decoder in the GPU process.
int32_t decoder_route_id_;
// GPU IO task runner.
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
scoped_ptr<Receiver> receiver_;
DISALLOW_COPY_AND_ASSIGN(GpuJpegDecodeAcceleratorHost);
};
} // namespace content
#endif // CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
|