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 #include <array> | 8 #include <array> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 std::vector<uint32_t> texture_ids; | 541 std::vector<uint32_t> texture_ids; |
542 std::vector<gpu::Mailbox> texture_mailboxes; | 542 std::vector<gpu::Mailbox> texture_mailboxes; |
543 decoder_texture_target_ = texture_target; | 543 decoder_texture_target_ = texture_target; |
544 | 544 |
545 if (format == PIXEL_FORMAT_UNKNOWN) { | 545 if (format == PIXEL_FORMAT_UNKNOWN) { |
546 format = IsOpaque(config_.format()) ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_ARGB; | 546 format = IsOpaque(config_.format()) ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_ARGB; |
547 } | 547 } |
548 | 548 |
549 // TODO(jbauman): Move decoder_texture_target_ and pixel_format_ to the | 549 // TODO(jbauman): Move decoder_texture_target_ and pixel_format_ to the |
550 // picture buffer. http://crbug.com/614789 | 550 // picture buffer. http://crbug.com/614789 |
| 551 PLOG(ERROR) << " pixel format " << pixel_format_ << " wanted format " |
| 552 << format; |
551 if ((pixel_format_ != PIXEL_FORMAT_UNKNOWN) && (pixel_format_ != format)) { | 553 if ((pixel_format_ != PIXEL_FORMAT_UNKNOWN) && (pixel_format_ != format)) { |
552 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); | 554 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); |
553 return; | 555 return; |
554 } | 556 } |
555 | 557 |
556 pixel_format_ = format; | 558 pixel_format_ = format; |
557 if (!factories_->CreateTextures(count * textures_per_buffer, size, | 559 if (!factories_->CreateTextures(count * textures_per_buffer, size, |
558 &texture_ids, &texture_mailboxes, | 560 &texture_ids, &texture_mailboxes, |
559 decoder_texture_target_)) { | 561 decoder_texture_target_)) { |
560 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); | 562 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); |
(...skipping 19 matching lines...) Expand all Loading... |
580 | 582 |
581 picture_buffers.push_back( | 583 picture_buffers.push_back( |
582 PictureBuffer(next_picture_buffer_id_++, size, ids, mailboxes)); | 584 PictureBuffer(next_picture_buffer_id_++, size, ids, mailboxes)); |
583 bool inserted = assigned_picture_buffers_.insert(std::make_pair( | 585 bool inserted = assigned_picture_buffers_.insert(std::make_pair( |
584 picture_buffers.back().id(), picture_buffers.back())).second; | 586 picture_buffers.back().id(), picture_buffers.back())).second; |
585 DCHECK(inserted); | 587 DCHECK(inserted); |
586 } | 588 } |
587 | 589 |
588 available_pictures_ += count; | 590 available_pictures_ += count; |
589 | 591 |
| 592 PLOG(ERROR) << " picture buffer allocated! "; |
| 593 |
590 vda_->AssignPictureBuffers(picture_buffers); | 594 vda_->AssignPictureBuffers(picture_buffers); |
591 } | 595 } |
592 | 596 |
593 void GpuVideoDecoder::DismissPictureBuffer(int32_t id) { | 597 void GpuVideoDecoder::DismissPictureBuffer(int32_t id) { |
594 DVLOG(3) << "DismissPictureBuffer(" << id << ")"; | 598 DVLOG(3) << "DismissPictureBuffer(" << id << ")"; |
595 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 599 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
596 | 600 |
597 PictureBufferMap::iterator it = assigned_picture_buffers_.find(id); | 601 PictureBufferMap::iterator it = assigned_picture_buffers_.find(id); |
598 if (it == assigned_picture_buffers_.end()) { | 602 if (it == assigned_picture_buffers_.end()) { |
599 NOTREACHED() << "Missing picture buffer: " << id; | 603 NOTREACHED() << "Missing picture buffer: " << id; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 } | 663 } |
660 | 664 |
661 DCHECK(decoder_texture_target_); | 665 DCHECK(decoder_texture_target_); |
662 | 666 |
663 gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes]; | 667 gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes]; |
664 for (size_t i = 0; i < pb.client_texture_ids().size(); ++i) { | 668 for (size_t i = 0; i < pb.client_texture_ids().size(); ++i) { |
665 mailbox_holders[i] = gpu::MailboxHolder(pb.texture_mailbox(i), sync_token_, | 669 mailbox_holders[i] = gpu::MailboxHolder(pb.texture_mailbox(i), sync_token_, |
666 decoder_texture_target_); | 670 decoder_texture_target_); |
667 } | 671 } |
668 | 672 |
| 673 PLOG(ERROR) << "video frame format " << pixel_format_; |
669 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTextures( | 674 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTextures( |
670 pixel_format_, mailbox_holders, | 675 pixel_format_, mailbox_holders, |
671 base::Bind( | 676 base::Bind( |
672 &ReleaseMailboxTrampoline, factories_->GetTaskRunner(), | 677 &ReleaseMailboxTrampoline, factories_->GetTaskRunner(), |
673 base::Bind(&GpuVideoDecoder::ReleaseMailbox, | 678 base::Bind(&GpuVideoDecoder::ReleaseMailbox, |
674 weak_factory_.GetWeakPtr(), factories_, | 679 weak_factory_.GetWeakPtr(), factories_, |
675 picture.picture_buffer_id(), pb.client_texture_ids())), | 680 picture.picture_buffer_id(), pb.client_texture_ids())), |
676 pb.size(), visible_rect, natural_size, timestamp)); | 681 pb.size(), visible_rect, natural_size, timestamp)); |
677 if (!frame) { | 682 if (!frame) { |
678 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id(); | 683 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id(); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 } | 906 } |
902 return false; | 907 return false; |
903 } | 908 } |
904 | 909 |
905 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 910 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
906 const { | 911 const { |
907 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 912 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
908 } | 913 } |
909 | 914 |
910 } // namespace media | 915 } // namespace media |
OLD | NEW |