| OLD | NEW |
| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 if (!gfx::Rect(pb.size()).Contains(visible_rect)) { | 403 if (!gfx::Rect(pb.size()).Contains(visible_rect)) { |
| 404 LOG(WARNING) << "Visible size " << visible_rect.ToString() | 404 LOG(WARNING) << "Visible size " << visible_rect.ToString() |
| 405 << " is larger than coded size " << pb.size().ToString(); | 405 << " is larger than coded size " << pb.size().ToString(); |
| 406 visible_rect = gfx::Rect(pb.size()); | 406 visible_rect = gfx::Rect(pb.size()); |
| 407 } | 407 } |
| 408 | 408 |
| 409 DCHECK(decoder_texture_target_); | 409 DCHECK(decoder_texture_target_); |
| 410 | 410 |
| 411 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( | 411 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( |
| 412 PIXEL_FORMAT_ARGB, | 412 PIXEL_FORMAT_ARGB, |
| 413 gpu::MailboxHolder(pb.texture_mailbox(), decoder_texture_target_, | 413 gpu::MailboxHolder(pb.texture_mailbox(), gpu::SyncToken(), |
| 414 0 /* sync_point */), | 414 decoder_texture_target_), |
| 415 BindToCurrentLoop(base::Bind( | 415 BindToCurrentLoop(base::Bind( |
| 416 &GpuVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), | 416 &GpuVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), |
| 417 factories_, picture.picture_buffer_id(), pb.texture_id())), | 417 factories_, picture.picture_buffer_id(), pb.texture_id())), |
| 418 pb.size(), visible_rect, natural_size, timestamp)); | 418 pb.size(), visible_rect, natural_size, timestamp)); |
| 419 if (!frame) { | 419 if (!frame) { |
| 420 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id(); | 420 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id(); |
| 421 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); | 421 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 422 return; | 422 return; |
| 423 } | 423 } |
| 424 if (picture.allow_overlay()) | 424 if (picture.allow_overlay()) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 445 | 445 |
| 446 output_cb_.Run(frame); | 446 output_cb_.Run(frame); |
| 447 } | 447 } |
| 448 | 448 |
| 449 // static | 449 // static |
| 450 void GpuVideoDecoder::ReleaseMailbox( | 450 void GpuVideoDecoder::ReleaseMailbox( |
| 451 base::WeakPtr<GpuVideoDecoder> decoder, | 451 base::WeakPtr<GpuVideoDecoder> decoder, |
| 452 media::GpuVideoAcceleratorFactories* factories, | 452 media::GpuVideoAcceleratorFactories* factories, |
| 453 int64 picture_buffer_id, | 453 int64 picture_buffer_id, |
| 454 uint32 texture_id, | 454 uint32 texture_id, |
| 455 uint32 release_sync_point) { | 455 const gpu::SyncToken& release_sync_token) { |
| 456 DCHECK(factories->GetTaskRunner()->BelongsToCurrentThread()); | 456 DCHECK(factories->GetTaskRunner()->BelongsToCurrentThread()); |
| 457 factories->WaitSyncPoint(release_sync_point); | 457 factories->WaitSyncToken(release_sync_token); |
| 458 | 458 |
| 459 if (decoder) { | 459 if (decoder) { |
| 460 decoder->ReusePictureBuffer(picture_buffer_id); | 460 decoder->ReusePictureBuffer(picture_buffer_id); |
| 461 return; | 461 return; |
| 462 } | 462 } |
| 463 // It's the last chance to delete the texture after display, | 463 // It's the last chance to delete the texture after display, |
| 464 // because GpuVideoDecoder was destructed. | 464 // because GpuVideoDecoder was destructed. |
| 465 factories->DeleteTexture(texture_id); | 465 factories->DeleteTexture(texture_id); |
| 466 } | 466 } |
| 467 | 467 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 } | 600 } |
| 601 return false; | 601 return false; |
| 602 } | 602 } |
| 603 | 603 |
| 604 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 604 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 605 const { | 605 const { |
| 606 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 606 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 607 } | 607 } |
| 608 | 608 |
| 609 } // namespace media | 609 } // namespace media |
| OLD | NEW |