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

Side by Side Diff: media/video/capture/linux/v4l2_capture_delegate_multi_plane.cc

Issue 1147693002: Send bytes_used of v4l2 captured frame when video capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::SendBuffer( 58 void V4L2CaptureDelegateMultiPlane::SendBuffer(
59 const scoped_refptr<BufferTracker>& buffer_tracker, 59 const scoped_refptr<BufferTracker>& buffer_tracker,
60 const v4l2_format& format) const { 60 const v4l2_format& format,
61 size_t /*bytes_used*/) const {
wuchengli 2015/05/19 04:05:54 From the v4l2 documentation, bytesused is ignored
wuchengli 2015/05/19 04:18:51 Kuang-che told me bytesused is different for every
Pawel Osciak 2015/05/20 07:29:02 Personally I liked the idea to add this to BufferT
kcwu 2015/05/20 12:14:52 Done.
61 DCHECK_EQ(capture_format().pixel_format, PIXEL_FORMAT_I420); 62 DCHECK_EQ(capture_format().pixel_format, PIXEL_FORMAT_I420);
62 const size_t y_stride = format.fmt.pix_mp.plane_fmt[0].bytesperline; 63 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; 64 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; 65 const size_t v_stride = format.fmt.pix_mp.plane_fmt[2].bytesperline;
65 DCHECK_GE(y_stride, 1u * capture_format().frame_size.width()); 66 DCHECK_GE(y_stride, 1u * capture_format().frame_size.width());
66 DCHECK_GE(u_stride, 1u * capture_format().frame_size.width() / 2); 67 DCHECK_GE(u_stride, 1u * capture_format().frame_size.width() / 2);
67 DCHECK_GE(v_stride, 1u * capture_format().frame_size.width() / 2); 68 DCHECK_GE(v_stride, 1u * capture_format().frame_size.width() / 2);
68 client()->OnIncomingCapturedYuvData(buffer_tracker->GetPlaneStart(0), 69 client()->OnIncomingCapturedYuvData(buffer_tracker->GetPlaneStart(0),
69 buffer_tracker->GetPlaneStart(1), 70 buffer_tracker->GetPlaneStart(1),
70 buffer_tracker->GetPlaneStart(2), 71 buffer_tracker->GetPlaneStart(2),
(...skipping 19 matching lines...) Expand all
90 return false; 91 return false;
91 } 92 }
92 AddMmapedPlane(static_cast<uint8_t*>(start), buffer.m.planes[p].length); 93 AddMmapedPlane(static_cast<uint8_t*>(start), buffer.m.planes[p].length);
93 DVLOG(3) << "Mmap()ed plane #" << p << " of " << buffer.m.planes[p].length 94 DVLOG(3) << "Mmap()ed plane #" << p << " of " << buffer.m.planes[p].length
94 << "B"; 95 << "B";
95 } 96 }
96 return true; 97 return true;
97 } 98 }
98 99
99 } // namespace media 100 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698