Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |
|
Pawel Osciak
2016/06/16 07:54:46
Please add a TODO() with a crbug link.
wuchengli
2016/06/16 08:18:57
Done.
| |
| 432 // controls. Try the old control first. | |
| 433 ctrl.id = V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE; | |
| 434 ctrl.value = V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME; | |
| 432 ctrls.push_back(ctrl); | 435 ctrls.push_back(ctrl); |
| 433 if (!SetExtCtrls(ctrls)) { | 436 if (!SetExtCtrls(ctrls)) { |
| 434 // Some platforms still use the old control. Fallback before they are | |
| 435 // updated. | |
| 436 ctrls.clear(); | 437 ctrls.clear(); |
| 437 memset(&ctrl, 0, sizeof(ctrl)); | 438 memset(&ctrl, 0, sizeof(ctrl)); |
| 438 ctrl.id = V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE; | 439 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); | 440 ctrls.push_back(ctrl); |
| 441 if (!SetExtCtrls(ctrls)) { | 441 if (!SetExtCtrls(ctrls)) { |
| 442 LOG(ERROR) << "Failed requesting keyframe"; | 442 LOG(ERROR) << "Failed requesting keyframe"; |
| 443 NOTIFY_ERROR(kPlatformFailureError); | 443 NOTIFY_ERROR(kPlatformFailureError); |
| 444 return; | 444 return; |
| 445 } | 445 } |
| 446 } | 446 } |
| 447 } | 447 } |
| 448 } | 448 } |
| 449 | 449 |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1256 reqbufs.count = 0; | 1256 reqbufs.count = 0; |
| 1257 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 1257 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
| 1258 reqbufs.memory = V4L2_MEMORY_MMAP; | 1258 reqbufs.memory = V4L2_MEMORY_MMAP; |
| 1259 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); | 1259 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); |
| 1260 | 1260 |
| 1261 output_buffer_map_.clear(); | 1261 output_buffer_map_.clear(); |
| 1262 free_output_buffers_.clear(); | 1262 free_output_buffers_.clear(); |
| 1263 } | 1263 } |
| 1264 | 1264 |
| 1265 } // namespace media | 1265 } // namespace media |
| OLD | NEW |