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

Side by Side Diff: content/renderer/media/media_stream_video_track.h

Issue 2922013002: Update constraints processing for video content capture. (Closed)
Patch Set: Rebase Created 3 years, 6 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_VIDEO_TRACK_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 static blink::WebMediaStreamTrack CreateVideoTrack( 45 static blink::WebMediaStreamTrack CreateVideoTrack(
46 MediaStreamVideoSource* source, 46 MediaStreamVideoSource* source,
47 const blink::WebMediaConstraints& constraints, 47 const blink::WebMediaConstraints& constraints,
48 const MediaStreamVideoSource::ConstraintsCallback& callback, 48 const MediaStreamVideoSource::ConstraintsCallback& callback,
49 bool enabled); 49 bool enabled);
50 static blink::WebMediaStreamTrack CreateVideoTrack( 50 static blink::WebMediaStreamTrack CreateVideoTrack(
51 MediaStreamVideoSource* source, 51 MediaStreamVideoSource* source,
52 const VideoTrackAdapterSettings& adapter_settings, 52 const VideoTrackAdapterSettings& adapter_settings,
53 const base::Optional<bool>& noise_reduction, 53 const base::Optional<bool>& noise_reduction,
54 bool is_screencast, 54 bool is_screencast,
55 double min_frame_rate, 55 const base::Optional<double>& min_frame_rate,
56 const MediaStreamVideoSource::ConstraintsCallback& callback, 56 const MediaStreamVideoSource::ConstraintsCallback& callback,
57 bool enabled); 57 bool enabled);
58 58
59 static MediaStreamVideoTrack* GetVideoTrack( 59 static MediaStreamVideoTrack* GetVideoTrack(
60 const blink::WebMediaStreamTrack& track); 60 const blink::WebMediaStreamTrack& track);
61 61
62 // Constructors for video tracks. 62 // Constructors for video tracks.
63 // TODO(guidou): Remove the variant that takes a |constraints| argument. 63 // TODO(guidou): Remove the variant that takes a |constraints| argument.
64 // http://crbug.com/706408 64 // http://crbug.com/706408
65 MediaStreamVideoTrack( 65 MediaStreamVideoTrack(
66 MediaStreamVideoSource* source, 66 MediaStreamVideoSource* source,
67 const MediaStreamVideoSource::ConstraintsCallback& callback, 67 const MediaStreamVideoSource::ConstraintsCallback& callback,
68 bool enabled); 68 bool enabled);
69 MediaStreamVideoTrack( 69 MediaStreamVideoTrack(
70 MediaStreamVideoSource* source, 70 MediaStreamVideoSource* source,
71 const blink::WebMediaConstraints& constraints, 71 const blink::WebMediaConstraints& constraints,
72 const MediaStreamVideoSource::ConstraintsCallback& callback, 72 const MediaStreamVideoSource::ConstraintsCallback& callback,
73 bool enabled); 73 bool enabled);
74 MediaStreamVideoTrack( 74 MediaStreamVideoTrack(
75 MediaStreamVideoSource* source, 75 MediaStreamVideoSource* source,
76 const VideoTrackAdapterSettings& adapter_settings, 76 const VideoTrackAdapterSettings& adapter_settings,
77 const base::Optional<bool>& noise_reduction, 77 const base::Optional<bool>& noise_reduction,
78 bool is_screen_cast, 78 bool is_screen_cast,
79 double min_frame_rate, 79 const base::Optional<double>& min_frame_rate,
80 const MediaStreamVideoSource::ConstraintsCallback& callback, 80 const MediaStreamVideoSource::ConstraintsCallback& callback,
81 bool enabled); 81 bool enabled);
82 ~MediaStreamVideoTrack() override; 82 ~MediaStreamVideoTrack() override;
83 83
84 // MediaStreamTrack overrides. 84 // MediaStreamTrack overrides.
85 void SetEnabled(bool enabled) override; 85 void SetEnabled(bool enabled) override;
86 void SetContentHint( 86 void SetContentHint(
87 blink::WebMediaStreamTrack::ContentHintType content_hint) override; 87 blink::WebMediaStreamTrack::ContentHintType content_hint) override;
88 void Stop() override; 88 void Stop() override;
89 void GetSettings(blink::WebMediaStreamTrack::Settings& settings) override; 89 void GetSettings(blink::WebMediaStreamTrack::Settings& settings) override;
90 90
91 void OnReadyStateChanged(blink::WebMediaStreamSource::ReadyState state); 91 void OnReadyStateChanged(blink::WebMediaStreamSource::ReadyState state);
92 92
93 const blink::WebMediaConstraints& constraints() const { 93 const blink::WebMediaConstraints& constraints() const {
94 DCHECK(IsOldVideoConstraints()); 94 DCHECK(IsOldVideoConstraints());
95 return constraints_; 95 return constraints_;
96 } 96 }
97 const base::Optional<bool>& noise_reduction() const { 97 const base::Optional<bool>& noise_reduction() const {
98 DCHECK(!IsOldVideoConstraints()); 98 DCHECK(!IsOldVideoConstraints());
99 return noise_reduction_; 99 return noise_reduction_;
100 } 100 }
101 bool is_screencast() const { 101 bool is_screencast() const {
102 DCHECK(!IsOldVideoConstraints()); 102 DCHECK(!IsOldVideoConstraints());
103 return is_screencast_; 103 return is_screencast_;
104 } 104 }
105 double min_frame_rate() const { 105 const base::Optional<double>& min_frame_rate() const {
106 DCHECK(!IsOldVideoConstraints()); 106 DCHECK(!IsOldVideoConstraints());
107 return min_frame_rate_; 107 return min_frame_rate_;
108 } 108 }
109 const base::Optional<double>& max_frame_rate() const {
110 DCHECK(!IsOldVideoConstraints());
111 return max_frame_rate_;
112 }
109 const VideoTrackAdapterSettings& adapter_settings() const { 113 const VideoTrackAdapterSettings& adapter_settings() const {
110 DCHECK(!IsOldVideoConstraints()); 114 DCHECK(!IsOldVideoConstraints());
111 return *adapter_settings_; 115 return *adapter_settings_;
112 } 116 }
113 117
114 // Setting information about the track size. 118 // Setting information about the track size.
115 // Called from MediaStreamVideoSource at track initialization. 119 // Called from MediaStreamVideoSource at track initialization.
116 void SetTargetSizeAndFrameRate(int width, int height, double frame_rate) { 120 void SetTargetSizeAndFrameRate(int width, int height, double frame_rate) {
117 width_ = width; 121 width_ = width;
118 height_ = height; 122 height_ = height;
(...skipping 26 matching lines...) Expand all
145 class FrameDeliverer; 149 class FrameDeliverer;
146 const scoped_refptr<FrameDeliverer> frame_deliverer_; 150 const scoped_refptr<FrameDeliverer> frame_deliverer_;
147 151
148 // TODO(guidou): remove this field. http://crbug.com/706408 152 // TODO(guidou): remove this field. http://crbug.com/706408
149 const blink::WebMediaConstraints constraints_; 153 const blink::WebMediaConstraints constraints_;
150 154
151 // TODO(guidou): Make this field a regular field instead of a unique_ptr. 155 // TODO(guidou): Make this field a regular field instead of a unique_ptr.
152 std::unique_ptr<VideoTrackAdapterSettings> adapter_settings_; 156 std::unique_ptr<VideoTrackAdapterSettings> adapter_settings_;
153 base::Optional<bool> noise_reduction_; 157 base::Optional<bool> noise_reduction_;
154 bool is_screencast_; 158 bool is_screencast_;
155 double min_frame_rate_; 159 base::Optional<double> min_frame_rate_;
160 base::Optional<double> max_frame_rate_;
156 161
157 // Weak ref to the source this tracks is connected to. 162 // Weak ref to the source this tracks is connected to.
158 base::WeakPtr<MediaStreamVideoSource> source_; 163 base::WeakPtr<MediaStreamVideoSource> source_;
159 164
160 // This is used for tracking if all connected video sinks are secure. 165 // This is used for tracking if all connected video sinks are secure.
161 SecureDisplayLinkTracker<MediaStreamVideoSink> secure_tracker_; 166 SecureDisplayLinkTracker<MediaStreamVideoSink> secure_tracker_;
162 167
163 // Remembering our desired video size and frame rate. 168 // Remembering our desired video size and frame rate.
164 int width_ = 0; 169 int width_ = 0;
165 int height_ = 0; 170 int height_ = 0;
166 double frame_rate_ = 0.0; 171 double frame_rate_ = 0.0;
167 172
168 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack); 173 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack);
169 }; 174 };
170 175
171 } // namespace content 176 } // namespace content
172 177
173 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_ 178 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698