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

Side by Side Diff: media/video/capture/linux/v4l2_capture_delegate_single_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
« no previous file with comments | « media/video/capture/linux/v4l2_capture_delegate_single_plane.h ('k') | 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 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_single_plane.h" 5 #include "media/video/capture/linux/v4l2_capture_delegate_single_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 11 matching lines...) Expand all
22 format->fmt.pix.height = height; 22 format->fmt.pix.height = height;
23 format->fmt.pix.pixelformat = pixelformat_fourcc; 23 format->fmt.pix.pixelformat = pixelformat_fourcc;
24 return true; 24 return true;
25 } 25 }
26 26
27 void V4L2CaptureDelegateSinglePlane::FinishFillingV4L2Buffer( 27 void V4L2CaptureDelegateSinglePlane::FinishFillingV4L2Buffer(
28 v4l2_buffer* buffer) const { 28 v4l2_buffer* buffer) const {
29 buffer->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 29 buffer->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
30 } 30 }
31 31
32 void V4L2CaptureDelegateSinglePlane::SetPayloadSize(
33 const scoped_refptr<BufferTracker>& buffer_tracker,
34 const v4l2_buffer& buffer) const {
35 buffer_tracker->SetPlanePayloadSize(0, buffer.bytesused);
36 }
37
32 void V4L2CaptureDelegateSinglePlane::SendBuffer( 38 void V4L2CaptureDelegateSinglePlane::SendBuffer(
33 const scoped_refptr<BufferTracker>& buffer_tracker, 39 const scoped_refptr<BufferTracker>& buffer_tracker,
34 const v4l2_format& format) const { 40 const v4l2_format& format) const {
35 const size_t data_length = format.fmt.pix.sizeimage;
36 DCHECK_GE(data_length, capture_format().ImageAllocationSize());
37 client()->OnIncomingCapturedData( 41 client()->OnIncomingCapturedData(
38 buffer_tracker->GetPlaneStart(0), 42 buffer_tracker->GetPlaneStart(0),
39 data_length, 43 buffer_tracker->GetPlanePayloadSize(0),
40 capture_format(), 44 capture_format(),
41 rotation(), 45 rotation(),
42 base::TimeTicks::Now()); 46 base::TimeTicks::Now());
43 } 47 }
44 48
45 bool V4L2CaptureDelegateSinglePlane::BufferTrackerSPlane::Init( 49 bool V4L2CaptureDelegateSinglePlane::BufferTrackerSPlane::Init(
46 int fd, 50 int fd,
47 const v4l2_buffer& buffer) { 51 const v4l2_buffer& buffer) {
48 // Some devices require mmap() to be called with both READ and WRITE. 52 // Some devices require mmap() to be called with both READ and WRITE.
49 // See http://crbug.com/178582. 53 // See http://crbug.com/178582.
50 void* const start = mmap(NULL, buffer.length, PROT_READ | PROT_WRITE, 54 void* const start = mmap(NULL, buffer.length, PROT_READ | PROT_WRITE,
51 MAP_SHARED, fd, buffer.m.offset); 55 MAP_SHARED, fd, buffer.m.offset);
52 if (start == MAP_FAILED) { 56 if (start == MAP_FAILED) {
53 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace"; 57 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace";
54 return false; 58 return false;
55 } 59 }
56 AddMmapedPlane(static_cast<uint8_t*>(start), buffer.length); 60 AddMmapedPlane(static_cast<uint8_t*>(start), buffer.length);
57 return true; 61 return true;
58 } 62 }
59 63
60 } // namespace media 64 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/linux/v4l2_capture_delegate_single_plane.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698