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

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

Issue 1942123002: Plumb decoded video pixel format from GPU process to renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test on bots 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/v4l2_slice_video_decode_accelerator.h" 5 #include "media/gpu/v4l2_slice_video_decode_accelerator.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <linux/videodev2.h> 9 #include <linux/videodev2.h>
10 #include <poll.h> 10 #include <poll.h>
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 748
749 if (!gfx::Rect(coded_size_).Contains(gfx::Rect(visible_size_))) { 749 if (!gfx::Rect(coded_size_).Contains(gfx::Rect(visible_size_))) {
750 LOG(ERROR) << "Got invalid adjusted coded size: " << coded_size_.ToString(); 750 LOG(ERROR) << "Got invalid adjusted coded size: " << coded_size_.ToString();
751 return false; 751 return false;
752 } 752 }
753 753
754 DVLOGF(3) << "buffer_count=" << num_pictures 754 DVLOGF(3) << "buffer_count=" << num_pictures
755 << ", visible size=" << visible_size_.ToString() 755 << ", visible size=" << visible_size_.ToString()
756 << ", coded size=" << coded_size_.ToString(); 756 << ", coded size=" << coded_size_.ToString();
757 757
758 // With ALLOCATE mode the client can sample it as RGB and doesn't need to
759 // know the precise format.
760 VideoPixelFormat pixel_format =
761 (output_mode_ == Config::OutputMode::IMPORT)
762 ? V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_)
763 : PIXEL_FORMAT_UNKNOWN;
764
758 child_task_runner_->PostTask( 765 child_task_runner_->PostTask(
759 FROM_HERE, 766 FROM_HERE,
760 base::Bind(&VideoDecodeAccelerator::Client::ProvidePictureBuffers, 767 base::Bind(&VideoDecodeAccelerator::Client::ProvidePictureBuffers,
761 client_, num_pictures, 1, coded_size_, 768 client_, num_pictures, pixel_format, 1, coded_size_,
762 device_->GetTextureTarget())); 769 device_->GetTextureTarget()));
763 770
764 // Go into kAwaitingPictureBuffers to prevent us from doing any more decoding 771 // Go into kAwaitingPictureBuffers to prevent us from doing any more decoding
765 // or event handling while we are waiting for AssignPictureBuffers(). Not 772 // or event handling while we are waiting for AssignPictureBuffers(). Not
766 // having Pictures available would not have prevented us from making decoding 773 // having Pictures available would not have prevented us from making decoding
767 // progress entirely e.g. in the case of H.264 where we could further decode 774 // progress entirely e.g. in the case of H.264 where we could further decode
768 // non-slice NALUs and could even get another resolution change before we were 775 // non-slice NALUs and could even get another resolution change before we were
769 // done with this one. After we get the buffers, we'll go back into kIdle and 776 // done with this one. After we get the buffers, we'll go back into kIdle and
770 // kick off further event processing, and eventually go back into kDecoding 777 // kick off further event processing, and eventually go back into kDecoding
771 // once no more events are pending (if any). 778 // once no more events are pending (if any).
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 } 2791 }
2785 2792
2786 bool V4L2SliceVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread( 2793 bool V4L2SliceVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread(
2787 const base::WeakPtr<Client>& decode_client, 2794 const base::WeakPtr<Client>& decode_client,
2788 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) { 2795 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) {
2789 decode_client_ = decode_client_; 2796 decode_client_ = decode_client_;
2790 decode_task_runner_ = decode_task_runner; 2797 decode_task_runner_ = decode_task_runner;
2791 return true; 2798 return true;
2792 } 2799 }
2793 2800
2794 media::VideoPixelFormat V4L2SliceVideoDecodeAccelerator::GetOutputFormat()
2795 const {
2796 return V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_);
2797 }
2798
2799 // static 2801 // static
2800 media::VideoDecodeAccelerator::SupportedProfiles 2802 media::VideoDecodeAccelerator::SupportedProfiles
2801 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { 2803 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() {
2802 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); 2804 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
2803 if (!device) 2805 if (!device)
2804 return SupportedProfiles(); 2806 return SupportedProfiles();
2805 2807
2806 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), 2808 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_),
2807 supported_input_fourccs_); 2809 supported_input_fourccs_);
2808 } 2810 }
2809 2811
2810 } // namespace media 2812 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/v4l2_slice_video_decode_accelerator.h ('k') | media/gpu/v4l2_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698