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

Side by Side Diff: content/common/gpu/media/vt_video_decode_accelerator.cc

Issue 763063004: Flush correctly in VTVideoDecodeAccelerator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Flush discarded sessions. Created 6 years 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
« no previous file with comments | « content/common/gpu/media/vt.sig ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include <algorithm> 5 #include <algorithm>
6 6
7 #include <CoreVideo/CoreVideo.h> 7 #include <CoreVideo/CoreVideo.h>
8 #include <OpenGL/CGLIOSurface.h> 8 #include <OpenGL/CGLIOSurface.h>
9 #include <OpenGL/gl.h> 9 #include <OpenGL/gl.h>
10 10
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // Spawn a thread to handle parsing and calling VideoToolbox. 239 // Spawn a thread to handle parsing and calling VideoToolbox.
240 if (!decoder_thread_.Start()) 240 if (!decoder_thread_.Start())
241 return false; 241 return false;
242 242
243 return true; 243 return true;
244 } 244 }
245 245
246 bool VTVideoDecodeAccelerator::FinishDelayedFrames() { 246 bool VTVideoDecodeAccelerator::FinishDelayedFrames() {
247 DCHECK(decoder_thread_.message_loop_proxy()->BelongsToCurrentThread()); 247 DCHECK(decoder_thread_.message_loop_proxy()->BelongsToCurrentThread());
248 if (session_) { 248 if (session_) {
249 OSStatus status = VTDecompressionSessionFinishDelayedFrames(session_); 249 OSStatus status = VTDecompressionSessionWaitForAsynchronousFrames(session_);
DaleCurtis 2014/12/02 18:28:01 Does blocking the decoder thread for this prevent
sandersd (OOO until July 31) 2014/12/02 18:30:39 There are no necessary actions on the decoder thre
250 if (status) { 250 if (status) {
251 NOTIFY_STATUS("VTDecompressionSessionFinishDelayedFrames()", status); 251 NOTIFY_STATUS("VTDecompressionSessionWaitForAsynchronousFrames()",
252 status);
252 return false; 253 return false;
253 } 254 }
254 } 255 }
255 return true; 256 return true;
256 } 257 }
257 258
258 bool VTVideoDecodeAccelerator::ConfigureDecoder() { 259 bool VTVideoDecodeAccelerator::ConfigureDecoder() {
259 DCHECK(decoder_thread_.message_loop_proxy()->BelongsToCurrentThread()); 260 DCHECK(decoder_thread_.message_loop_proxy()->BelongsToCurrentThread());
260 DCHECK(!last_sps_.empty()); 261 DCHECK(!last_sps_.empty());
261 DCHECK(!last_pps_.empty()); 262 DCHECK(!last_pps_.empty());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 312
312 CFDictionarySetValue( 313 CFDictionarySetValue(
313 decoder_config, 314 decoder_config,
314 // kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder 315 // kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder
315 CFSTR("EnableHardwareAcceleratedVideoDecoder"), 316 CFSTR("EnableHardwareAcceleratedVideoDecoder"),
316 kCFBooleanTrue); 317 kCFBooleanTrue);
317 318
318 base::ScopedCFTypeRef<CFMutableDictionaryRef> image_config( 319 base::ScopedCFTypeRef<CFMutableDictionaryRef> image_config(
319 BuildImageConfig(coded_dimensions)); 320 BuildImageConfig(coded_dimensions));
320 321
321 // TODO(sandersd): Does the old session need to be flushed first? 322 if (!FinishDelayedFrames())
323 return false;
322 session_.reset(); 324 session_.reset();
323 status = VTDecompressionSessionCreate( 325 status = VTDecompressionSessionCreate(
324 kCFAllocatorDefault, 326 kCFAllocatorDefault,
325 format_, // video_format_description 327 format_, // video_format_description
326 decoder_config, // video_decoder_specification 328 decoder_config, // video_decoder_specification
327 image_config, // destination_image_buffer_attributes 329 image_config, // destination_image_buffer_attributes
328 &callback_, // output_callback 330 &callback_, // output_callback
329 session_.InitializeInto()); 331 session_.InitializeInto());
330 if (status) { 332 if (status) {
331 NOTIFY_STATUS("VTDecompressionSessionCreate()", status); 333 NOTIFY_STATUS("VTDecompressionSessionCreate()", status);
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 assigned_bitstream_ids_.clear(); 887 assigned_bitstream_ids_.clear();
886 state_ = STATE_DESTROYING; 888 state_ = STATE_DESTROYING;
887 QueueFlush(TASK_DESTROY); 889 QueueFlush(TASK_DESTROY);
888 } 890 }
889 891
890 bool VTVideoDecodeAccelerator::CanDecodeOnIOThread() { 892 bool VTVideoDecodeAccelerator::CanDecodeOnIOThread() {
891 return false; 893 return false;
892 } 894 }
893 895
894 } // namespace content 896 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/vt.sig ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698