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

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

Issue 827443003: Add querying supported formats to V4L2 VEA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nit Created 5 years, 11 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // Set to kError state just in case. 277 // Set to kError state just in case.
278 SetEncoderState(kError); 278 SetEncoderState(kError);
279 279
280 delete this; 280 delete this;
281 } 281 }
282 282
283 std::vector<media::VideoEncodeAccelerator::SupportedProfile> 283 std::vector<media::VideoEncodeAccelerator::SupportedProfile>
284 V4L2VideoEncodeAccelerator::GetSupportedProfiles() { 284 V4L2VideoEncodeAccelerator::GetSupportedProfiles() {
285 std::vector<SupportedProfile> profiles; 285 std::vector<SupportedProfile> profiles;
286 SupportedProfile profile; 286 SupportedProfile profile;
287
288 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
289 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWVp8Encoding)) {
290 profile.profile = media::VP8PROFILE_ANY;
291 profile.max_resolution.SetSize(1920, 1088);
292 profile.max_framerate_numerator = 30;
293 profile.max_framerate_denominator = 1;
294 profiles.push_back(profile);
295 }
296
297 profile.profile = media::H264PROFILE_MAIN;
298 profile.max_resolution.SetSize(1920, 1088); 287 profile.max_resolution.SetSize(1920, 1088);
299 profile.max_framerate_numerator = 30; 288 profile.max_framerate_numerator = 30;
300 profile.max_framerate_denominator = 1; 289 profile.max_framerate_denominator = 1;
301 profiles.push_back(profile); 290
291 v4l2_fmtdesc fmtdesc;
292 memset(&fmtdesc, 0, sizeof(fmtdesc));
293 fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
294 for (; device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) {
295 switch (fmtdesc.pixelformat) {
296 case V4L2_PIX_FMT_H264:
297 profile.profile = media::H264PROFILE_MAIN;
298 profiles.push_back(profile);
299 break;
300 case V4L2_PIX_FMT_VP8:
301 profile.profile = media::VP8PROFILE_ANY;
302 profiles.push_back(profile);
303 break;
304 }
305 }
302 306
303 return profiles; 307 return profiles;
304 } 308 }
305 309
306 void V4L2VideoEncodeAccelerator::FrameProcessed( 310 void V4L2VideoEncodeAccelerator::FrameProcessed(
307 bool force_keyframe, 311 bool force_keyframe,
308 const scoped_refptr<media::VideoFrame>& frame) { 312 const scoped_refptr<media::VideoFrame>& frame) {
309 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); 313 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
310 DVLOG(3) << "FrameProcessed(): force_keyframe=" << force_keyframe; 314 DVLOG(3) << "FrameProcessed(): force_keyframe=" << force_keyframe;
311 315
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 reqbufs.count = 0; 1093 reqbufs.count = 0;
1090 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 1094 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
1091 reqbufs.memory = V4L2_MEMORY_MMAP; 1095 reqbufs.memory = V4L2_MEMORY_MMAP;
1092 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); 1096 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs);
1093 1097
1094 output_buffer_map_.clear(); 1098 output_buffer_map_.clear();
1095 free_output_buffers_.clear(); 1099 free_output_buffers_.clear();
1096 } 1100 }
1097 1101
1098 } // namespace content 1102 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698