OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Puts |track| in the registered tracks list. | 57 // Puts |track| in the registered tracks list. |
58 void AddTrack(MediaStreamVideoTrack* track, | 58 void AddTrack(MediaStreamVideoTrack* track, |
59 const blink::WebMediaConstraints& constraints, | 59 const blink::WebMediaConstraints& constraints, |
60 const ConstraintsCallback& callback); | 60 const ConstraintsCallback& callback); |
61 void RemoveTrack(MediaStreamVideoTrack* track); | 61 void RemoveTrack(MediaStreamVideoTrack* track); |
62 | 62 |
63 // TODO(ronghuawu): Remove webrtc::VideoSourceInterface from the public | 63 // TODO(ronghuawu): Remove webrtc::VideoSourceInterface from the public |
64 // interface of this class. | 64 // interface of this class. |
65 // This creates a VideoSourceInterface implementation if it does not already | 65 // This creates a VideoSourceInterface implementation if it does not already |
66 // exist. | 66 // exist. |
67 webrtc::VideoSourceInterface* GetAdapter(); | 67 virtual webrtc::VideoSourceInterface* GetAdapter(); |
68 | 68 |
69 // Return true if |name| is a constraint supported by MediaStreamVideoSource. | 69 // Return true if |name| is a constraint supported by MediaStreamVideoSource. |
70 static bool IsConstraintSupported(const std::string& name); | 70 static bool IsConstraintSupported(const std::string& name); |
71 | 71 |
72 // Constraint keys used by a video source. | 72 // Constraint keys used by a video source. |
73 // Specified by draft-alvestrand-constraints-resolution-00b | 73 // Specified by draft-alvestrand-constraints-resolution-00b |
74 static const char kMinAspectRatio[]; // minAspectRatio | 74 static const char kMinAspectRatio[]; // minAspectRatio |
75 static const char kMaxAspectRatio[]; // maxAspectRatio | 75 static const char kMaxAspectRatio[]; // maxAspectRatio |
76 static const char kMaxWidth[]; // maxWidth | 76 static const char kMaxWidth[]; // maxWidth |
77 static const char kMinWidth[]; // minWidthOnCaptureFormats | 77 static const char kMinWidth[]; // minWidthOnCaptureFormats |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // method has been called, MediaStreamVideoSource may be deleted. | 123 // method has been called, MediaStreamVideoSource may be deleted. |
124 virtual void StopSourceImpl() = 0; | 124 virtual void StopSourceImpl() = 0; |
125 | 125 |
126 enum State { | 126 enum State { |
127 NEW, | 127 NEW, |
128 RETRIEVING_CAPABILITIES, | 128 RETRIEVING_CAPABILITIES, |
129 STARTING, | 129 STARTING, |
130 STARTED, | 130 STARTED, |
131 ENDED | 131 ENDED |
132 }; | 132 }; |
133 State state() { return state_; } | 133 State state() const { return state_; } |
134 | 134 |
135 private: | 135 private: |
136 // Creates a webrtc::VideoSourceInterface used by libjingle. | 136 // Creates a webrtc::VideoSourceInterface used by libjingle. |
137 void InitAdapter(); | 137 void InitAdapter(); |
138 | 138 |
139 // Finds the first constraints in |requested_constraints_| that can be | 139 // Finds the first constraints in |requested_constraints_| that can be |
140 // fulfilled. |best_format| is set to the video resolution that can be | 140 // fulfilled. |best_format| is set to the video resolution that can be |
141 // fulfilled. |frame_output_size| is the requested frame size after cropping. | 141 // fulfilled. |frame_output_size| is the requested frame size after cropping. |
142 // |resulting_constraints| is set to the found constraints in | 142 // |resulting_constraints| is set to the found constraints in |
143 // |requested_constraints_|. | 143 // |requested_constraints_|. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 MediaStreamDependencyFactory* factory_; | 178 MediaStreamDependencyFactory* factory_; |
179 scoped_refptr<webrtc::VideoSourceInterface> adapter_; | 179 scoped_refptr<webrtc::VideoSourceInterface> adapter_; |
180 WebRtcVideoCapturerAdapter* capture_adapter_; | 180 WebRtcVideoCapturerAdapter* capture_adapter_; |
181 | 181 |
182 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); | 182 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); |
183 }; | 183 }; |
184 | 184 |
185 } // namespace content | 185 } // namespace content |
186 | 186 |
187 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 187 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
OLD | NEW |