OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/video/capture/linux/v4l2_capture_delegate_multi_plane.h" | 5 #include "media/video/capture/linux/v4l2_capture_delegate_multi_plane.h" |
6 | 6 |
7 #include <sys/mman.h> | 7 #include <sys/mman.h> |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 void V4L2CaptureDelegateMultiPlane::FinishFillingV4L2Buffer( | 48 void V4L2CaptureDelegateMultiPlane::FinishFillingV4L2Buffer( |
49 v4l2_buffer* buffer) const { | 49 v4l2_buffer* buffer) const { |
50 buffer->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 50 buffer->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
51 buffer->length = v4l2_planes_.size(); | 51 buffer->length = v4l2_planes_.size(); |
52 | 52 |
53 static const struct v4l2_plane empty_plane = {}; | 53 static const struct v4l2_plane empty_plane = {}; |
54 std::fill(v4l2_planes_.begin(), v4l2_planes_.end(), empty_plane); | 54 std::fill(v4l2_planes_.begin(), v4l2_planes_.end(), empty_plane); |
55 buffer->m.planes = v4l2_planes_.data(); | 55 buffer->m.planes = v4l2_planes_.data(); |
56 } | 56 } |
57 | 57 |
58 void V4L2CaptureDelegateMultiPlane::FetchBytesUsed( | |
wuchengli
2015/05/25 07:22:19
s/FetchBytesUsed/SetBytesUsed/. The direction shou
kcwu
2015/05/25 07:36:25
Changed to SetPayloadSize per offline discussion.
| |
59 const scoped_refptr<BufferTracker>& buffer_tracker, | |
60 const v4l2_buffer* buffer) const { | |
wuchengli
2015/05/25 07:22:19
Use const reference. This is input.
kcwu
2015/05/25 07:36:25
Done.
| |
61 for (size_t i = 0; i < v4l2_planes_.size(); i++) | |
62 buffer_tracker->SetPlanePayload(i, buffer->m.planes[i].bytesused); | |
wuchengli
2015/05/25 07:22:19
s/SetPlanePayload/SetPlanePayloadSize/. Payload us
kcwu
2015/05/25 07:36:25
Done.
| |
63 } | |
64 | |
58 void V4L2CaptureDelegateMultiPlane::SendBuffer( | 65 void V4L2CaptureDelegateMultiPlane::SendBuffer( |
59 const scoped_refptr<BufferTracker>& buffer_tracker, | 66 const scoped_refptr<BufferTracker>& buffer_tracker, |
60 const v4l2_format& format) const { | 67 const v4l2_format& format) const { |
61 DCHECK_EQ(capture_format().pixel_format, PIXEL_FORMAT_I420); | 68 DCHECK_EQ(capture_format().pixel_format, PIXEL_FORMAT_I420); |
62 const size_t y_stride = format.fmt.pix_mp.plane_fmt[0].bytesperline; | 69 const size_t y_stride = format.fmt.pix_mp.plane_fmt[0].bytesperline; |
63 const size_t u_stride = format.fmt.pix_mp.plane_fmt[1].bytesperline; | 70 const size_t u_stride = format.fmt.pix_mp.plane_fmt[1].bytesperline; |
64 const size_t v_stride = format.fmt.pix_mp.plane_fmt[2].bytesperline; | 71 const size_t v_stride = format.fmt.pix_mp.plane_fmt[2].bytesperline; |
65 DCHECK_GE(y_stride, 1u * capture_format().frame_size.width()); | 72 DCHECK_GE(y_stride, 1u * capture_format().frame_size.width()); |
66 DCHECK_GE(u_stride, 1u * capture_format().frame_size.width() / 2); | 73 DCHECK_GE(u_stride, 1u * capture_format().frame_size.width() / 2); |
67 DCHECK_GE(v_stride, 1u * capture_format().frame_size.width() / 2); | 74 DCHECK_GE(v_stride, 1u * capture_format().frame_size.width() / 2); |
(...skipping 22 matching lines...) Expand all Loading... | |
90 return false; | 97 return false; |
91 } | 98 } |
92 AddMmapedPlane(static_cast<uint8_t*>(start), buffer.m.planes[p].length); | 99 AddMmapedPlane(static_cast<uint8_t*>(start), buffer.m.planes[p].length); |
93 DVLOG(3) << "Mmap()ed plane #" << p << " of " << buffer.m.planes[p].length | 100 DVLOG(3) << "Mmap()ed plane #" << p << " of " << buffer.m.planes[p].length |
94 << "B"; | 101 << "B"; |
95 } | 102 } |
96 return true; | 103 return true; |
97 } | 104 } |
98 | 105 |
99 } // namespace media | 106 } // namespace media |
OLD | NEW |