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

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

Issue 2085193002: V4L2VEA: fix keyframe is not generated on nyan (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string.h> 8 #include <string.h>
9 #include <sys/eventfd.h> 9 #include <sys/eventfd.h>
10 #include <sys/ioctl.h> 10 #include <sys/ioctl.h>
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 if (force_keyframe) { 354 if (force_keyframe) {
355 // TODO(posciak): this presently makes for slightly imprecise encoding 355 // TODO(posciak): this presently makes for slightly imprecise encoding
356 // parameters updates. To precisely align the parameter updates with the 356 // parameters updates. To precisely align the parameter updates with the
357 // incoming input frame, we should queue the parameters together with the 357 // incoming input frame, we should queue the parameters together with the
358 // frame onto encoder_input_queue_ and apply them when the input is about 358 // frame onto encoder_input_queue_ and apply them when the input is about
359 // to be queued to the codec. 359 // to be queued to the codec.
360 std::vector<struct v4l2_ext_control> ctrls; 360 std::vector<struct v4l2_ext_control> ctrls;
361 struct v4l2_ext_control ctrl; 361 struct v4l2_ext_control ctrl;
362 memset(&ctrl, 0, sizeof(ctrl)); 362 memset(&ctrl, 0, sizeof(ctrl));
363 ctrl.id = V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME; 363 // Nyan still uses the old control and it reports success for unknown
364 // controls. Try the old control first.
365 // TODO(wuchengli): remove this after http://crosbug.com/p/53598 is fixed.
366 ctrl.id = V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE;
367 ctrl.value = V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME;
364 ctrls.push_back(ctrl); 368 ctrls.push_back(ctrl);
365 if (!SetExtCtrls(ctrls)) { 369 if (!SetExtCtrls(ctrls)) {
366 // Some platforms still use the old control. Fallback before they are
367 // updated.
368 ctrls.clear(); 370 ctrls.clear();
369 memset(&ctrl, 0, sizeof(ctrl)); 371 memset(&ctrl, 0, sizeof(ctrl));
370 ctrl.id = V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE; 372 ctrl.id = V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME;
371 ctrl.value = V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME;
372 ctrls.push_back(ctrl); 373 ctrls.push_back(ctrl);
373 if (!SetExtCtrls(ctrls)) { 374 if (!SetExtCtrls(ctrls)) {
374 LOG(ERROR) << "Failed requesting keyframe"; 375 LOG(ERROR) << "Failed requesting keyframe";
375 NOTIFY_ERROR(kPlatformFailureError); 376 NOTIFY_ERROR(kPlatformFailureError);
376 return; 377 return;
377 } 378 }
378 } 379 }
379 } 380 }
380 } 381 }
381 382
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 reqbufs.count = 0; 1184 reqbufs.count = 0;
1184 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 1185 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
1185 reqbufs.memory = V4L2_MEMORY_MMAP; 1186 reqbufs.memory = V4L2_MEMORY_MMAP;
1186 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); 1187 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs);
1187 1188
1188 output_buffer_map_.clear(); 1189 output_buffer_map_.clear();
1189 free_output_buffers_.clear(); 1190 free_output_buffers_.clear();
1190 } 1191 }
1191 1192
1192 } // namespace content 1193 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698