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

Side by Side Diff: content/renderer/pepper/pepper_video_encoder_host.h

Issue 1864723003: Make lost context and error message callbacks on GpuControl go to client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: errorcallback: gputestexpect 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "gpu/command_buffer/client/gpu_control_client.h"
16 #include "media/video/video_encode_accelerator.h" 17 #include "media/video/video_encode_accelerator.h"
17 #include "ppapi/c/pp_codecs.h" 18 #include "ppapi/c/pp_codecs.h"
18 #include "ppapi/c/ppb_video_frame.h" 19 #include "ppapi/c/ppb_video_frame.h"
19 #include "ppapi/host/host_message_context.h" 20 #include "ppapi/host/host_message_context.h"
20 #include "ppapi/host/resource_host.h" 21 #include "ppapi/host/resource_host.h"
21 #include "ppapi/proxy/resource_message_params.h" 22 #include "ppapi/proxy/resource_message_params.h"
22 #include "ppapi/shared_impl/media_stream_buffer_manager.h" 23 #include "ppapi/shared_impl/media_stream_buffer_manager.h"
23 24
24 namespace gpu { 25 namespace gpu {
25 class CommandBufferProxyImpl; 26 class CommandBufferProxyImpl;
26 class GpuChannelHost; 27 class GpuChannelHost;
27 } 28 }
28 29
29 namespace media { 30 namespace media {
30 class GpuVideoAcceleratorFactories; 31 class GpuVideoAcceleratorFactories;
31 } 32 }
32 33
33 namespace content { 34 namespace content {
34 35
35 class RendererPpapiHost; 36 class RendererPpapiHost;
36 class VideoEncoderShim; 37 class VideoEncoderShim;
37 38
38 class CONTENT_EXPORT PepperVideoEncoderHost 39 class CONTENT_EXPORT PepperVideoEncoderHost
39 : public ppapi::host::ResourceHost, 40 : public ppapi::host::ResourceHost,
40 public media::VideoEncodeAccelerator::Client, 41 public media::VideoEncodeAccelerator::Client,
41 public ppapi::MediaStreamBufferManager::Delegate { 42 public ppapi::MediaStreamBufferManager::Delegate,
43 public gpu::GpuControlClient {
42 public: 44 public:
43 PepperVideoEncoderHost(RendererPpapiHost* host, 45 PepperVideoEncoderHost(RendererPpapiHost* host,
44 PP_Instance instance, 46 PP_Instance instance,
45 PP_Resource resource); 47 PP_Resource resource);
46 ~PepperVideoEncoderHost() override; 48 ~PepperVideoEncoderHost() override;
47 49
48 private: 50 private:
49 friend class VideoEncoderShim; 51 friend class VideoEncoderShim;
50 52
51 // Shared memory buffers. 53 // Shared memory buffers.
(...skipping 17 matching lines...) Expand all
69 void BitstreamBufferReady(int32_t bitstream_buffer_id, 71 void BitstreamBufferReady(int32_t bitstream_buffer_id,
70 size_t payload_size, 72 size_t payload_size,
71 bool key_frame) override; 73 bool key_frame) override;
72 void NotifyError(media::VideoEncodeAccelerator::Error error) override; 74 void NotifyError(media::VideoEncodeAccelerator::Error error) override;
73 75
74 // ResourceHost implementation. 76 // ResourceHost implementation.
75 int32_t OnResourceMessageReceived( 77 int32_t OnResourceMessageReceived(
76 const IPC::Message& msg, 78 const IPC::Message& msg,
77 ppapi::host::HostMessageContext* context) override; 79 ppapi::host::HostMessageContext* context) override;
78 80
81 // GpuControlClient implementation.
82 void OnGpuControlLostContext() override;
83 void OnGpuControlErrorMessage(const char* msg, int id) override {}
84
79 int32_t OnHostMsgGetSupportedProfiles( 85 int32_t OnHostMsgGetSupportedProfiles(
80 ppapi::host::HostMessageContext* context); 86 ppapi::host::HostMessageContext* context);
81 int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context, 87 int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context,
82 PP_VideoFrame_Format input_format, 88 PP_VideoFrame_Format input_format,
83 const PP_Size& input_visible_size, 89 const PP_Size& input_visible_size,
84 PP_VideoProfile output_profile, 90 PP_VideoProfile output_profile,
85 uint32_t initial_bitrate, 91 uint32_t initial_bitrate,
86 PP_HardwareAcceleration acceleration); 92 PP_HardwareAcceleration acceleration);
87 int32_t OnHostMsgGetVideoFrames(ppapi::host::HostMessageContext* context); 93 int32_t OnHostMsgGetVideoFrames(ppapi::host::HostMessageContext* context);
88 int32_t OnHostMsgEncode(ppapi::host::HostMessageContext* context, 94 int32_t OnHostMsgEncode(ppapi::host::HostMessageContext* context,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // Size of the frames allocated for the encoder (matching hardware 160 // Size of the frames allocated for the encoder (matching hardware
155 // constraints). 161 // constraints).
156 gfx::Size input_coded_size_; 162 gfx::Size input_coded_size_;
157 163
158 // Number of frames the encoder needs. 164 // Number of frames the encoder needs.
159 uint32_t frame_count_; 165 uint32_t frame_count_;
160 166
161 // Format of the frames to give to the encoder. 167 // Format of the frames to give to the encoder.
162 media::VideoPixelFormat media_input_format_; 168 media::VideoPixelFormat media_input_format_;
163 169
170 #if DCHECK_IS_ON()
171 bool lost_context_ = false;
172 #endif
173
164 base::WeakPtrFactory<PepperVideoEncoderHost> weak_ptr_factory_; 174 base::WeakPtrFactory<PepperVideoEncoderHost> weak_ptr_factory_;
165 175
166 DISALLOW_COPY_AND_ASSIGN(PepperVideoEncoderHost); 176 DISALLOW_COPY_AND_ASSIGN(PepperVideoEncoderHost);
167 }; 177 };
168 178
169 } // namespace content 179 } // namespace content
170 180
171 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ 181 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698