 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 | 
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_ | |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "content/common/content_export.h" | |
| 11 #include "content/common/media/media_stream_options.h" | |
| 12 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | |
| 13 | |
| 14 namespace blink { | |
| 15 class WebMediaStreamTrack; | |
| 16 } // namespace blink | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 class CONTENT_EXPORT MediaStreamSource | |
| 21 : NON_EXPORTED_BASE(public blink::WebMediaStreamSource::ExtraData) { | |
| 22 public: | |
| 23 typedef base::Callback<void(const blink::WebMediaStreamSource& source)> | |
| 24 SourceStoppedCallback; | |
| 25 | |
| 26 typedef base::Callback<void(MediaStreamSource* source, | |
| 27 bool success)> ConstraintsCallback; | |
| 28 | |
| 29 MediaStreamSource(); | |
| 30 virtual ~MediaStreamSource(); | |
| 31 | |
| 32 virtual void AddTrack(const blink::WebMediaStreamTrack& track, | |
| 
no longer working on chromium
2014/01/17 14:51:51
so the constraints is back to AddTrack?
 
perkj_chrome
2014/01/19 15:52:39
Yupp :->
 | |
| 33 const blink::WebMediaConstraints& constraints, | |
| 34 const ConstraintsCallback& callback) = 0; | |
| 35 virtual void RemoveTrack(const blink::WebMediaStreamTrack& track) = 0; | |
| 36 | |
| 37 // Return device information about a source that has been created by a | |
| 
no longer working on chromium
2014/01/17 14:51:51
nit, Returns
 
perkj_chrome
2014/01/19 15:52:39
Done.
 | |
| 38 // JavaScript call to GetUserMedia. F.E a camera or microphone. | |
| 39 const StreamDeviceInfo& device_info() const { | |
| 40 return device_info_; | |
| 41 } | |
| 42 | |
| 43 // Stops the source (by calling DoStopSource()). This sets the | |
| 44 // WebMediaStreamSource::readyState to ended, triggers the |stop_callback_| | |
| 45 // if set. All pointers to this object are invalid after calling this. | |
| 46 void StopSource(); | |
| 47 | |
| 48 void ResetSourceStoppedCallback() { | |
| 49 DCHECK(!stop_callback_.is_null()); | |
| 50 stop_callback_.Reset(); | |
| 51 } | |
| 52 | |
| 53 protected: | |
| 54 // Called when StopSource is called. It allows derived classes to implement | |
| 55 // its own Stop method. | |
| 56 virtual void DoStopSource() = 0; | |
| 57 | |
| 58 // Set device information about a source that has been created by a | |
| 59 // JavaScript call to GetUserMedia. F.E a camera or microphone. | |
| 60 void SetDeviceInfo(const StreamDeviceInfo& device_info) { | |
| 
no longer working on chromium
2014/01/17 14:51:51
The source should be created with a specific devic
 
perkj_chrome
2014/01/19 15:52:39
There are other types of sources that don't need t
 | |
| 61 device_info_ = device_info; | |
| 62 } | |
| 63 | |
| 64 // Set a callback that will be triggered when StopSource is called. | |
| 65 void SetStopCallback(const SourceStoppedCallback& stop_callback) { | |
| 
no longer working on chromium
2014/01/17 14:51:51
same here, pass the stop_callback via the construc
 
perkj_chrome
2014/01/19 15:52:39
dito. Not all sources need the stop callback I thi
 | |
| 66 DCHECK(stop_callback_.is_null()); | |
| 67 stop_callback_ = stop_callback; | |
| 68 } | |
| 69 | |
| 70 private: | |
| 71 StreamDeviceInfo device_info_; | |
| 72 SourceStoppedCallback stop_callback_; | |
| 
no longer working on chromium
2014/01/17 14:51:51
and make those members const if they can be passed
 
perkj_chrome
2014/01/19 15:52:39
See response above.
 | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(MediaStreamSource); | |
| 75 }; | |
| 76 | |
| 77 } // namespace content | |
| 78 | |
| 79 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_ | |
| OLD | NEW |