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

Side by Side Diff: media/gpu/vaapi_video_decode_accelerator.cc

Issue 2019333004: Revert of Plumb decoded video pixel format from GPU process to renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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/gpu/vaapi_video_decode_accelerator.h" 5 #include "media/gpu/vaapi_video_decode_accelerator.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 // we can finish all pending output callbacks, releasing associated surfaces. 630 // we can finish all pending output callbacks, releasing associated surfaces.
631 DVLOG(1) << "Initiating surface set change"; 631 DVLOG(1) << "Initiating surface set change";
632 awaiting_va_surfaces_recycle_ = true; 632 awaiting_va_surfaces_recycle_ = true;
633 633
634 requested_num_pics_ = num_pics; 634 requested_num_pics_ = num_pics;
635 requested_pic_size_ = size; 635 requested_pic_size_ = size;
636 636
637 TryFinishSurfaceSetChange(); 637 TryFinishSurfaceSetChange();
638 } 638 }
639 639
640 static VideoPixelFormat BufferFormatToVideoPixelFormat(
641 gfx::BufferFormat format) {
642 switch (format) {
643 case gfx::BufferFormat::BGRA_8888:
644 return PIXEL_FORMAT_ARGB;
645
646 default:
647 LOG(FATAL) << "Add more cases as needed";
648 return PIXEL_FORMAT_UNKNOWN;
649 }
650 }
651
652 void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() { 640 void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() {
653 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 641 DCHECK_EQ(message_loop_, base::MessageLoop::current());
654 642
655 if (!awaiting_va_surfaces_recycle_) 643 if (!awaiting_va_surfaces_recycle_)
656 return; 644 return;
657 645
658 if (!pending_output_cbs_.empty() || 646 if (!pending_output_cbs_.empty() ||
659 pictures_.size() != available_va_surfaces_.size()) { 647 pictures_.size() != available_va_surfaces_.size()) {
660 // Either: 648 // Either:
661 // 1. Not all pending pending output callbacks have been executed yet. 649 // 1. Not all pending pending output callbacks have been executed yet.
(...skipping 19 matching lines...) Expand all
681 DVLOG(2) << "Dismissing picture id: " << iter->first; 669 DVLOG(2) << "Dismissing picture id: " << iter->first;
682 if (client_) 670 if (client_)
683 client_->DismissPictureBuffer(iter->first); 671 client_->DismissPictureBuffer(iter->first);
684 } 672 }
685 pictures_.clear(); 673 pictures_.clear();
686 674
687 // And ask for a new set as requested. 675 // And ask for a new set as requested.
688 DVLOG(1) << "Requesting " << requested_num_pics_ 676 DVLOG(1) << "Requesting " << requested_num_pics_
689 << " pictures of size: " << requested_pic_size_.ToString(); 677 << " pictures of size: " << requested_pic_size_.ToString();
690 678
691 VideoPixelFormat format =
692 BufferFormatToVideoPixelFormat(kOutputPictureFormat);
693 message_loop_->PostTask( 679 message_loop_->PostTask(
694 FROM_HERE, base::Bind(&Client::ProvidePictureBuffers, client_, 680 FROM_HERE,
695 requested_num_pics_, format, 1, requested_pic_size_, 681 base::Bind(&Client::ProvidePictureBuffers, client_, requested_num_pics_,
696 VaapiPicture::GetGLTextureTarget())); 682 1, requested_pic_size_, VaapiPicture::GetGLTextureTarget()));
697 } 683 }
698 684
699 void VaapiVideoDecodeAccelerator::Decode( 685 void VaapiVideoDecodeAccelerator::Decode(
700 const media::BitstreamBuffer& bitstream_buffer) { 686 const media::BitstreamBuffer& bitstream_buffer) {
701 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 687 DCHECK_EQ(message_loop_, base::MessageLoop::current());
702 688
703 TRACE_EVENT1("Video Decoder", "VAVDA::Decode", "Buffer id", 689 TRACE_EVENT1("Video Decoder", "VAVDA::Decode", "Buffer id",
704 bitstream_buffer.id()); 690 bitstream_buffer.id());
705 691
706 if (bitstream_buffer.id() < 0) { 692 if (bitstream_buffer.id() < 0) {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 Cleanup(); 1037 Cleanup();
1052 delete this; 1038 delete this;
1053 } 1039 }
1054 1040
1055 bool VaapiVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread( 1041 bool VaapiVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread(
1056 const base::WeakPtr<Client>& decode_client, 1042 const base::WeakPtr<Client>& decode_client,
1057 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) { 1043 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) {
1058 return false; 1044 return false;
1059 } 1045 }
1060 1046
1047 static VideoPixelFormat BufferFormatToVideoPixelFormat(
1048 gfx::BufferFormat format) {
1049 switch (format) {
1050 case gfx::BufferFormat::BGRA_8888:
1051 return PIXEL_FORMAT_ARGB;
1052
1053 default:
1054 LOG(FATAL) << "Add more cases as needed";
1055 return PIXEL_FORMAT_UNKNOWN;
1056 }
1057 }
1058
1059 VideoPixelFormat VaapiVideoDecodeAccelerator::GetOutputFormat() const {
1060 return BufferFormatToVideoPixelFormat(kOutputPictureFormat);
1061 }
1062
1061 bool VaapiVideoDecodeAccelerator::DecodeSurface( 1063 bool VaapiVideoDecodeAccelerator::DecodeSurface(
1062 const scoped_refptr<VaapiDecodeSurface>& dec_surface) { 1064 const scoped_refptr<VaapiDecodeSurface>& dec_surface) {
1063 if (!vaapi_wrapper_->ExecuteAndDestroyPendingBuffers( 1065 if (!vaapi_wrapper_->ExecuteAndDestroyPendingBuffers(
1064 dec_surface->va_surface()->id())) { 1066 dec_surface->va_surface()->id())) {
1065 DVLOG(1) << "Failed decoding picture"; 1067 DVLOG(1) << "Failed decoding picture";
1066 return false; 1068 return false;
1067 } 1069 }
1068 1070
1069 return true; 1071 return true;
1070 } 1072 }
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 return vaapi_pic->dec_surface(); 1831 return vaapi_pic->dec_surface();
1830 } 1832 }
1831 1833
1832 // static 1834 // static
1833 media::VideoDecodeAccelerator::SupportedProfiles 1835 media::VideoDecodeAccelerator::SupportedProfiles
1834 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { 1836 VaapiVideoDecodeAccelerator::GetSupportedProfiles() {
1835 return VaapiWrapper::GetSupportedDecodeProfiles(); 1837 return VaapiWrapper::GetSupportedDecodeProfiles();
1836 } 1838 }
1837 1839
1838 } // namespace media 1840 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/vaapi_video_decode_accelerator.h ('k') | media/gpu/video_decode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698