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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 | 101 |
102 // An implementation must start capture frames using the resolution in | 102 // An implementation must start capture frames using the resolution in |
103 // |params|. When the source has started or the source failed to start | 103 // |params|. When the source has started or the source failed to start |
104 // OnStartDone must be called. An implementation must call | 104 // OnStartDone must be called. An implementation must call |
105 // invoke |frame_callback| on the IO thread with the captured frames. | 105 // invoke |frame_callback| on the IO thread with the captured frames. |
106 // TODO(perkj): pass a VideoCaptureFormats instead of VideoCaptureParams for | 106 // TODO(perkj): pass a VideoCaptureFormats instead of VideoCaptureParams for |
107 // subclasses to customize. | 107 // subclasses to customize. |
108 virtual void StartSourceImpl( | 108 virtual void StartSourceImpl( |
109 const media::VideoCaptureParams& params, | 109 const media::VideoCaptureParams& params, |
110 const VideoCaptureDeliverFrameCB& frame_callback) = 0; | 110 const VideoCaptureDeliverFrameCB& frame_callback) = 0; |
111 void OnStartDone(bool success); | 111 void OnStartDone(content::MediaStreamRequestResult result); |
no longer working on chromium
2014/07/28 19:55:08
nit, you don't need content::
jiajia.qin
2014/07/30 05:18:07
Done.
| |
112 | 112 |
113 // An implementation must immediately stop capture video frames and must not | 113 // An implementation must immediately stop capture video frames and must not |
114 // call OnSupportedFormats after this method has been called. After this | 114 // call OnSupportedFormats after this method has been called. After this |
115 // method has been called, MediaStreamVideoSource may be deleted. | 115 // method has been called, MediaStreamVideoSource may be deleted. |
116 virtual void StopSourceImpl() = 0; | 116 virtual void StopSourceImpl() = 0; |
117 | 117 |
118 enum State { | 118 enum State { |
119 NEW, | 119 NEW, |
120 RETRIEVING_CAPABILITIES, | 120 RETRIEVING_CAPABILITIES, |
121 STARTING, | 121 STARTING, |
(...skipping 12 matching lines...) Expand all Loading... | |
134 const media::VideoCaptureFormats& formats, | 134 const media::VideoCaptureFormats& formats, |
135 media::VideoCaptureFormat* best_format); | 135 media::VideoCaptureFormat* best_format); |
136 | 136 |
137 // Trigger all cached callbacks from AddTrack. AddTrack is successful | 137 // Trigger all cached callbacks from AddTrack. AddTrack is successful |
138 // if the capture delegate has started and the constraints provided in | 138 // if the capture delegate has started and the constraints provided in |
139 // AddTrack match the format that was used to start the device. | 139 // AddTrack match the format that was used to start the device. |
140 // Note that it must be ok to delete the MediaStreamVideoSource object | 140 // Note that it must be ok to delete the MediaStreamVideoSource object |
141 // in the context of the callback. If gUM fail, the implementation will | 141 // in the context of the callback. If gUM fail, the implementation will |
142 // simply drop the references to the blink source and track which will lead | 142 // simply drop the references to the blink source and track which will lead |
143 // to that this object is deleted. | 143 // to that this object is deleted. |
144 void FinalizeAddTrack(); | 144 void FinalizeAddTrack(content::MediaStreamRequestResult result); |
no longer working on chromium
2014/07/28 19:55:08
ditto
jiajia.qin
2014/07/30 05:18:07
Done.
| |
145 | 145 |
146 State state_; | 146 State state_; |
147 | 147 |
148 // constraintName_ is used to record the name of constraint | |
149 // that causes ConstraintNotSatisfiedError | |
150 blink::WebString constraintName_; | |
no longer working on chromium
2014/07/28 19:55:08
how about changing the name to unsatisfied_constra
jiajia.qin
2014/07/30 05:18:08
Done.
| |
148 media::VideoCaptureFormat current_format_; | 151 media::VideoCaptureFormat current_format_; |
149 | 152 |
150 struct RequestedConstraints { | 153 struct RequestedConstraints { |
151 RequestedConstraints(MediaStreamVideoTrack* track, | 154 RequestedConstraints(MediaStreamVideoTrack* track, |
152 const VideoCaptureDeliverFrameCB& frame_callback, | 155 const VideoCaptureDeliverFrameCB& frame_callback, |
153 const blink::WebMediaConstraints& constraints, | 156 const blink::WebMediaConstraints& constraints, |
154 const ConstraintsCallback& callback); | 157 const ConstraintsCallback& callback); |
155 ~RequestedConstraints(); | 158 ~RequestedConstraints(); |
156 | 159 |
157 MediaStreamVideoTrack* track; | 160 MediaStreamVideoTrack* track; |
(...skipping 13 matching lines...) Expand all Loading... | |
171 | 174 |
172 // NOTE: Weak pointers must be invalidated before all other member variables. | 175 // NOTE: Weak pointers must be invalidated before all other member variables. |
173 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; | 176 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; |
174 | 177 |
175 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); | 178 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); |
176 }; | 179 }; |
177 | 180 |
178 } // namespace content | 181 } // namespace content |
179 | 182 |
180 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 183 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
OLD | NEW |