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

Side by Side 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: address hta's comments 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_
7
8 #include <string>
9
10 #include "content/common/content_export.h"
11 #include "media/capture/video_capture_types.h"
12 #include "third_party/webrtc/base/optional.h"
13
14 namespace blink {
15 class WebMediaConstraints;
16 }
17
18 namespace content {
19
20 class CONTENT_EXPORT VideoContentCaptureSourceSelectionResult {
21 public:
22 // Creates a result without value and with the given |failed_constraint_name|.
23 explicit VideoContentCaptureSourceSelectionResult(
24 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.
25
26 // 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::
27 VideoContentCaptureSourceSelectionResult(
28 std::string device_id,
29 const rtc::Optional<bool>& noise_reduction,
30 media::VideoCaptureParams capture_params);
31
32 VideoContentCaptureSourceSelectionResult(
33 const VideoContentCaptureSourceSelectionResult& other);
34 VideoContentCaptureSourceSelectionResult& operator=(
35 const VideoContentCaptureSourceSelectionResult& other);
36 VideoContentCaptureSourceSelectionResult(
37 VideoContentCaptureSourceSelectionResult&& other);
38 VideoContentCaptureSourceSelectionResult& operator=(
39 VideoContentCaptureSourceSelectionResult&& other);
40 ~VideoContentCaptureSourceSelectionResult();
41
42 bool HasValue() const { return failed_constraint_name_ == nullptr; }
43
44 // Accessors.
45 const char* failed_constraint_name() const { return failed_constraint_name_; }
46 const std::string& device_id() const { return device_id_; }
47 const rtc::Optional<bool>& noise_reduction() const {
48 return noise_reduction_;
49 }
50 media::VideoCaptureParams capture_params() const { return capture_params_; }
51
52 // Convenience accessors for fields embedded in the |capture_params_| field.
53 int Height() const;
54 int Width() const;
55 float FrameRate() const;
56 media::ResolutionChangePolicy ResolutionChangePolicy() const;
57
58 private:
59 const char* failed_constraint_name_;
60 std::string device_id_;
61 rtc::Optional<bool> noise_reduction_;
62 media::VideoCaptureParams capture_params_;
63 };
64
65 VideoContentCaptureSourceSelectionResult CONTENT_EXPORT
66 SelectVideoContentCaptureSourceSettings(
67 const blink::WebMediaConstraints& constraints);
68
69 } // namespace content
70
71 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698