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

Side by Side Diff: media/gpu/ipc/client/gpu_video_encode_accelerator_host.h

Issue 2627173002: Adds locks for CommandBufferProxyImpl invalidation (Closed)
Patch Set: Created 3 years, 11 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_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ 5 #ifndef MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_
6 #define MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ 6 #define MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 uint32_t output_buffer_size); 91 uint32_t output_buffer_size);
92 void OnNotifyInputDone(int32_t frame_id); 92 void OnNotifyInputDone(int32_t frame_id);
93 void OnBitstreamBufferReady(int32_t bitstream_buffer_id, 93 void OnBitstreamBufferReady(int32_t bitstream_buffer_id,
94 uint32_t payload_size, 94 uint32_t payload_size,
95 bool key_frame, 95 bool key_frame,
96 base::TimeDelta timestamp); 96 base::TimeDelta timestamp);
97 void OnNotifyError(Error error); 97 void OnNotifyError(Error error);
98 98
99 scoped_refptr<gpu::GpuChannelHost> channel_; 99 scoped_refptr<gpu::GpuChannelHost> channel_;
100 100
101 // Callback to a function that releases |channel_|.
102 base::Callback<void(void)> channel_error_cb_;
103
101 // Route ID for the associated encoder in the GPU process. 104 // Route ID for the associated encoder in the GPU process.
102 int32_t encoder_route_id_; 105 int32_t encoder_route_id_;
103 106
104 // The client that will receive callbacks from the encoder. 107 // The client that will receive callbacks from the encoder.
105 Client* client_; 108 Client* client_;
106 109
110 // Protect |impl_|. |impl_| is used on media thread, but it can be invalidated
111 // on main thread.
112 base::Lock impl_lock_;
113
107 // Unowned reference to the gpu::CommandBufferProxyImpl that created us. 114 // Unowned reference to the gpu::CommandBufferProxyImpl that created us.
108 // |this| registers as a DeletionObserver of |impl_|, so the reference is 115 // |this| registers as a DeletionObserver of |impl_|, so the reference is
109 // always valid as long as it is not NULL. 116 // always valid as long as it is not NULL.
110 gpu::CommandBufferProxyImpl* impl_; 117 gpu::CommandBufferProxyImpl* impl_;
111 118
112 // VideoFrames sent to the encoder. 119 // VideoFrames sent to the encoder.
113 // base::IDMap not used here, since that takes pointers, not scoped_refptr. 120 // base::IDMap not used here, since that takes pointers, not scoped_refptr.
114 typedef base::hash_map<int32_t, scoped_refptr<VideoFrame>> FrameMap; 121 typedef base::hash_map<int32_t, scoped_refptr<VideoFrame>> FrameMap;
115 FrameMap frame_map_; 122 FrameMap frame_map_;
116 123
117 // ID serial number for the next frame to send to the GPU process. 124 // ID serial number for the next frame to send to the GPU process.
118 int32_t next_frame_id_; 125 int32_t next_frame_id_;
119 126
120 // WeakPtr factory for posting tasks back to itself. 127 // WeakPtr factory for posting tasks back to itself.
121 base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_; 128 base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_;
122 129
123 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost); 130 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost);
124 }; 131 };
125 132
126 } // namespace media 133 } // namespace media
127 134
128 #endif // MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ 135 #endif // MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698