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

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

Issue 2086183003: V4L2VEA: fix keyframe is not generated on nyan (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
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 "media/gpu/v4l2_video_encode_accelerator.h" 5 #include "media/gpu/v4l2_video_encode_accelerator.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <linux/videodev2.h> 8 #include <linux/videodev2.h>
9 #include <poll.h> 9 #include <poll.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 if (force_keyframe) { 422 if (force_keyframe) {
423 // TODO(posciak): this presently makes for slightly imprecise encoding 423 // TODO(posciak): this presently makes for slightly imprecise encoding
424 // parameters updates. To precisely align the parameter updates with the 424 // parameters updates. To precisely align the parameter updates with the
425 // incoming input frame, we should queue the parameters together with the 425 // incoming input frame, we should queue the parameters together with the
426 // frame onto encoder_input_queue_ and apply them when the input is about 426 // frame onto encoder_input_queue_ and apply them when the input is about
427 // to be queued to the codec. 427 // to be queued to the codec.
428 std::vector<struct v4l2_ext_control> ctrls; 428 std::vector<struct v4l2_ext_control> ctrls;
429 struct v4l2_ext_control ctrl; 429 struct v4l2_ext_control ctrl;
430 memset(&ctrl, 0, sizeof(ctrl)); 430 memset(&ctrl, 0, sizeof(ctrl));
431 ctrl.id = V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME; 431 // Nyan still uses the old control and it reports success for unknown
432 // controls. Try the old control first.
433 // TODO(wuchengli): remove this after http://crosbug.com/p/53598 is fixed.
434 ctrl.id = V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE;
435 ctrl.value = V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME;
432 ctrls.push_back(ctrl); 436 ctrls.push_back(ctrl);
433 if (!SetExtCtrls(ctrls)) { 437 if (!SetExtCtrls(ctrls)) {
434 // Some platforms still use the old control. Fallback before they are
435 // updated.
436 ctrls.clear(); 438 ctrls.clear();
437 memset(&ctrl, 0, sizeof(ctrl)); 439 memset(&ctrl, 0, sizeof(ctrl));
438 ctrl.id = V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE; 440 ctrl.id = V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME;
439 ctrl.value = V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME;
440 ctrls.push_back(ctrl); 441 ctrls.push_back(ctrl);
441 if (!SetExtCtrls(ctrls)) { 442 if (!SetExtCtrls(ctrls)) {
442 LOG(ERROR) << "Failed requesting keyframe"; 443 LOG(ERROR) << "Failed requesting keyframe";
443 NOTIFY_ERROR(kPlatformFailureError); 444 NOTIFY_ERROR(kPlatformFailureError);
444 return; 445 return;
445 } 446 }
446 } 447 }
447 } 448 }
448 } 449 }
449 450
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 reqbufs.count = 0; 1249 reqbufs.count = 0;
1249 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 1250 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
1250 reqbufs.memory = V4L2_MEMORY_MMAP; 1251 reqbufs.memory = V4L2_MEMORY_MMAP;
1251 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); 1252 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs);
1252 1253
1253 output_buffer_map_.clear(); 1254 output_buffer_map_.clear();
1254 free_output_buffers_.clear(); 1255 free_output_buffers_.clear();
1255 } 1256 }
1256 1257
1257 } // namespace media 1258 } // namespace media
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