OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/logging.h" |
10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
11 #include "media/capture/video_capture_types.h" | 12 #include "media/capture/video_capture_types.h" |
12 #include "third_party/webrtc/base/optional.h" | 13 #include "third_party/webrtc/base/optional.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 class WebMediaConstraints; | 16 class WebMediaConstraints; |
16 } | 17 } |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
(...skipping 19 matching lines...) Expand all Loading... |
39 VideoContentCaptureSourceSelectionResult( | 40 VideoContentCaptureSourceSelectionResult( |
40 VideoContentCaptureSourceSelectionResult&& other); | 41 VideoContentCaptureSourceSelectionResult&& other); |
41 VideoContentCaptureSourceSelectionResult& operator=( | 42 VideoContentCaptureSourceSelectionResult& operator=( |
42 VideoContentCaptureSourceSelectionResult&& other); | 43 VideoContentCaptureSourceSelectionResult&& other); |
43 ~VideoContentCaptureSourceSelectionResult(); | 44 ~VideoContentCaptureSourceSelectionResult(); |
44 | 45 |
45 bool HasValue() const { return failed_constraint_name_ == nullptr; } | 46 bool HasValue() const { return failed_constraint_name_ == nullptr; } |
46 | 47 |
47 // Accessors. | 48 // Accessors. |
48 const char* failed_constraint_name() const { return failed_constraint_name_; } | 49 const char* failed_constraint_name() const { return failed_constraint_name_; } |
49 const std::string& device_id() const { return device_id_; } | 50 const std::string& device_id() const { |
| 51 DCHECK(HasValue()); |
| 52 return device_id_; |
| 53 } |
50 const rtc::Optional<bool>& noise_reduction() const { | 54 const rtc::Optional<bool>& noise_reduction() const { |
| 55 DCHECK(HasValue()); |
51 return noise_reduction_; | 56 return noise_reduction_; |
52 } | 57 } |
53 media::VideoCaptureParams capture_params() const { return capture_params_; } | 58 media::VideoCaptureParams capture_params() const { |
| 59 DCHECK(HasValue()); |
| 60 return capture_params_; |
| 61 } |
54 | 62 |
55 // Convenience accessors for fields embedded in the |capture_params_| field. | 63 // Convenience accessors for fields embedded in the |capture_params_| field. |
56 int Height() const; | 64 int Height() const; |
57 int Width() const; | 65 int Width() const; |
58 float FrameRate() const; | 66 float FrameRate() const; |
59 media::ResolutionChangePolicy ResolutionChangePolicy() const; | 67 media::ResolutionChangePolicy ResolutionChangePolicy() const; |
60 | 68 |
61 private: | 69 private: |
62 const char* failed_constraint_name_; | 70 const char* failed_constraint_name_; |
63 std::string device_id_; | 71 std::string device_id_; |
64 rtc::Optional<bool> noise_reduction_; | 72 rtc::Optional<bool> noise_reduction_; |
65 media::VideoCaptureParams capture_params_; | 73 media::VideoCaptureParams capture_params_; |
66 }; | 74 }; |
67 | 75 |
68 // This function performs source and source-settings selection for content | 76 // This function performs source and source-settings selection for content |
69 // video capture based on the given |constraints|. | 77 // video capture based on the given |constraints|. |
70 VideoContentCaptureSourceSelectionResult CONTENT_EXPORT | 78 VideoContentCaptureSourceSelectionResult CONTENT_EXPORT |
71 SelectVideoContentCaptureSourceSettings( | 79 SelectVideoContentCaptureSourceSettings( |
72 const blink::WebMediaConstraints& constraints); | 80 const blink::WebMediaConstraints& constraints); |
73 | 81 |
74 } // namespace content | 82 } // namespace content |
75 | 83 |
76 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_ | 84 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_ |
OLD | NEW |