 Chromium Code Reviews
 Chromium Code Reviews Issue 131763002:
  Adds MediaStreamSource, MediaStreamAudioSource and MediaStreamVideoCaptureDeviceSource  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 131763002:
  Adds MediaStreamSource, MediaStreamAudioSource and MediaStreamVideoCaptureDeviceSource  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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" | |
| 10 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" | 
| 11 #include "content/renderer/media/media_stream_source_extra_data.h" | 10 #include "content/renderer/media/media_stream_source.h" | 
| 12 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 11 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 
| 13 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 12 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 
| 14 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 13 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 
| 15 | 14 | 
| 16 namespace media { | 15 namespace media { | 
| 17 class VideoFrame; | 16 class VideoFrame; | 
| 18 } | 17 } | 
| 19 | 18 | 
| 20 namespace content { | 19 namespace content { | 
| 21 | 20 | 
| 22 // MediaStreamVideoSource is an interface used for sending video frames to a | 21 // MediaStreamVideoSource is an interface used for sending video frames to a | 
| 23 // MediaStreamVideoTrack. | 22 // MediaStreamVideoTrack. | 
| 24 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html | 23 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html | 
| 25 // All methods calls will be done from the main render thread. | 24 // All methods calls will be done from the main render thread. | 
| 26 class CONTENT_EXPORT MediaStreamVideoSource | 25 class CONTENT_EXPORT MediaStreamVideoSource | 
| 27 : public MediaStreamSourceExtraData { | 26 : public MediaStreamSource { | 
| 28 public: | 27 public: | 
| 28 MediaStreamVideoSource(); | |
| 29 // Puts |track| in the registered tracks list. Will later | 29 // Puts |track| in the registered tracks list. Will later | 
| 30 // deliver frames to it according to |constraints|. | 30 // deliver frames to it according to |constraints|. | 
| 31 void AddTrack(const blink::WebMediaStreamTrack& track, | 31 void AddTrack(const blink::WebMediaStreamTrack& track); | 
| 32 const blink::WebMediaConstraints& constraints); | |
| 33 | |
| 34 // Removes |track| from the registered tracks list, i.e. will stop delivering | |
| 35 // frame to |track|. | |
| 36 void RemoveTrack(const blink::WebMediaStreamTrack& track); | 32 void RemoveTrack(const blink::WebMediaStreamTrack& track); | 
| 37 | 33 | 
| 34 webrtc::VideoSourceInterface* GetAdapter() { | |
| 
Ronghua Wu (Left Chromium)
2014/01/10 20:01:08
I think the derived class of this class shouldn't
 
perkj_chrome
2014/01/12 19:34:38
I don't think that will work until we have properl
 | |
| 35 return adapter_; | |
| 36 } | |
| 37 | |
| 38 protected: | 38 protected: | 
| 39 void SetAdapter( | |
| 40 const scoped_refptr<webrtc::VideoSourceInterface>& adapter); | |
| 39 // Sets ready state and notifies the ready state to all registered tracks. | 41 // Sets ready state and notifies the ready state to all registered tracks. | 
| 40 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); | 42 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); | 
| 41 | 43 | 
| 42 // Delivers |frame| to registered tracks according to their constraints. | 44 // Delivers |frame| to registered tracks according to their constraints. | 
| 43 virtual void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame); | 45 virtual void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame); | 
| 46 virtual ~MediaStreamVideoSource(); | |
| 44 | 47 | 
| 45 virtual ~MediaStreamVideoSource(); | 48 private: | 
| 49 scoped_refptr<webrtc::VideoSourceInterface> adapter_; | |
| 46 }; | 50 }; | 
| 47 | 51 | 
| 48 } // namespace content | 52 } // namespace content | 
| 49 | 53 | 
| 50 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 54 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 
| OLD | NEW |