| 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 <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 protected: | 87 protected: |
| 88 void DoStopSource() override; | 88 void DoStopSource() override; |
| 89 | 89 |
| 90 // Sets ready state and notifies the ready state to all registered tracks. | 90 // Sets ready state and notifies the ready state to all registered tracks. |
| 91 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); | 91 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); |
| 92 | 92 |
| 93 // Sets muted state and notifies it to all registered tracks. | 93 // Sets muted state and notifies it to all registered tracks. |
| 94 virtual void SetMutedState(bool state); | 94 virtual void SetMutedState(bool state); |
| 95 | 95 |
| 96 // TODO(guidou): Rename to GetCurrentFormat. http://crbug.com/706804 | 96 // An implementation must return its capture format if available. |
| 97 virtual base::Optional<media::VideoCaptureFormat> GetCurrentFormatImpl() | 97 virtual base::Optional<media::VideoCaptureFormat> GetCurrentFormatImpl() |
| 98 const; | 98 const; |
| 99 | 99 |
| 100 // An implementation must start capturing frames using the requested | 100 // An implementation must start capturing frames after this method is called. |
| 101 // |format|. The fulfilled |constraints| are provided as additional context, | 101 // When the source has started or failed to start OnStartDone must be called. |
| 102 // and may be used to modify the behavior of the source. When the source has | 102 // An implementation must call |frame_callback| on the IO thread with the |
| 103 // started or the source failed to start OnStartDone must be called. An | |
| 104 // implementation must call |frame_callback| on the IO thread with the | |
| 105 // captured frames. | 103 // captured frames. |
| 106 // TODO(guidou): Remove |format| and |constraints| parameters. | |
| 107 // http://crbug.com/706408 | |
| 108 virtual void StartSourceImpl( | 104 virtual void StartSourceImpl( |
| 109 const media::VideoCaptureFormat& format, | |
| 110 const blink::WebMediaConstraints& constraints, | |
| 111 const VideoCaptureDeliverFrameCB& frame_callback) = 0; | 105 const VideoCaptureDeliverFrameCB& frame_callback) = 0; |
| 112 void OnStartDone(MediaStreamRequestResult result); | 106 void OnStartDone(MediaStreamRequestResult result); |
| 113 | 107 |
| 114 // An implementation must immediately stop capture video frames and must not | 108 // An implementation must immediately stop capture video frames and must not |
| 115 // call OnSupportedFormats after this method has been called. After this | 109 // call OnSupportedFormats after this method has been called. After this |
| 116 // method has been called, MediaStreamVideoSource may be deleted. | 110 // method has been called, MediaStreamVideoSource may be deleted. |
| 117 virtual void StopSourceImpl() = 0; | 111 virtual void StopSourceImpl() = 0; |
| 118 | 112 |
| 119 // Optionally overridden by subclasses to act on whether there are any | 113 // Optionally overridden by subclasses to act on whether there are any |
| 120 // consumers present. When none are present, the source can stop delivering | 114 // consumers present. When none are present, the source can stop delivering |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 175 |
| 182 // NOTE: Weak pointers must be invalidated before all other member variables. | 176 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 183 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; | 177 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; |
| 184 | 178 |
| 185 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); | 179 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); |
| 186 }; | 180 }; |
| 187 | 181 |
| 188 } // namespace content | 182 } // namespace content |
| 189 | 183 |
| 190 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 184 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
| OLD | NEW |