Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: content/renderer/media/media_stream_source.h

Issue 131763002: Adds MediaStreamSource, MediaStreamAudioSource and MediaStreamVideoCaptureDeviceSource (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unused file. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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,
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 the camera or microphone.
Ronghua Wu (Left Chromium) 2014/01/16 23:02:37 camera or microphone should just be 2 examples. su
perkj_chrome 2014/01/17 13:19:45 ok. This method isn't something I am very proud of
38 const StreamDeviceInfo& device_info() const {
39 return device_info_;
40 }
41
42 // Stops the source (by calling DoStopSource()). This sets the
43 // WebMediaStreamSource::readyState to ended, triggers the |stop_callback_|
44 // if set. All pointers to this object is invalid after calling this.
Jói 2014/01/17 08:57:08 nit: is invalid -> are invalid
perkj_chrome 2014/01/17 13:19:45 Done.
45 void StopSource();
46
47 void ResetSourceStoppedCallback() {
48 DCHECK(!stop_callback_.is_null());
49 stop_callback_.Reset();
50 }
51
52 protected:
53 // Called when OnLocalsSource is called.
Ronghua Wu (Left Chromium) 2014/01/16 23:02:37 comment is confusing to me
perkj_chrome 2014/01/17 13:19:45 Since its wrong after I renamed the method maybe?
54 virtual void DoStopSource() = 0;
55
56 // Set device information about the camera or microphone.
Ronghua Wu (Left Chromium) 2014/01/16 23:02:37 camera or microphone should just be 2 examples. su
perkj_chrome 2014/01/17 13:19:45 Done.
57 void SetDeviceInfo(const StreamDeviceInfo& device_info) {
58 device_info_ = device_info;
59 }
60
61 // Set a callback that is triggered when OnLocalSourceStop is called.
Ronghua Wu (Left Chromium) 2014/01/16 23:02:37 "will be triggered"?
perkj_chrome 2014/01/17 13:19:45 Done.
62 void SetStopCallback(const SourceStoppedCallback& stop_callback) {
63 DCHECK(stop_callback_.is_null());
64 stop_callback_ = stop_callback;
65 }
66
67 private:
68 StreamDeviceInfo device_info_;
69
Ronghua Wu (Left Chromium) 2014/01/16 23:02:37 remove empty line
perkj_chrome 2014/01/17 13:19:45 Done.
70 SourceStoppedCallback stop_callback_;
71
72 DISALLOW_COPY_AND_ASSIGN(MediaStreamSource);
73 };
74
75 } // namespace content
76
77 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698