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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 | 104 |
105 // An implementation must start capture frames using the resolution in | 105 // An implementation must start capture frames using the resolution in |
106 // |params|. When the source has started or the source failed to start | 106 // |params|. When the source has started or the source failed to start |
107 // OnStartDone must be called. An implementation must call | 107 // OnStartDone must be called. An implementation must call |
108 // invoke |frame_callback| on the IO thread with the captured frames. | 108 // invoke |frame_callback| on the IO thread with the captured frames. |
109 // TODO(perkj): pass a VideoCaptureFormats instead of VideoCaptureParams for | 109 // TODO(perkj): pass a VideoCaptureFormats instead of VideoCaptureParams for |
110 // subclasses to customize. | 110 // subclasses to customize. |
111 virtual void StartSourceImpl( | 111 virtual void StartSourceImpl( |
112 const media::VideoCaptureParams& params, | 112 const media::VideoCaptureParams& params, |
113 const VideoCaptureDeliverFrameCB& frame_callback) = 0; | 113 const VideoCaptureDeliverFrameCB& frame_callback) = 0; |
114 void OnStartDone(bool success); | 114 void OnStartDone(MediaStreamRequestResult result); |
115 | 115 |
116 // An implementation must immediately stop capture video frames and must not | 116 // An implementation must immediately stop capture video frames and must not |
117 // call OnSupportedFormats after this method has been called. After this | 117 // call OnSupportedFormats after this method has been called. After this |
118 // method has been called, MediaStreamVideoSource may be deleted. | 118 // method has been called, MediaStreamVideoSource may be deleted. |
119 virtual void StopSourceImpl() = 0; | 119 virtual void StopSourceImpl() = 0; |
120 | 120 |
121 enum State { | 121 enum State { |
122 NEW, | 122 NEW, |
123 RETRIEVING_CAPABILITIES, | 123 RETRIEVING_CAPABILITIES, |
124 STARTING, | 124 STARTING, |
(...skipping 12 matching lines...) Expand all Loading... | |
137 const media::VideoCaptureFormats& formats, | 137 const media::VideoCaptureFormats& formats, |
138 media::VideoCaptureFormat* best_format); | 138 media::VideoCaptureFormat* best_format); |
139 | 139 |
140 // Trigger all cached callbacks from AddTrack. AddTrack is successful | 140 // Trigger all cached callbacks from AddTrack. AddTrack is successful |
141 // if the capture delegate has started and the constraints provided in | 141 // if the capture delegate has started and the constraints provided in |
142 // AddTrack match the format that was used to start the device. | 142 // AddTrack match the format that was used to start the device. |
143 // Note that it must be ok to delete the MediaStreamVideoSource object | 143 // Note that it must be ok to delete the MediaStreamVideoSource object |
144 // in the context of the callback. If gUM fail, the implementation will | 144 // in the context of the callback. If gUM fail, the implementation will |
145 // simply drop the references to the blink source and track which will lead | 145 // simply drop the references to the blink source and track which will lead |
146 // to that this object is deleted. | 146 // to that this object is deleted. |
147 void FinalizeAddTrack(); | 147 void FinalizeAddTrack(MediaStreamRequestResult result); |
148 | 148 |
149 State state_; | 149 State state_; |
150 bool muted_state_; | 150 bool muted_state_; |
151 | 151 |
152 // unsatisfied_constraint_ is used to record the name of constraint | |
153 // that causes ConstraintNotSatisfiedError | |
154 blink::WebString unsatisfied_constraint_; | |
miu
2014/07/30 19:37:23
You don't want this here, as it obfuscates the lif
jiajia.qin
2014/07/31 13:43:01
Done.
| |
152 media::VideoCaptureFormat current_format_; | 155 media::VideoCaptureFormat current_format_; |
153 | 156 |
154 struct RequestedConstraints { | 157 struct RequestedConstraints { |
155 RequestedConstraints(MediaStreamVideoTrack* track, | 158 RequestedConstraints(MediaStreamVideoTrack* track, |
156 const VideoCaptureDeliverFrameCB& frame_callback, | 159 const VideoCaptureDeliverFrameCB& frame_callback, |
157 const blink::WebMediaConstraints& constraints, | 160 const blink::WebMediaConstraints& constraints, |
158 const ConstraintsCallback& callback); | 161 const ConstraintsCallback& callback); |
159 ~RequestedConstraints(); | 162 ~RequestedConstraints(); |
160 | 163 |
161 MediaStreamVideoTrack* track; | 164 MediaStreamVideoTrack* track; |
(...skipping 13 matching lines...) Expand all Loading... | |
175 | 178 |
176 // NOTE: Weak pointers must be invalidated before all other member variables. | 179 // NOTE: Weak pointers must be invalidated before all other member variables. |
177 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; | 180 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; |
178 | 181 |
179 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); | 182 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); |
180 }; | 183 }; |
181 | 184 |
182 } // namespace content | 185 } // namespace content |
183 | 186 |
184 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 187 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
OLD | NEW |