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

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: Created 4 years, 7 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 747
748 if (!gfx::Rect(coded_size_).Contains(gfx::Rect(visible_size_))) { 748 if (!gfx::Rect(coded_size_).Contains(gfx::Rect(visible_size_))) {
749 LOG(ERROR) << "Got invalid adjusted coded size: " << coded_size_.ToString(); 749 LOG(ERROR) << "Got invalid adjusted coded size: " << coded_size_.ToString();
750 return false; 750 return false;
751 } 751 }
752 752
753 DVLOGF(3) << "buffer_count=" << num_pictures 753 DVLOGF(3) << "buffer_count=" << num_pictures
754 << ", visible size=" << visible_size_.ToString() 754 << ", visible size=" << visible_size_.ToString()
755 << ", coded size=" << coded_size_.ToString(); 755 << ", coded size=" << coded_size_.ToString();
756 756
757 DCHECK(output_format_fourcc_);
Pawel Osciak 2016/05/18 07:32:31 This should not be needed, we'd fail S_FMT for 0.
758
759 VideoPixelFormat pixel_format =
760 V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_);
761
757 child_task_runner_->PostTask( 762 child_task_runner_->PostTask(
758 FROM_HERE, 763 FROM_HERE,
759 base::Bind(&VideoDecodeAccelerator::Client::ProvidePictureBuffers, 764 base::Bind(&VideoDecodeAccelerator::Client::ProvidePictureBuffers,
760 client_, num_pictures, 1, coded_size_, 765 client_, num_pictures, pixel_format, 1, coded_size_,
761 device_->GetTextureTarget())); 766 device_->GetTextureTarget()));
762 767
763 // Go into kAwaitingPictureBuffers to prevent us from doing any more decoding 768 // Go into kAwaitingPictureBuffers to prevent us from doing any more decoding
764 // or event handling while we are waiting for AssignPictureBuffers(). Not 769 // or event handling while we are waiting for AssignPictureBuffers(). Not
765 // having Pictures available would not have prevented us from making decoding 770 // having Pictures available would not have prevented us from making decoding
766 // progress entirely e.g. in the case of H.264 where we could further decode 771 // progress entirely e.g. in the case of H.264 where we could further decode
767 // non-slice NALUs and could even get another resolution change before we were 772 // non-slice NALUs and could even get another resolution change before we were
768 // done with this one. After we get the buffers, we'll go back into kIdle and 773 // done with this one. After we get the buffers, we'll go back into kIdle and
769 // kick off further event processing, and eventually go back into kDecoding 774 // kick off further event processing, and eventually go back into kDecoding
770 // once no more events are pending (if any). 775 // once no more events are pending (if any).
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 } 2793 }
2789 2794
2790 bool V4L2SliceVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread( 2795 bool V4L2SliceVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread(
2791 const base::WeakPtr<Client>& decode_client, 2796 const base::WeakPtr<Client>& decode_client,
2792 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) { 2797 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) {
2793 decode_client_ = decode_client_; 2798 decode_client_ = decode_client_;
2794 decode_task_runner_ = decode_task_runner; 2799 decode_task_runner_ = decode_task_runner;
2795 return true; 2800 return true;
2796 } 2801 }
2797 2802
2798 media::VideoPixelFormat V4L2SliceVideoDecodeAccelerator::GetOutputFormat()
2799 const {
2800 return V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_);
2801 }
2802
2803 // static 2803 // static
2804 media::VideoDecodeAccelerator::SupportedProfiles 2804 media::VideoDecodeAccelerator::SupportedProfiles
2805 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { 2805 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() {
2806 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); 2806 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
2807 if (!device) 2807 if (!device)
2808 return SupportedProfiles(); 2808 return SupportedProfiles();
2809 2809
2810 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), 2810 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_),
2811 supported_input_fourccs_); 2811 supported_input_fourccs_);
2812 } 2812 }
2813 2813
2814 } // namespace media 2814 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698