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

Unified Diff: media/video/capture/linux/video_capture_device_linux.cc

Issue 270263008: Add a ChromeOS implementation of VideoCaptureDevice (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 side-by-side diff with in-line comments
Download patch
Index: media/video/capture/linux/video_capture_device_linux.cc
diff --git a/media/video/capture/linux/video_capture_device_linux.cc b/media/video/capture/linux/video_capture_device_linux.cc
index 232978a4eda212a92ecf07bd80c0be08b899856a..c1daaa24057ee0a966b3cf7a32cad65afdaa9256 100644
--- a/media/video/capture/linux/video_capture_device_linux.cc
+++ b/media/video/capture/linux/video_capture_device_linux.cc
@@ -113,7 +113,9 @@ void VideoCaptureDeviceLinux::GetListOfUsableFourCCs(bool favour_mjpeg,
// VideoCaptureDeviceFactory.
// static
-VideoCaptureDevice* VideoCaptureDevice::Create(const Name& device_name) {
+VideoCaptureDevice* VideoCaptureDevice::Create(
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
+ const Name& device_name) {
NOTREACHED();
return NULL;
}
@@ -157,7 +159,9 @@ VideoCaptureDeviceLinux::VideoCaptureDeviceLinux(const Name& device_name)
v4l2_thread_("V4L2Thread"),
buffer_pool_(NULL),
buffer_pool_size_(0),
- timeout_count_(0) {}
+ timeout_count_(0),
+ rotation_(0) {
+}
VideoCaptureDeviceLinux::~VideoCaptureDeviceLinux() {
state_ = kIdle;
@@ -199,6 +203,25 @@ void VideoCaptureDeviceLinux::StopAndDeAllocate() {
DeAllocateVideoBuffers();
}
+void VideoCaptureDeviceLinux::SetRotation(int rotation) {
+ if (v4l2_thread_.IsRunning()) {
+ v4l2_thread_.message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&VideoCaptureDeviceLinux::SetRotationOnV4L2Thread,
+ base::Unretained(this), rotation));
+ } else {
+ // If the |v4l2_thread_| is not running, there's no race condition and
+ // |rotation_| can be set directly.
+ rotation_ = rotation;
+ }
+}
+
+void VideoCaptureDeviceLinux::SetRotationOnV4L2Thread(int rotation) {
+ DCHECK_EQ(v4l2_thread_.message_loop(), base::MessageLoop::current());
+ DCHECK(rotation >= 0 && rotation < 360 && rotation % 90 == 0);
+ rotation_ = rotation;
+}
+
void VideoCaptureDeviceLinux::OnAllocateAndStart(int width,
int height,
int frame_rate,
@@ -407,7 +430,7 @@ void VideoCaptureDeviceLinux::OnCaptureTask() {
static_cast<uint8*>(buffer_pool_[buffer.index].start),
buffer.bytesused,
capture_format_,
- 0,
+ rotation_,
base::TimeTicks::Now());
// Enqueue the buffer again.
« no previous file with comments | « media/video/capture/linux/video_capture_device_linux.h ('k') | media/video/capture/mac/video_capture_device_factory_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698