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

Side by Side Diff: content/renderer/media/rtc_video_decoder.h

Issue 1236663003: RTCVideoDecoder: Fixes for high resolutions and high pressure cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_
6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ 6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 void DestroyVDA(); 155 void DestroyVDA();
156 156
157 // Gets a shared-memory segment of at least |min_size| bytes from 157 // Gets a shared-memory segment of at least |min_size| bytes from
158 // |available_shm_segments_|. Returns NULL if there is no buffer or the 158 // |available_shm_segments_|. Returns NULL if there is no buffer or the
159 // buffer is not big enough. 159 // buffer is not big enough.
160 scoped_ptr<SHMBuffer> GetSHM_Locked(size_t min_size); 160 scoped_ptr<SHMBuffer> GetSHM_Locked(size_t min_size);
161 161
162 // Returns a shared-memory segment to the available pool. 162 // Returns a shared-memory segment to the available pool.
163 void PutSHM_Locked(scoped_ptr<SHMBuffer> shm_buffer); 163 void PutSHM_Locked(scoped_ptr<SHMBuffer> shm_buffer);
164 164
165 // Allocates |number| shared memory of at least |min_size| bytes. 165 // Allocates |count| shared memory buffers of |size| bytes.
166 void CreateSHM(int number, size_t min_size); 166 void CreateSHM(size_t count, size_t size);
167 167
168 // Stores the buffer metadata to |input_buffer_data_|. 168 // Stores the buffer metadata to |input_buffer_data_|.
169 void RecordBufferData(const BufferData& buffer_data); 169 void RecordBufferData(const BufferData& buffer_data);
170 // Gets the buffer metadata from |input_buffer_data_|. 170 // Gets the buffer metadata from |input_buffer_data_|.
171 void GetBufferData(int32 bitstream_buffer_id, uint32_t* timestamp); 171 void GetBufferData(int32 bitstream_buffer_id, uint32_t* timestamp);
172 172
173 // Records the result of InitDecode to UMA and returns |status|. 173 // Records the result of InitDecode to UMA and returns |status|.
174 int32_t RecordInitDecodeUMA(int32_t status); 174 int32_t RecordInitDecodeUMA(int32_t status);
175 175
176 // Assert the contract that this class is operated on the right thread. 176 // Assert the contract that this class is operated on the right thread.
177 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const; 177 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const;
178 178
179 // Query factories_ whether |profile| is supported and return true is so, 179 // Query factories_ whether |profile| is supported and return true is so,
180 // false otherwise. If true, also set resolution limits for |profile| 180 // false otherwise. If true, also set resolution limits for |profile|
181 // in min/max_resolution_. 181 // in min/max_resolution_.
182 bool IsProfileSupported(media::VideoCodecProfile profile); 182 bool IsProfileSupported(media::VideoCodecProfile profile);
183 183
184 // Clear the pending_buffers_ queue, freeing memory.
185 void ClearPendingBuffers();
186
184 enum State { 187 enum State {
185 UNINITIALIZED, // The decoder has not initialized. 188 UNINITIALIZED, // The decoder has not initialized.
186 INITIALIZED, // The decoder has initialized. 189 INITIALIZED, // The decoder has initialized.
187 RESETTING, // The decoder is being reset. 190 RESETTING, // The decoder is being reset.
188 DECODE_ERROR, // Decoding error happened. 191 DECODE_ERROR, // Decoding error happened.
189 }; 192 };
190 193
191 static const int32 ID_LAST; // maximum bitstream buffer id 194 static const int32 ID_LAST; // maximum bitstream buffer id
192 static const int32 ID_HALF; // half of the maximum bitstream buffer id 195 static const int32 ID_HALF; // half of the maximum bitstream buffer id
193 static const int32 ID_INVALID; // indicates Reset or Release never occurred 196 static const int32 ID_INVALID; // indicates Reset or Release never occurred
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // |next_bitstream_buffer_id_| and |reset_bitstream_buffer_id_|. 234 // |next_bitstream_buffer_id_| and |reset_bitstream_buffer_id_|.
232 base::Lock lock_; 235 base::Lock lock_;
233 236
234 // The state of RTCVideoDecoder. Guarded by |lock_|. 237 // The state of RTCVideoDecoder. Guarded by |lock_|.
235 State state_; 238 State state_;
236 239
237 // Guarded by |lock_|. 240 // Guarded by |lock_|.
238 webrtc::DecodedImageCallback* decode_complete_callback_; 241 webrtc::DecodedImageCallback* decode_complete_callback_;
239 242
240 // Total number of allocated SHM buffers. Guarded by |lock_|. 243 // Total number of allocated SHM buffers. Guarded by |lock_|.
241 int num_shm_buffers_; 244 size_t num_shm_buffers_;
242 245
243 // Shared-memory buffer pool. Since allocating SHM segments requires a 246 // Shared-memory buffer pool. Since allocating SHM segments requires a
244 // round-trip to the browser process, we keep allocation out of the 247 // round-trip to the browser process, we keep allocation out of the
245 // steady-state of the decoder. The vector owns SHM buffers. Guarded by 248 // steady-state of the decoder. The vector owns SHM buffers. Guarded by
246 // |lock_|. 249 // |lock_|.
247 std::vector<SHMBuffer*> available_shm_segments_; 250 std::vector<SHMBuffer*> available_shm_segments_;
248 251
249 // A queue storing WebRTC encoding images (and their metadata) that are 252 // A queue storing WebRTC encoding images (and their metadata) that are
250 // waiting for the shared memory. Guarded by |lock_|. 253 // waiting for the shared memory. Guarded by |lock_|.
251 std::deque<std::pair<webrtc::EncodedImage, BufferData> > pending_buffers_; 254 std::deque<std::pair<webrtc::EncodedImage, BufferData> > pending_buffers_;
(...skipping 16 matching lines...) Expand all
268 // Must be destroyed, or invalidated, on |vda_loop_proxy_| 271 // Must be destroyed, or invalidated, on |vda_loop_proxy_|
269 // NOTE: Weak pointers must be invalidated before all other member variables. 272 // NOTE: Weak pointers must be invalidated before all other member variables.
270 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_; 273 base::WeakPtrFactory<RTCVideoDecoder> weak_factory_;
271 274
272 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); 275 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder);
273 }; 276 };
274 277
275 } // namespace content 278 } // namespace content
276 279
277 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ 280 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/rtc_video_decoder.cc » ('j') | content/renderer/media/rtc_video_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698