| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 // use config information instead. | 443 // use config information instead. |
| 444 gfx::Rect visible_rect; | 444 gfx::Rect visible_rect; |
| 445 gfx::Size natural_size; | 445 gfx::Size natural_size; |
| 446 GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect, | 446 GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect, |
| 447 &natural_size); | 447 &natural_size); |
| 448 DCHECK(decoder_texture_target_); | 448 DCHECK(decoder_texture_target_); |
| 449 | 449 |
| 450 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( | 450 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( |
| 451 make_scoped_ptr(new gpu::MailboxHolder( | 451 make_scoped_ptr(new gpu::MailboxHolder( |
| 452 pb.texture_mailbox(), decoder_texture_target_, 0 /* sync_point */)), | 452 pb.texture_mailbox(), decoder_texture_target_, 0 /* sync_point */)), |
| 453 BindToCurrentLoop(base::Bind( | 453 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReleaseMailbox, |
| 454 &GpuVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), | 454 weak_factory_.GetWeakPtr(), |
| 455 factories_, picture.picture_buffer_id(), pb.texture_id())), | 455 factories_, |
| 456 pb.size(), visible_rect, natural_size, timestamp, | 456 picture.picture_buffer_id(), |
| 457 base::Bind(&ReadPixelsSync, factories_, pb.texture_id(), visible_rect), | 457 pb.texture_id())), |
| 458 picture.allow_overlay())); | 458 pb.size(), |
| 459 visible_rect, |
| 460 natural_size, |
| 461 timestamp, |
| 462 base::Bind(&ReadPixelsSync, factories_, pb.texture_id(), visible_rect))); |
| 459 CHECK_GT(available_pictures_, 0); | 463 CHECK_GT(available_pictures_, 0); |
| 460 --available_pictures_; | 464 --available_pictures_; |
| 461 bool inserted = | 465 bool inserted = |
| 462 picture_buffers_at_display_.insert(std::make_pair( | 466 picture_buffers_at_display_.insert(std::make_pair( |
| 463 picture.picture_buffer_id(), | 467 picture.picture_buffer_id(), |
| 464 pb.texture_id())).second; | 468 pb.texture_id())).second; |
| 465 DCHECK(inserted); | 469 DCHECK(inserted); |
| 466 | 470 |
| 467 DeliverFrame(frame); | 471 DeliverFrame(frame); |
| 468 } | 472 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 DLOG(ERROR) << "VDA Error: " << error; | 622 DLOG(ERROR) << "VDA Error: " << error; |
| 619 DestroyVDA(); | 623 DestroyVDA(); |
| 620 } | 624 } |
| 621 | 625 |
| 622 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 626 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 623 const { | 627 const { |
| 624 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 628 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 625 } | 629 } |
| 626 | 630 |
| 627 } // namespace media | 631 } // namespace media |
| OLD | NEW |