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

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

Issue 2673373003: getUserMeida: report device starting states (Closed)
Patch Set: address comments on PS#7 Created 3 years, 10 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/capture/video/linux/v4l2_capture_delegate.h" 5 #include "media/capture/video/linux/v4l2_capture_delegate.h"
6 6
7 #include <linux/version.h> 7 #include <linux/version.h>
8 #include <linux/videodev2.h> 8 #include <linux/videodev2.h>
9 #include <poll.h> 9 #include <poll.h>
10 #include <sys/fcntl.h> 10 #include <sys/fcntl.h>
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 464 }
465 } 465 }
466 466
467 v4l2_buf_type capture_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 467 v4l2_buf_type capture_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
468 if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_STREAMON, &capture_type)) < 468 if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_STREAMON, &capture_type)) <
469 0) { 469 0) {
470 SetErrorState(FROM_HERE, "VIDIOC_STREAMON failed"); 470 SetErrorState(FROM_HERE, "VIDIOC_STREAMON failed");
471 return; 471 return;
472 } 472 }
473 473
474 client_->OnStarted();
474 is_capturing_ = true; 475 is_capturing_ = true;
476
475 // Post task to start fetching frames from v4l2. 477 // Post task to start fetching frames from v4l2.
476 v4l2_task_runner_->PostTask( 478 v4l2_task_runner_->PostTask(
477 FROM_HERE, base::Bind(&V4L2CaptureDelegate::DoCapture, this)); 479 FROM_HERE, base::Bind(&V4L2CaptureDelegate::DoCapture, this));
478 } 480 }
479 481
480 void V4L2CaptureDelegate::StopAndDeAllocate() { 482 void V4L2CaptureDelegate::StopAndDeAllocate() {
481 DCHECK(v4l2_task_runner_->BelongsToCurrentThread()); 483 DCHECK(v4l2_task_runner_->BelongsToCurrentThread());
482 // The order is important: stop streaming, clear |buffer_pool_|, 484 // The order is important: stop streaming, clear |buffer_pool_|,
483 // thus munmap()ing the v4l2_buffers, and then return them to the OS. 485 // thus munmap()ing the v4l2_buffers, and then return them to the OS.
484 v4l2_buf_type capture_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 486 v4l2_buf_type capture_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace"; 788 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace";
787 return false; 789 return false;
788 } 790 }
789 start_ = static_cast<uint8_t*>(start); 791 start_ = static_cast<uint8_t*>(start);
790 length_ = buffer.length; 792 length_ = buffer.length;
791 payload_size_ = 0; 793 payload_size_ = 0;
792 return true; 794 return true;
793 } 795 }
794 796
795 } // namespace media 797 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698