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

Side by Side Diff: content/common/gpu/media/gpu_video_encode_accelerator.h

Issue 20632002: Add media::VideoEncodeAccelerator with WebRTC integration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@git-svn
Patch Set: d8fba33b Address comments, minus RTCVideoEncoder and media::VEA Created 7 years, 4 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 (c) 2013 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_VIDEO_ENCODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
7
8 #include <vector>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "ipc/ipc_listener.h"
12 #include "media/video/video_encode_accelerator.h"
13
14 namespace gfx {
15
16 class Size;
17
18 } // namespace gfx
19
20 namespace content {
21
22 class GpuChannel;
23
24 // This class encapsulates the GPU process view of a VideoEncodeAccelerator,
25 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles
26 // IPC coming in from the renderer and passes it to the underlying VEA.
27 class GpuVideoEncodeAccelerator : public IPC::Listener,
28 public media::VideoEncodeAccelerator::Client {
29 public:
30 GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, int32 route_id);
31 virtual ~GpuVideoEncodeAccelerator();
32
33 // IPC::Listener implementation
34 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
35 virtual void OnChannelError() OVERRIDE;
36
37 // media::VideoEncodeAccelerator::Client implementation.
38 virtual void NotifyInitializeDone() OVERRIDE;
39 virtual void RequireBitstreamBuffers(int input_count,
40 const gfx::Size& input_dimensions,
41 size_t output_size) OVERRIDE;
42 virtual void NotifyInputDone(int32 bitstream_buffer_id) OVERRIDE;
43 virtual void BitstreamBufferReady(int32 bitstream_buffer_id,
44 size_t payload_size,
45 bool key_frame) OVERRIDE;
46 virtual void NotifyError(media::VideoEncodeAccelerator::Error error) OVERRIDE;
47
48 // Static query for supported profiles. This query calls the appropriate
49 // platform-specific version.
50 static std::vector<media::VideoEncodeAccelerator::SupportedProfile>
51 GetSupportedProfiles();
52
53 private:
54 // Create the appropriate platform-specific VEA.
55 void CreateEncoder();
56
57 void Send(IPC::Message* message);
58
59 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer
60 // process.
61 void OnInitialize(media::VideoFrame::Format input_format,
62 const gfx::Size& input_resolution,
63 media::VideoCodecProfile output_profile,
64 int32 initial_bitrate);
65 void OnEncode(int32 buffer_id,
66 base::SharedMemoryHandle buffer_handle,
67 uint32 buffer_size,
68 bool force_keyframe);
69 void OnUseOutputBitstreamBuffer(int32 buffer_id,
70 base::SharedMemoryHandle buffer_handle,
71 uint32 buffer_size);
72 void OnRequestEncodingParameterChange(int32 bitrate);
73
74 // The GpuChannel owns this GpuVideoEncodeAccelerator and will outlive |this|.
75 GpuChannel* channel_;
76 const int32 route_id_;
77
78 // Owned pointer to the underlying VideoEncodeAccelerator.
79 scoped_ptr<media::VideoEncodeAccelerator> encoder_;
80
81 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator);
82 };
83
84 } // namespace content
85
86 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698