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

Side by Side Diff: media/gpu/ipc/service/gpu_video_encode_accelerator.h

Issue 2061823003: media: Drop "media::" in media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: work around clang format by adding an empty line Created 4 years, 6 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 MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_ 5 #ifndef MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_
6 #define MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_ 6 #define MEDIA_GPU_IPC_SERVICE_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
(...skipping 19 matching lines...) Expand all
30 struct GpuPreferences; 30 struct GpuPreferences;
31 } // namespace gpu 31 } // namespace gpu
32 32
33 namespace media { 33 namespace media {
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 VideoEncodeAccelerator::Client,
41 public gpu::GpuCommandBufferStub::DestructionObserver { 41 public gpu::GpuCommandBufferStub::DestructionObserver {
42 public: 42 public:
43 GpuVideoEncodeAccelerator(int32_t host_route_id, 43 GpuVideoEncodeAccelerator(int32_t host_route_id,
44 gpu::GpuCommandBufferStub* stub); 44 gpu::GpuCommandBufferStub* stub);
45 ~GpuVideoEncodeAccelerator() override; 45 ~GpuVideoEncodeAccelerator() override;
46 46
47 // Initialize this accelerator with the given parameters and send 47 // Initialize this accelerator with the given parameters and send
48 // |init_done_msg| when complete. 48 // |init_done_msg| when complete.
49 bool Initialize(media::VideoPixelFormat input_format, 49 bool Initialize(VideoPixelFormat input_format,
50 const gfx::Size& input_visible_size, 50 const gfx::Size& input_visible_size,
51 media::VideoCodecProfile output_profile, 51 VideoCodecProfile output_profile,
52 uint32_t initial_bitrate); 52 uint32_t initial_bitrate);
53 53
54 // IPC::Listener implementation 54 // IPC::Listener implementation
55 bool OnMessageReceived(const IPC::Message& message) override; 55 bool OnMessageReceived(const IPC::Message& message) override;
56 56
57 // media::VideoEncodeAccelerator::Client implementation. 57 // VideoEncodeAccelerator::Client implementation.
58 void RequireBitstreamBuffers(unsigned int input_count, 58 void RequireBitstreamBuffers(unsigned int input_count,
59 const gfx::Size& input_coded_size, 59 const gfx::Size& input_coded_size,
60 size_t output_buffer_size) override; 60 size_t output_buffer_size) override;
61 void BitstreamBufferReady(int32_t bitstream_buffer_id, 61 void BitstreamBufferReady(int32_t bitstream_buffer_id,
62 size_t payload_size, 62 size_t payload_size,
63 bool key_frame, 63 bool key_frame,
64 base::TimeDelta timestamp) override; 64 base::TimeDelta timestamp) override;
65 void NotifyError(media::VideoEncodeAccelerator::Error error) override; 65 void NotifyError(VideoEncodeAccelerator::Error error) override;
66 66
67 // gpu::GpuCommandBufferStub::DestructionObserver implementation. 67 // gpu::GpuCommandBufferStub::DestructionObserver implementation.
68 void OnWillDestroyStub() override; 68 void OnWillDestroyStub() override;
69 69
70 // Static query for supported profiles. This query calls the appropriate 70 // Static query for supported profiles. This query calls the appropriate
71 // platform-specific version. The returned supported profiles vector will 71 // platform-specific version. The returned supported profiles vector will
72 // not contain duplicates. 72 // not contain duplicates.
73 static gpu::VideoEncodeAcceleratorSupportedProfiles GetSupportedProfiles( 73 static gpu::VideoEncodeAcceleratorSupportedProfiles GetSupportedProfiles(
74 const gpu::GpuPreferences& gpu_preferences); 74 const gpu::GpuPreferences& gpu_preferences);
75 75
76 private: 76 private:
77 typedef std::unique_ptr<media::VideoEncodeAccelerator> (*CreateVEAFp)(); 77 typedef std::unique_ptr<VideoEncodeAccelerator> (*CreateVEAFp)();
78 78
79 // Return a set of VEA Create function pointers applicable to the current 79 // Return a set of VEA Create function pointers applicable to the current
80 // platform. 80 // platform.
81 static std::vector<CreateVEAFp> CreateVEAFps( 81 static std::vector<CreateVEAFp> CreateVEAFps(
82 const gpu::GpuPreferences& gpu_preferences); 82 const gpu::GpuPreferences& gpu_preferences);
83 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) 83 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
84 static std::unique_ptr<media::VideoEncodeAccelerator> CreateV4L2VEA(); 84 static std::unique_ptr<VideoEncodeAccelerator> CreateV4L2VEA();
85 #endif 85 #endif
86 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) 86 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
87 static std::unique_ptr<media::VideoEncodeAccelerator> CreateVaapiVEA(); 87 static std::unique_ptr<VideoEncodeAccelerator> CreateVaapiVEA();
88 #endif 88 #endif
89 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) 89 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
90 static std::unique_ptr<media::VideoEncodeAccelerator> CreateAndroidVEA(); 90 static std::unique_ptr<VideoEncodeAccelerator> CreateAndroidVEA();
91 #endif 91 #endif
92 #if defined(OS_MACOSX) 92 #if defined(OS_MACOSX)
93 static std::unique_ptr<media::VideoEncodeAccelerator> CreateVTVEA(); 93 static std::unique_ptr<VideoEncodeAccelerator> CreateVTVEA();
94 #endif 94 #endif
95 95
96 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer 96 // IPC handlers, proxying VideoEncodeAccelerator for the renderer
97 // process. 97 // process.
98 void OnEncode(const AcceleratedVideoEncoderMsg_Encode_Params& params); 98 void OnEncode(const AcceleratedVideoEncoderMsg_Encode_Params& params);
99 void OnEncode2(const AcceleratedVideoEncoderMsg_Encode_Params2& params); 99 void OnEncode2(const AcceleratedVideoEncoderMsg_Encode_Params2& params);
100 void OnUseOutputBitstreamBuffer(int32_t buffer_id, 100 void OnUseOutputBitstreamBuffer(int32_t buffer_id,
101 base::SharedMemoryHandle buffer_handle, 101 base::SharedMemoryHandle buffer_handle,
102 uint32_t buffer_size); 102 uint32_t buffer_size);
103 void OnRequestEncodingParametersChange(uint32_t bitrate, uint32_t framerate); 103 void OnRequestEncodingParametersChange(uint32_t bitrate, uint32_t framerate);
104 104
105 void OnDestroy(); 105 void OnDestroy();
106 106
107 void EncodeFrameFinished(int32_t frame_id, 107 void EncodeFrameFinished(int32_t frame_id,
108 std::unique_ptr<base::SharedMemory> shm); 108 std::unique_ptr<base::SharedMemory> shm);
109 void Send(IPC::Message* message); 109 void Send(IPC::Message* message);
110 110
111 // Route ID to communicate with the host. 111 // Route ID to communicate with the host.
112 const uint32_t host_route_id_; 112 const uint32_t host_route_id_;
113 113
114 // Unowned pointer to the underlying gpu::GpuCommandBufferStub. |this| is 114 // Unowned pointer to the underlying gpu::GpuCommandBufferStub. |this| is
115 // registered as a DestuctionObserver of |stub_| and will self-delete when 115 // registered as a DestuctionObserver of |stub_| and will self-delete when
116 // |stub_| is destroyed. 116 // |stub_| is destroyed.
117 gpu::GpuCommandBufferStub* const stub_; 117 gpu::GpuCommandBufferStub* const stub_;
118 118
119 // Owned pointer to the underlying VideoEncodeAccelerator. 119 // Owned pointer to the underlying VideoEncodeAccelerator.
120 std::unique_ptr<media::VideoEncodeAccelerator> encoder_; 120 std::unique_ptr<VideoEncodeAccelerator> encoder_;
121 base::Callback<bool(void)> make_context_current_; 121 base::Callback<bool(void)> make_context_current_;
122 122
123 // Video encoding parameters. 123 // Video encoding parameters.
124 media::VideoPixelFormat input_format_; 124 VideoPixelFormat input_format_;
125 gfx::Size input_visible_size_; 125 gfx::Size input_visible_size_;
126 gfx::Size input_coded_size_; 126 gfx::Size input_coded_size_;
127 size_t output_buffer_size_; 127 size_t output_buffer_size_;
128 128
129 // Weak pointer for media::VideoFrames that refer back to |this|. 129 // Weak pointer for VideoFrames that refer back to |this|.
130 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; 130 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_;
131 131
132 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); 132 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator);
133 }; 133 };
134 134
135 } // namespace media 135 } // namespace media
136 136
137 #endif // MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_ 137 #endif // MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « media/gpu/ipc/service/gpu_video_decode_accelerator.cc ('k') | media/gpu/ipc/service/gpu_video_encode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698