| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void UpdateHasConsumers(MediaStreamVideoTrack* track, bool has_consumers); | 71 void UpdateHasConsumers(MediaStreamVideoTrack* track, bool has_consumers); |
| 72 | 72 |
| 73 void UpdateCapturingLinkSecure(MediaStreamVideoTrack* track, bool is_secure); | 73 void UpdateCapturingLinkSecure(MediaStreamVideoTrack* track, bool is_secure); |
| 74 | 74 |
| 75 // Request underlying source to capture a new frame. | 75 // Request underlying source to capture a new frame. |
| 76 virtual void RequestRefreshFrame() {} | 76 virtual void RequestRefreshFrame() {} |
| 77 | 77 |
| 78 // Returns the task runner where video frames will be delivered on. | 78 // Returns the task runner where video frames will be delivered on. |
| 79 base::SingleThreadTaskRunner* io_task_runner() const; | 79 base::SingleThreadTaskRunner* io_task_runner() const; |
| 80 | 80 |
| 81 base::Optional<media::VideoCaptureFormat> GetCurrentFormat() const; | 81 // Implementations must return the capture format if available. |
| 82 virtual base::Optional<media::VideoCaptureFormat> GetCurrentFormat() const; |
| 82 | 83 |
| 83 base::WeakPtr<MediaStreamVideoSource> GetWeakPtr() { | 84 base::WeakPtr<MediaStreamVideoSource> GetWeakPtr() { |
| 84 return weak_factory_.GetWeakPtr(); | 85 return weak_factory_.GetWeakPtr(); |
| 85 } | 86 } |
| 86 | 87 |
| 87 protected: | 88 protected: |
| 88 void DoStopSource() override; | 89 void DoStopSource() override; |
| 89 | 90 |
| 90 // Sets ready state and notifies the ready state to all registered tracks. | 91 // Sets ready state and notifies the ready state to all registered tracks. |
| 91 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); | 92 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); |
| 92 | 93 |
| 93 // Sets muted state and notifies it to all registered tracks. | 94 // Sets muted state and notifies it to all registered tracks. |
| 94 virtual void SetMutedState(bool state); | 95 virtual void SetMutedState(bool state); |
| 95 | 96 |
| 96 // An implementation must return its capture format if available. | |
| 97 virtual base::Optional<media::VideoCaptureFormat> GetCurrentFormatImpl() | |
| 98 const; | |
| 99 | |
| 100 // An implementation must start capturing frames after this method is called. | 97 // An implementation must start capturing frames after this method is called. |
| 101 // When the source has started or failed to start OnStartDone must be called. | 98 // When the source has started or failed to start OnStartDone must be called. |
| 102 // An implementation must call |frame_callback| on the IO thread with the | 99 // An implementation must call |frame_callback| on the IO thread with the |
| 103 // captured frames. | 100 // captured frames. |
| 104 virtual void StartSourceImpl( | 101 virtual void StartSourceImpl( |
| 105 const VideoCaptureDeliverFrameCB& frame_callback) = 0; | 102 const VideoCaptureDeliverFrameCB& frame_callback) = 0; |
| 106 void OnStartDone(MediaStreamRequestResult result); | 103 void OnStartDone(MediaStreamRequestResult result); |
| 107 | 104 |
| 108 // An implementation must immediately stop capture video frames and must not | 105 // An implementation must immediately stop capture video frames and must not |
| 109 // call OnSupportedFormats after this method has been called. After this | 106 // call OnSupportedFormats after this method has been called. After this |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 172 |
| 176 // NOTE: Weak pointers must be invalidated before all other member variables. | 173 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 177 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; | 174 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; |
| 178 | 175 |
| 179 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); | 176 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); |
| 180 }; | 177 }; |
| 181 | 178 |
| 182 } // namespace content | 179 } // namespace content |
| 183 | 180 |
| 184 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 181 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
| OLD | NEW |