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

Unified Diff: content/renderer/media/media_stream_constraints_util_video_content.h

Issue 2735793002: Add algorithm for processing constraints for video content capture. (Closed)
Patch Set: fix android/win_clang compilation issue Created 3 years, 9 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 | « content/renderer/BUILD.gn ('k') | content/renderer/media/media_stream_constraints_util_video_content.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_constraints_util_video_content.h
diff --git a/content/renderer/media/media_stream_constraints_util_video_content.h b/content/renderer/media/media_stream_constraints_util_video_content.h
new file mode 100644
index 0000000000000000000000000000000000000000..5ec86dd9d8c5681587c8c633d931619dfae008cc
--- /dev/null
+++ b/content/renderer/media/media_stream_constraints_util_video_content.h
@@ -0,0 +1,76 @@
+// Copyright 2017 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.
+
+#ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_
+#define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_
+
+#include <string>
+
+#include "content/common/content_export.h"
+#include "media/capture/video_capture_types.h"
+#include "third_party/webrtc/base/optional.h"
+
+namespace blink {
+class WebMediaConstraints;
+}
+
+namespace content {
+
+class CONTENT_EXPORT VideoContentCaptureSourceSelectionResult {
+ public:
+ // Creates a result without value and with the given |failed_constraint_name|.
+ // Does not take ownership of |failed_constraint_name|, so it must be null or
+ // point to a string that remains accessible.
+ explicit VideoContentCaptureSourceSelectionResult(
+ const char* failed_constraint_name);
+
+ // Creates a result with the given values. |device_id| is moved to an internal
+ // field.
+ VideoContentCaptureSourceSelectionResult(
+ std::string device_id,
+ const rtc::Optional<bool>& noise_reduction,
+ media::VideoCaptureParams capture_params);
+
+ VideoContentCaptureSourceSelectionResult(
+ const VideoContentCaptureSourceSelectionResult& other);
+ VideoContentCaptureSourceSelectionResult& operator=(
+ const VideoContentCaptureSourceSelectionResult& other);
+ VideoContentCaptureSourceSelectionResult(
+ VideoContentCaptureSourceSelectionResult&& other);
+ VideoContentCaptureSourceSelectionResult& operator=(
+ VideoContentCaptureSourceSelectionResult&& other);
+ ~VideoContentCaptureSourceSelectionResult();
+
+ bool HasValue() const { return failed_constraint_name_ == nullptr; }
+
+ // Accessors.
+ const char* failed_constraint_name() const { return failed_constraint_name_; }
+ const std::string& device_id() const { return device_id_; }
+ const rtc::Optional<bool>& noise_reduction() const {
+ return noise_reduction_;
+ }
+ media::VideoCaptureParams capture_params() const { return capture_params_; }
+
+ // Convenience accessors for fields embedded in the |capture_params_| field.
+ int Height() const;
+ int Width() const;
+ float FrameRate() const;
+ media::ResolutionChangePolicy ResolutionChangePolicy() const;
+
+ private:
+ const char* failed_constraint_name_;
+ std::string device_id_;
+ rtc::Optional<bool> noise_reduction_;
+ media::VideoCaptureParams capture_params_;
+};
+
+// This function performs source and source-settings selection for content
+// video capture based on the given |constraints|.
+VideoContentCaptureSourceSelectionResult CONTENT_EXPORT
+SelectVideoContentCaptureSourceSettings(
+ const blink::WebMediaConstraints& constraints);
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_
« no previous file with comments | « content/renderer/BUILD.gn ('k') | content/renderer/media/media_stream_constraints_util_video_content.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698