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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_source.h
diff --git a/content/renderer/media/media_stream_source.h b/content/renderer/media/media_stream_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..094fd26a90df7bfd329e2785473d9a39f25879c8
--- /dev/null
+++ b/content/renderer/media/media_stream_source.h
@@ -0,0 +1,77 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_
+#define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_
+
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "content/common/content_export.h"
+#include "content/common/media/media_stream_options.h"
+#include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
+
+namespace blink {
+class WebMediaStreamTrack;
+} // namespace blink
+
+namespace content {
+
+class CONTENT_EXPORT MediaStreamSource
+ : NON_EXPORTED_BASE(public blink::WebMediaStreamSource::ExtraData) {
+ public:
+ typedef base::Callback<void(const blink::WebMediaStreamSource& source)>
+ SourceStoppedCallback;
+
+ typedef base::Callback<void(MediaStreamSource* source,
+ bool success)> ConstraintsCallback;
+
+ MediaStreamSource();
+ virtual ~MediaStreamSource();
+
+ virtual void AddTrack(const blink::WebMediaStreamTrack& track,
+ const blink::WebMediaConstraints& constraints,
+ const ConstraintsCallback& callback) = 0;
+ virtual void RemoveTrack(const blink::WebMediaStreamTrack& track) = 0;
+
+ // 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
+ const StreamDeviceInfo& device_info() const {
+ return device_info_;
+ }
+
+ // Stops the source (by calling DoStopSource()). This sets the
+ // WebMediaStreamSource::readyState to ended, triggers the |stop_callback_|
+ // 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.
+ void StopSource();
+
+ void ResetSourceStoppedCallback() {
+ DCHECK(!stop_callback_.is_null());
+ stop_callback_.Reset();
+ }
+
+ protected:
+ // 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?
+ virtual void DoStopSource() = 0;
+
+ // 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.
+ void SetDeviceInfo(const StreamDeviceInfo& device_info) {
+ device_info_ = device_info;
+ }
+
+ // 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.
+ void SetStopCallback(const SourceStoppedCallback& stop_callback) {
+ DCHECK(stop_callback_.is_null());
+ stop_callback_ = stop_callback;
+ }
+
+ private:
+ StreamDeviceInfo device_info_;
+
Ronghua Wu (Left Chromium) 2014/01/16 23:02:37 remove empty line
perkj_chrome 2014/01/17 13:19:45 Done.
+ SourceStoppedCallback stop_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaStreamSource);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698