Chromium Code Reviews| Index: content/renderer/media/media_stream_video_source.h |
| diff --git a/content/renderer/media/media_stream_video_source.h b/content/renderer/media/media_stream_video_source.h |
| index f97b9c46a53cb9a755639b273ac6ed165afb6035..11bcf2a8f132ec87b90ef525d34ae752b4ff5b39 100644 |
| --- a/content/renderer/media/media_stream_video_source.h |
| +++ b/content/renderer/media/media_stream_video_source.h |
| @@ -8,7 +8,8 @@ |
| #include "base/compiler_specific.h" |
| #include "base/memory/ref_counted.h" |
| #include "content/common/content_export.h" |
| -#include "content/renderer/media/media_stream_source_extra_data.h" |
| +#include "content/renderer/media/media_stream_dependency_factory.h" |
| +#include "content/renderer/media/media_stream_source.h" |
| #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| @@ -26,19 +27,19 @@ class MediaStreamDependencyFactory; |
| // http://dev.w3.org/2011/webrtc/editor/getusermedia.html |
| // All methods calls will be done from the main render thread. |
| class CONTENT_EXPORT MediaStreamVideoSource |
| - : public MediaStreamSourceExtraData { |
| + : public MediaStreamSource, |
| + NON_EXPORTED_BASE(public webrtc::ObserverInterface), |
| + NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| public: |
| explicit MediaStreamVideoSource( |
| MediaStreamDependencyFactory* factory); |
| - // Puts |track| in the registered tracks list. Will later |
| - // deliver frames to it according to |constraints|. |
| - virtual void AddTrack(const blink::WebMediaStreamTrack& track, |
| - const blink::WebMediaConstraints& constraints); |
| - // Removes |track| from the registered tracks list, i.e. will stop delivering |
| - // frame to |track|. |
| - virtual void RemoveTrack(const blink::WebMediaStreamTrack& track); |
| + // Puts |track| in the registered tracks list. |
| + virtual void AddTrack(const blink::WebMediaStreamTrack& track, |
| + const blink::WebMediaConstraints& constraints, |
| + const ConstraintsCallback& callback) OVERRIDE; |
| + virtual void RemoveTrack(const blink::WebMediaStreamTrack& track) OVERRIDE; |
| // TODO(ronghuawu): Remove webrtc::VideoSourceInterface from the public |
| // interface of this class. |
| @@ -47,15 +48,20 @@ class CONTENT_EXPORT MediaStreamVideoSource |
| } |
| protected: |
| - // Sets an external adapter. Must be called before Init, which creates a |
| + virtual void DoStopSource() OVERRIDE {} |
| + |
| // default adapter if the adapter is not set already. |
|
Ronghua Wu (Left Chromium)
2014/01/16 23:02:37
add back the line above this line
perkj_chrome
2014/01/17 13:19:45
Ptal. Note that SetAdapter can be removed once loc
|
| void SetAdapter(webrtc::VideoSourceInterface* adapter) { |
| DCHECK(!adapter_); |
| adapter_ = adapter; |
| } |
| - // Called by the derived class before any other methods except SetAdapter. |
| - void Init(); |
| + // Called when the first track is added to this source. |
| + // It currently creates a webrtc::VideoSourceInterface. |
| + // If a derived class overrides this method, it must call SetAdapter. |
| + virtual void Init(const blink::WebMediaConstraints& constraints); |
| + |
| + MediaStreamDependencyFactory* factory() { return factory_; } |
| // Sets ready state and notifies the ready state to all registered tracks. |
| virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); |
| @@ -65,14 +71,25 @@ class CONTENT_EXPORT MediaStreamVideoSource |
| // planes and I420. |
| virtual void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame); |
| + // Implements webrtc::Observer. |
| + virtual void OnChanged() OVERRIDE; |
| + |
| virtual ~MediaStreamVideoSource(); |
| private: |
| + void CheckIfAdapterIsLive(); |
| + |
| + bool initializing_; |
| MediaStreamDependencyFactory* factory_; |
| scoped_refptr<webrtc::VideoSourceInterface> adapter_; |
| int width_; |
| int height_; |
| base::TimeDelta first_frame_timestamp_; |
| + |
| + blink::WebMediaConstraints current_constraints_; |
| + std::vector<ConstraintsCallback> constraints_callbacks_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); |
| }; |
| } // namespace content |