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

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

Issue 1846253003: Revert of Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "content/common/gpu/gpu_command_buffer_stub.h"
16 #include "gpu/config/gpu_info.h" 17 #include "gpu/config/gpu_info.h"
17 #include "gpu/ipc/service/gpu_command_buffer_stub.h"
18 #include "ipc/ipc_listener.h" 18 #include "ipc/ipc_listener.h"
19 #include "media/video/video_encode_accelerator.h" 19 #include "media/video/video_encode_accelerator.h"
20 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
21 21
22 struct AcceleratedVideoEncoderMsg_Encode_Params; 22 struct AcceleratedVideoEncoderMsg_Encode_Params;
23 struct AcceleratedVideoEncoderMsg_Encode_Params2; 23 struct AcceleratedVideoEncoderMsg_Encode_Params2;
24 24
25 namespace base { 25 namespace base {
26 class SharedMemory; 26 class SharedMemory;
27 } // namespace base 27 } // namespace base
28 28
29 namespace gpu { 29 namespace gpu {
30 struct GpuPreferences; 30 struct GpuPreferences;
31 } // namespace gpu 31 } // namespace gpu
32 32
33 namespace content { 33 namespace content {
34 34
35 // This class encapsulates the GPU process view of a VideoEncodeAccelerator, 35 // This class encapsulates the GPU process view of a VideoEncodeAccelerator,
36 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles 36 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles
37 // IPC coming in from the renderer and passes it to the underlying VEA. 37 // IPC coming in from the renderer and passes it to the underlying VEA.
38 class GpuVideoEncodeAccelerator 38 class GpuVideoEncodeAccelerator
39 : public IPC::Listener, 39 : public IPC::Listener,
40 public media::VideoEncodeAccelerator::Client, 40 public media::VideoEncodeAccelerator::Client,
41 public gpu::GpuCommandBufferStub::DestructionObserver { 41 public GpuCommandBufferStub::DestructionObserver {
42 public: 42 public:
43 GpuVideoEncodeAccelerator(int32_t host_route_id, 43 GpuVideoEncodeAccelerator(int32_t host_route_id, GpuCommandBufferStub* stub);
44 gpu::GpuCommandBufferStub* stub);
45 ~GpuVideoEncodeAccelerator() override; 44 ~GpuVideoEncodeAccelerator() override;
46 45
47 // Initialize this accelerator with the given parameters and send 46 // Initialize this accelerator with the given parameters and send
48 // |init_done_msg| when complete. 47 // |init_done_msg| when complete.
49 bool Initialize(media::VideoPixelFormat input_format, 48 bool Initialize(media::VideoPixelFormat input_format,
50 const gfx::Size& input_visible_size, 49 const gfx::Size& input_visible_size,
51 media::VideoCodecProfile output_profile, 50 media::VideoCodecProfile output_profile,
52 uint32_t initial_bitrate); 51 uint32_t initial_bitrate);
53 52
54 // IPC::Listener implementation 53 // IPC::Listener implementation
55 bool OnMessageReceived(const IPC::Message& message) override; 54 bool OnMessageReceived(const IPC::Message& message) override;
56 55
57 // media::VideoEncodeAccelerator::Client implementation. 56 // media::VideoEncodeAccelerator::Client implementation.
58 void RequireBitstreamBuffers(unsigned int input_count, 57 void RequireBitstreamBuffers(unsigned int input_count,
59 const gfx::Size& input_coded_size, 58 const gfx::Size& input_coded_size,
60 size_t output_buffer_size) override; 59 size_t output_buffer_size) override;
61 void BitstreamBufferReady(int32_t bitstream_buffer_id, 60 void BitstreamBufferReady(int32_t bitstream_buffer_id,
62 size_t payload_size, 61 size_t payload_size,
63 bool key_frame) override; 62 bool key_frame) override;
64 void NotifyError(media::VideoEncodeAccelerator::Error error) override; 63 void NotifyError(media::VideoEncodeAccelerator::Error error) override;
65 64
66 // gpu::GpuCommandBufferStub::DestructionObserver implementation. 65 // GpuCommandBufferStub::DestructionObserver implementation.
67 void OnWillDestroyStub() override; 66 void OnWillDestroyStub() override;
68 67
69 // Static query for supported profiles. This query calls the appropriate 68 // Static query for supported profiles. This query calls the appropriate
70 // platform-specific version. The returned supported profiles vector will 69 // platform-specific version. The returned supported profiles vector will
71 // not contain duplicates. 70 // not contain duplicates.
72 static gpu::VideoEncodeAcceleratorSupportedProfiles GetSupportedProfiles( 71 static gpu::VideoEncodeAcceleratorSupportedProfiles GetSupportedProfiles(
73 const gpu::GpuPreferences& gpu_preferences); 72 const gpu::GpuPreferences& gpu_preferences);
74 73
75 private: 74 private:
76 typedef scoped_ptr<media::VideoEncodeAccelerator>(*CreateVEAFp)(); 75 typedef scoped_ptr<media::VideoEncodeAccelerator>(*CreateVEAFp)();
(...skipping 28 matching lines...) Expand all
105 104
106 void EncodeFrameFinished(int32_t frame_id, 105 void EncodeFrameFinished(int32_t frame_id,
107 scoped_ptr<base::SharedMemory> shm); 106 scoped_ptr<base::SharedMemory> shm);
108 void EncodeFrameFinished2(int32_t frame_id, 107 void EncodeFrameFinished2(int32_t frame_id,
109 ScopedVector<gfx::GpuMemoryBuffer> buffers); 108 ScopedVector<gfx::GpuMemoryBuffer> buffers);
110 void Send(IPC::Message* message); 109 void Send(IPC::Message* message);
111 110
112 // Route ID to communicate with the host. 111 // Route ID to communicate with the host.
113 const uint32_t host_route_id_; 112 const uint32_t host_route_id_;
114 113
115 // Unowned pointer to the underlying gpu::GpuCommandBufferStub. |this| is 114 // Unowned pointer to the underlying GpuCommandBufferStub. |this| is
116 // registered as a DestuctionObserver of |stub_| and will self-delete when 115 // registered as a DestuctionObserver of |stub_| and will self-delete when
117 // |stub_| is destroyed. 116 // |stub_| is destroyed.
118 gpu::GpuCommandBufferStub* const stub_; 117 GpuCommandBufferStub* const stub_;
119 118
120 // Owned pointer to the underlying VideoEncodeAccelerator. 119 // Owned pointer to the underlying VideoEncodeAccelerator.
121 scoped_ptr<media::VideoEncodeAccelerator> encoder_; 120 scoped_ptr<media::VideoEncodeAccelerator> encoder_;
122 base::Callback<bool(void)> make_context_current_; 121 base::Callback<bool(void)> make_context_current_;
123 122
124 // Video encoding parameters. 123 // Video encoding parameters.
125 media::VideoPixelFormat input_format_; 124 media::VideoPixelFormat input_format_;
126 gfx::Size input_visible_size_; 125 gfx::Size input_visible_size_;
127 gfx::Size input_coded_size_; 126 gfx::Size input_coded_size_;
128 size_t output_buffer_size_; 127 size_t output_buffer_size_;
129 128
130 // Weak pointer for media::VideoFrames that refer back to |this|. 129 // Weak pointer for media::VideoFrames that refer back to |this|.
131 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; 130 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_;
132 131
133 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); 132 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator);
134 }; 133 };
135 134
136 } // namespace content 135 } // namespace content
137 136
138 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ 137 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « content/common/gpu/media/gpu_video_decode_accelerator.cc ('k') | content/common/gpu/media/gpu_video_encode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698