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

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: fcfd089c More comments addressed. 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 #include "ui/gfx/size.h"
14
15 namespace base {
16
17 class SharedMemory;
18
19 } // namespace base
20
21 namespace content {
22
23 class GpuChannel;
24
25 // This class encapsulates the GPU process view of a VideoEncodeAccelerator,
26 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles
27 // IPC coming in from the renderer and passes it to the underlying VEA.
28 class GpuVideoEncodeAccelerator : public IPC::Listener,
29 public media::VideoEncodeAccelerator::Client {
30 public:
31 GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, int32 route_id);
32 virtual ~GpuVideoEncodeAccelerator();
33
34 // IPC::Listener implementation
35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
36 virtual void OnChannelError() OVERRIDE;
37
38 // media::VideoEncodeAccelerator::Client implementation.
39 virtual void NotifyInitializeDone() OVERRIDE;
40 virtual void RequireBitstreamBuffers(int input_count,
41 const gfx::Size& input_coded_size,
42 size_t output_buffer_size) 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 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer
58 // process.
59 void OnInitialize(media::VideoFrame::Format input_format,
60 const gfx::Size& input_visible_size,
61 media::VideoCodecProfile output_profile,
62 int32 initial_bitrate);
63 void OnEncode(int32 frame_id,
64 base::SharedMemoryHandle buffer_handle,
65 uint32 buffer_size,
66 bool force_keyframe);
67 void OnUseOutputBitstreamBuffer(int32 buffer_id,
68 base::SharedMemoryHandle buffer_handle,
69 uint32 buffer_size);
70 void OnRequestEncodingParameterChange(int32 bitrate);
71
72 void EncodeFrameFinished(int32 frame_id, scoped_ptr<base::SharedMemory> shm);
73
74 void Send(IPC::Message* message);
75
76 // The GpuChannel owns this GpuVideoEncodeAccelerator and will outlive |this|.
77 GpuChannel* channel_;
78 const int32 route_id_;
79
80 // Owned pointer to the underlying VideoEncodeAccelerator.
81 scoped_ptr<media::VideoEncodeAccelerator> encoder_;
82
83 // Video encoding parameters.
84 media::VideoFrame::Format input_format_;
85 gfx::Size input_visible_size_;
86 gfx::Size input_coded_size_;
87 size_t output_buffer_size_;
88
89 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator);
90 };
91
92 } // namespace content
93
94 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698