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

Unified Diff: media/base/video_facing.cc

Issue 2634263002: Pass camera facing info to audio client (Closed)
Patch Set: refactor to pass VideoCaptureObserver in setters, not in ctor Created 3 years, 11 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
« media/base/video_facing.h ('K') | « media/base/video_facing.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_facing.cc
diff --git a/media/base/video_facing.cc b/media/base/video_facing.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e788bae770b3f021ad53071f97b2e6674736b06f
--- /dev/null
+++ b/media/base/video_facing.cc
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/video_facing.h"
+
+#if defined(OS_CHROMEOS)
+namespace {
+
+chromeos::VideoFacingMode ConvertVideoFacing(media::VideoFacingMode facing) {
+ switch (facing) {
+ case media::VideoFacingMode::MEDIA_VIDEO_FACING_NONE:
+ case media::VideoFacingMode::NUM_MEDIA_VIDEO_FACING_MODE:
+ return chromeos::VideoFacingMode::NONE;
+ case media::VideoFacingMode::MEDIA_VIDEO_FACING_USER:
+ return chromeos::VideoFacingMode::USER;
+ case media::VideoFacingMode::MEDIA_VIDEO_FACING_ENVIRONMENT:
+ return chromeos::VideoFacingMode::ENVIRONMENT;
+ }
+ return chromeos::VideoFacingMode::NONE;
+}
+}
+#endif
+
+namespace media {
+
+#if defined(OS_CHROMEOS)
+VideoCaptureObserver::VideoCaptureObserver(
+ chromeos::VideoCaptureObserver* observer)
+ : observer_(observer) {}
+#endif
+
+VideoCaptureObserver::VideoCaptureObserver()
+#if defined(OS_CHROMEOS)
+ : observer_(NULL)
+#endif
+{
+}
+
+void VideoCaptureObserver::OnVideoCaptureStarted(VideoFacingMode facing) {
+#if defined(OS_CHROMEOS)
+ if (observer_ != NULL) {
+ observer_->OnVideoCaptureStarted(ConvertVideoFacing(facing));
+ }
+#endif
+}
+
+void VideoCaptureObserver::OnVideoCaptureStopped(VideoFacingMode facing) {
+#if defined(OS_CHROMEOS)
+ if (observer_ != NULL) {
+ observer_->OnVideoCaptureStopped(ConvertVideoFacing(facing));
+ }
+#endif
+}
+}
« media/base/video_facing.h ('K') | « media/base/video_facing.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698