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

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added DCHECK for valid sync token before IPC conversions Created 5 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/filters/gpu_video_decoder.h" 5 #include "media/filters/gpu_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 if (!gfx::Rect(pb.size()).Contains(visible_rect)) { 409 if (!gfx::Rect(pb.size()).Contains(visible_rect)) {
410 LOG(WARNING) << "Visible size " << visible_rect.ToString() 410 LOG(WARNING) << "Visible size " << visible_rect.ToString()
411 << " is larger than coded size " << pb.size().ToString(); 411 << " is larger than coded size " << pb.size().ToString();
412 visible_rect = gfx::Rect(pb.size()); 412 visible_rect = gfx::Rect(pb.size());
413 } 413 }
414 414
415 DCHECK(decoder_texture_target_); 415 DCHECK(decoder_texture_target_);
416 416
417 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( 417 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture(
418 PIXEL_FORMAT_ARGB, 418 PIXEL_FORMAT_ARGB,
419 gpu::MailboxHolder(pb.texture_mailbox(), decoder_texture_target_, 419 gpu::MailboxHolder(pb.texture_mailbox(), gpu::SyncToken(),
420 0 /* sync_point */), 420 decoder_texture_target_),
421 BindToCurrentLoop(base::Bind( 421 BindToCurrentLoop(base::Bind(
422 &GpuVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), 422 &GpuVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(),
423 factories_, picture.picture_buffer_id(), pb.texture_id())), 423 factories_, picture.picture_buffer_id(), pb.texture_id())),
424 pb.size(), visible_rect, natural_size, timestamp)); 424 pb.size(), visible_rect, natural_size, timestamp));
425 if (!frame) { 425 if (!frame) {
426 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id(); 426 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id();
427 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); 427 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE);
428 return; 428 return;
429 } 429 }
430 if (picture.allow_overlay()) 430 if (picture.allow_overlay())
(...skipping 20 matching lines...) Expand all
451 451
452 output_cb_.Run(frame); 452 output_cb_.Run(frame);
453 } 453 }
454 454
455 // static 455 // static
456 void GpuVideoDecoder::ReleaseMailbox( 456 void GpuVideoDecoder::ReleaseMailbox(
457 base::WeakPtr<GpuVideoDecoder> decoder, 457 base::WeakPtr<GpuVideoDecoder> decoder,
458 media::GpuVideoAcceleratorFactories* factories, 458 media::GpuVideoAcceleratorFactories* factories,
459 int64 picture_buffer_id, 459 int64 picture_buffer_id,
460 uint32 texture_id, 460 uint32 texture_id,
461 uint32 release_sync_point) { 461 const gpu::SyncToken& release_sync_token) {
462 DCHECK(factories->GetTaskRunner()->BelongsToCurrentThread()); 462 DCHECK(factories->GetTaskRunner()->BelongsToCurrentThread());
463 factories->WaitSyncPoint(release_sync_point); 463 factories->WaitSyncToken(release_sync_token);
464 464
465 if (decoder) { 465 if (decoder) {
466 decoder->ReusePictureBuffer(picture_buffer_id); 466 decoder->ReusePictureBuffer(picture_buffer_id);
467 return; 467 return;
468 } 468 }
469 // It's the last chance to delete the texture after display, 469 // It's the last chance to delete the texture after display,
470 // because GpuVideoDecoder was destructed. 470 // because GpuVideoDecoder was destructed.
471 factories->DeleteTexture(texture_id); 471 factories->DeleteTexture(texture_id);
472 } 472 }
473 473
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 606 }
607 return false; 607 return false;
608 } 608 }
609 609
610 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 610 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
611 const { 611 const {
612 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 612 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
613 } 613 }
614 614
615 } // namespace media 615 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698