Chromium Code Reviews| 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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/renderer/media/media_stream_source_extra_data.h" | 11 #include "content/renderer/media/media_stream_source_extra_data.h" |
| 12 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 12 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 13 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 13 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| 14 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 14 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 class VideoFrame; | 17 class VideoFrame; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class MediaStreamDependencyFactory; | |
| 23 | |
| 22 // MediaStreamVideoSource is an interface used for sending video frames to a | 24 // MediaStreamVideoSource is an interface used for sending video frames to a |
| 23 // MediaStreamVideoTrack. | 25 // MediaStreamVideoTrack. |
| 24 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html | 26 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html |
| 25 // All methods calls will be done from the main render thread. | 27 // All methods calls will be done from the main render thread. |
| 26 class CONTENT_EXPORT MediaStreamVideoSource | 28 class CONTENT_EXPORT MediaStreamVideoSource |
| 27 : public MediaStreamSourceExtraData { | 29 : public MediaStreamSourceExtraData { |
| 28 public: | 30 public: |
| 31 | |
|
perkj_chrome
2014/01/14 08:29:10
remove empty line
Ronghua Wu (Left Chromium)
2014/01/14 19:42:10
Done.
| |
| 32 MediaStreamVideoSource( | |
| 33 MediaStreamDependencyFactory* factory, | |
| 34 webrtc::VideoSourceInterface* adapter); | |
|
perkj_chrome
2014/01/14 08:29:10
If you look at my cl you will see that I can not c
| |
| 35 | |
| 29 // Puts |track| in the registered tracks list. Will later | 36 // Puts |track| in the registered tracks list. Will later |
| 30 // deliver frames to it according to |constraints|. | 37 // deliver frames to it according to |constraints|. |
| 31 void AddTrack(const blink::WebMediaStreamTrack& track, | 38 virtual bool AddTrack(const blink::WebMediaStreamTrack& track, |
|
perkj_chrome
2014/01/14 08:29:10
Please keep void for now.
Ronghua Wu (Left Chromium)
2014/01/14 19:42:10
Done.
| |
| 32 const blink::WebMediaConstraints& constraints); | 39 const blink::WebMediaConstraints& constraints); |
| 33 | 40 |
| 34 // Removes |track| from the registered tracks list, i.e. will stop delivering | 41 // Removes |track| from the registered tracks list, i.e. will stop delivering |
| 35 // frame to |track|. | 42 // frame to |track|. |
| 36 void RemoveTrack(const blink::WebMediaStreamTrack& track); | 43 virtual bool RemoveTrack(const blink::WebMediaStreamTrack& track); |
| 44 | |
| 45 // TODO(ronghuawu): Remove webrtc::VideoSourceInterface from the public | |
| 46 // interface of this class. | |
| 47 webrtc::VideoSourceInterface* GetAdapter() { | |
| 48 return adapter_; | |
| 49 } | |
| 37 | 50 |
| 38 protected: | 51 protected: |
| 39 // Sets ready state and notifies the ready state to all registered tracks. | 52 // Sets ready state and notifies the ready state to all registered tracks. |
| 40 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); | 53 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); |
| 41 | 54 |
| 42 // Delivers |frame| to registered tracks according to their constraints. | 55 // Delivers |frame| to registered tracks according to their constraints. |
| 43 virtual void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame); | 56 virtual void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame); |
| 44 | 57 |
| 45 virtual ~MediaStreamVideoSource(); | 58 virtual ~MediaStreamVideoSource(); |
| 59 | |
| 60 private: | |
| 61 MediaStreamDependencyFactory* factory_; | |
| 62 scoped_refptr<webrtc::VideoSourceInterface> adapter_; | |
| 63 int width_; | |
| 64 int height_; | |
| 65 base::TimeDelta first_frame_timestamp_; | |
| 46 }; | 66 }; |
| 47 | 67 |
| 48 } // namespace content | 68 } // namespace content |
| 49 | 69 |
| 50 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 70 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
| OLD | NEW |