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

Unified Diff: content/renderer/media/media_stream_video_track.cc

Issue 2970453003: Add support for facingMode in MediaStreamTrack.getSettings() on Android. (Closed)
Patch Set: fix comment Created 3 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_video_track.cc
diff --git a/content/renderer/media/media_stream_video_track.cc b/content/renderer/media/media_stream_video_track.cc
index d23adb2d19126a68a59d0401d10207d8309ec4fa..d275a0e9058ba1ade9d616730abd66013c3957fe 100644
--- a/content/renderer/media/media_stream_video_track.cc
+++ b/content/renderer/media/media_stream_video_track.cc
@@ -4,6 +4,7 @@
#include "content/renderer/media/media_stream_video_track.h"
+#include <string>
#include <utility>
#include "base/bind.h"
@@ -12,6 +13,7 @@
#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "build/build_config.h"
#include "content/renderer/media/media_stream_constraints_util_video_device.h"
#include "media/capture/video_capture_types.h"
@@ -426,6 +428,19 @@ void MediaStreamVideoTrack::GetSettings(
settings.facing_mode = blink::WebMediaStreamTrack::FacingMode::kNone;
break;
}
+#if defined(OS_ANDROID)
+ // On Android, the facing mode is not available in the |video_facing| field,
+ // but is available as part of the label.
+ // TODO(guidou): Remove this code once the |video_facing| field is supported
+ // on Android. See http://crbug.com/672856.
+ if (source_->device_info().device.name.find("front") != std::string::npos) {
+ settings.facing_mode = blink::WebMediaStreamTrack::FacingMode::kUser;
+ } else if (source_->device_info().device.name.find("back") !=
+ std::string::npos) {
+ settings.facing_mode = blink::WebMediaStreamTrack::FacingMode::kEnvironment;
+ }
+#endif
+
const base::Optional<CameraCalibration> calibration =
source_->device_info().device.camera_calibration;
if (calibration) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698