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

Side by Side Diff: content/common/gpu/media/v4l2_video_encode_accelerator.cc

Issue 288903002: fix sign-compare warning. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix sign-compare warning. Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <fcntl.h> 5 #include <fcntl.h>
6 #include <linux/videodev2.h> 6 #include <linux/videodev2.h>
7 #include <poll.h> 7 #include <poll.h>
8 #include <sys/eventfd.h> 8 #include <sys/eventfd.h>
9 #include <sys/ioctl.h> 9 #include <sys/ioctl.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 input_planes_count_ = 0; 866 input_planes_count_ = 0;
867 867
868 uint32 input_format_fourcc = 868 uint32 input_format_fourcc =
869 V4L2Device::VideoFrameFormatToV4L2PixFmt(input_format); 869 V4L2Device::VideoFrameFormatToV4L2PixFmt(input_format);
870 if (!input_format_fourcc) { 870 if (!input_format_fourcc) {
871 DVLOG(1) << "Unsupported input format"; 871 DVLOG(1) << "Unsupported input format";
872 return false; 872 return false;
873 } 873 }
874 874
875 size_t input_planes_count = media::VideoFrame::NumPlanes(input_format); 875 size_t input_planes_count = media::VideoFrame::NumPlanes(input_format);
876 DCHECK_LE(input_planes_count, VIDEO_MAX_PLANES); 876 DCHECK_LE(input_planes_count, static_cast<size_t>(VIDEO_MAX_PLANES));
877 877
878 // First see if we the device can use the provided input_format directly. 878 // First see if we the device can use the provided input_format directly.
879 struct v4l2_format format; 879 struct v4l2_format format;
880 memset(&format, 0, sizeof(format)); 880 memset(&format, 0, sizeof(format));
881 format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; 881 format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
882 format.fmt.pix_mp.width = visible_size_.width(); 882 format.fmt.pix_mp.width = visible_size_.width();
883 format.fmt.pix_mp.height = visible_size_.height(); 883 format.fmt.pix_mp.height = visible_size_.height();
884 format.fmt.pix_mp.pixelformat = input_format_fourcc; 884 format.fmt.pix_mp.pixelformat = input_format_fourcc;
885 format.fmt.pix_mp.num_planes = input_planes_count; 885 format.fmt.pix_mp.num_planes = input_planes_count;
886 if (device_->Ioctl(VIDIOC_S_FMT, &format) != 0) { 886 if (device_->Ioctl(VIDIOC_S_FMT, &format) != 0) {
887 // Error or format unsupported by device, try to negotiate a fallback. 887 // Error or format unsupported by device, try to negotiate a fallback.
888 input_format_fourcc = device_->PreferredInputFormat(); 888 input_format_fourcc = device_->PreferredInputFormat();
889 input_format = 889 input_format =
890 V4L2Device::V4L2PixFmtToVideoFrameFormat(input_format_fourcc); 890 V4L2Device::V4L2PixFmtToVideoFrameFormat(input_format_fourcc);
891 if (input_format == media::VideoFrame::UNKNOWN) 891 if (input_format == media::VideoFrame::UNKNOWN)
892 return false; 892 return false;
893 893
894 input_planes_count = media::VideoFrame::NumPlanes(input_format); 894 input_planes_count = media::VideoFrame::NumPlanes(input_format);
895 DCHECK_LE(input_planes_count, VIDEO_MAX_PLANES); 895 DCHECK_LE(input_planes_count, static_cast<size_t>(VIDEO_MAX_PLANES));
896 896
897 // Device might have adjusted parameters, reset them along with the format. 897 // Device might have adjusted parameters, reset them along with the format.
898 memset(&format, 0, sizeof(format)); 898 memset(&format, 0, sizeof(format));
899 format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; 899 format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
900 format.fmt.pix_mp.width = visible_size_.width(); 900 format.fmt.pix_mp.width = visible_size_.width();
901 format.fmt.pix_mp.height = visible_size_.height(); 901 format.fmt.pix_mp.height = visible_size_.height();
902 format.fmt.pix_mp.pixelformat = input_format_fourcc; 902 format.fmt.pix_mp.pixelformat = input_format_fourcc;
903 format.fmt.pix_mp.num_planes = input_planes_count; 903 format.fmt.pix_mp.num_planes = input_planes_count;
904 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_FMT, &format); 904 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_FMT, &format);
905 DCHECK_EQ(format.fmt.pix_mp.num_planes, input_planes_count); 905 DCHECK_EQ(format.fmt.pix_mp.num_planes, input_planes_count);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 reqbufs.count = 0; 1087 reqbufs.count = 0;
1088 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 1088 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
1089 reqbufs.memory = V4L2_MEMORY_MMAP; 1089 reqbufs.memory = V4L2_MEMORY_MMAP;
1090 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); 1090 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs);
1091 1091
1092 output_buffer_map_.clear(); 1092 output_buffer_map_.clear();
1093 free_output_buffers_.clear(); 1093 free_output_buffers_.clear();
1094 } 1094 }
1095 1095
1096 } // namespace content 1096 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/v4l2_image_processor.cc ('k') | content/common/gpu/media/video_encode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698