bug 821306 - Expose nsIMediaDevice.id to script. r=jst
authorTed Mielczarek <ted@mielczarek.org>
Mon, 17 Dec 2012 08:28:24 -0500
changeset 125497 fd40e91ec70351ba0c88685575fd3d6a2dc0ac23
parent 125496 3d464fe9bd01ace3cd9063bc1f726b8fbb52f9e6
child 125498 923df1a7c8cae86254f16edb79a1b05e32ccc1cf
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs821306
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 821306 - Expose nsIMediaDevice.id to script. r=jst
dom/media/MediaManager.cpp
dom/media/MediaManager.h
dom/media/nsIDOMNavigatorUserMedia.idl
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -198,16 +198,23 @@ MediaDevice::GetName(nsAString& aName)
 
 NS_IMETHODIMP
 MediaDevice::GetType(nsAString& aType)
 {
   aType.Assign(mType);
   return NS_OK;
 }
 
+NS_IMETHODIMP
+MediaDevice::GetId(nsAString& aID)
+{
+  aID.Assign(mID);
+  return NS_OK;
+}
+
 MediaEngineSource*
 MediaDevice::GetSource()
 {
   return mSource;
 }
 
 /**
  * Creates a MediaStream, attaches a listener and fires off a success callback
--- a/dom/media/MediaManager.h
+++ b/dom/media/MediaManager.h
@@ -249,28 +249,31 @@ class MediaDevice : public nsIMediaDevic
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMEDIADEVICE
 
   MediaDevice(MediaEngineVideoSource* aSource) {
     mSource = aSource;
     mType.Assign(NS_LITERAL_STRING("video"));
     mSource->GetName(mName);
+    mSource->GetUUID(mID);
   }
   MediaDevice(MediaEngineAudioSource* aSource) {
     mSource = aSource;
     mType.Assign(NS_LITERAL_STRING("audio"));
     mSource->GetName(mName);
+    mSource->GetUUID(mID);
   }
   virtual ~MediaDevice() {}
 
   MediaEngineSource* GetSource();
 private:
   nsString mName;
   nsString mType;
+  nsString mID;
   nsRefPtr<MediaEngineSource> mSource;
 };
 
 class MediaManager MOZ_FINAL : public nsIObserver
 {
 public:
   static MediaManager* Get() {
     if (!sSingleton) {
--- a/dom/media/nsIDOMNavigatorUserMedia.idl
+++ b/dom/media/nsIDOMNavigatorUserMedia.idl
@@ -6,16 +6,17 @@
 #include "nsIVariant.idl"
 #include "nsIDOMMediaStream.idl"
 
 [scriptable, builtinclass, uuid(6de854f9-acf8-4383-b464-4803631ef309)]
 interface nsIMediaDevice : nsISupports
 {
   readonly attribute DOMString type;
   readonly attribute DOMString name;
+  readonly attribute DOMString id;
 };
 
 [scriptable, function, uuid(24544878-d35e-4962-8c5f-fb84e97bdfee)]
 interface nsIGetUserMediaDevicesSuccessCallback : nsISupports
 {
   void onSuccess(in nsIVariant devices);
 };