Chromium Code Reviews| 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..a1d2dfbab1fd4dc82c2d1cdb3bb39c8a91c487a0 |
| --- /dev/null |
| +++ b/content/renderer/media/media_stream_constraints_util_video_content.h |
| @@ -0,0 +1,71 @@ |
| +// 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|. |
| + explicit VideoContentCaptureSourceSelectionResult( |
| + const char* failed_constraint_name); |
|
hta - Chromium
2017/03/10 08:51:46
In this case, the ownership of failed_constraint_n
Guido Urdaneta
2017/03/14 12:29:06
Done.
|
| + |
| + // Creates a result with the given values. Takes ownership of |device_id|. |
|
hbos_chromium
2017/03/09 16:51:10
Since |device_id| is passed by value it is essenti
hta - Chromium
2017/03/10 08:51:46
It should probably be const std::string& since it'
Guido Urdaneta
2017/03/14 12:29:06
I've seen this wording used for when the values is
Guido Urdaneta
2017/03/14 12:29:06
It is actually moved (not copied) to a local std::
|
| + 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_; |
| +}; |
| + |
| +VideoContentCaptureSourceSelectionResult CONTENT_EXPORT |
| +SelectVideoContentCaptureSourceSettings( |
| + const blink::WebMediaConstraints& constraints); |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_ |