Bug 1404977 - Part 2 - Augment AudioDeviceInfo with a cubeb device id. r=pehrsons
authorPaul Adenot <paul@paul.cx>
Mon, 30 Apr 2018 15:24:52 +0200
changeset 430062 3e1bbbc9047f732251966666c1d5a80265c3593f
parent 430061 127bff24bfc8fa5d0e619ea727ab4a0c522c4497
child 430063 72fd73a9d4e3180fe0c16479b2da5f891addb312
push id34381
push userdluca@mozilla.com
push dateFri, 03 Aug 2018 22:01:59 +0000
treeherdermozilla-central@ff0d31843793 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspehrsons
bugs1404977
milestone63.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 1404977 - Part 2 - Augment AudioDeviceInfo with a cubeb device id. r=pehrsons MozReview-Commit-ID: GrOnxHuN2Oj
dom/media/AudioDeviceInfo.cpp
dom/media/AudioDeviceInfo.h
dom/media/CubebUtils.h
--- a/dom/media/AudioDeviceInfo.cpp
+++ b/dom/media/AudioDeviceInfo.cpp
@@ -74,38 +74,34 @@ AudioDeviceInfo::AudioDeviceInfo(AudioDe
   MOZ_ASSERT(mSupportedFormat & (FMT_S16LE | FMT_S16BE | FMT_F32LE | FMT_F32BE),
              "Wrong supported format");
   MOZ_ASSERT(mDefaultFormat == FMT_S16LE ||
              mDefaultFormat == FMT_S16BE ||
              mDefaultFormat == FMT_F32LE ||
              mDefaultFormat == FMT_F32BE, "Wrong default format");
 }
 
-Maybe<AudioDeviceID>
-AudioDeviceInfo::GetDeviceID()
+AudioDeviceID
+AudioDeviceInfo::DeviceID() const
 {
-  if (mDeviceId) {
-    return Some(mDeviceId);
-  }
-  return Nothing();
+  return mDeviceId;
 }
-
-const nsString& AudioDeviceInfo::FriendlyName()
+const nsString& AudioDeviceInfo::Name() const
 {
   return mName;
 }
-uint32_t AudioDeviceInfo::MaxChannels()
+uint32_t AudioDeviceInfo::MaxChannels() const
 {
   return mMaxChannels;
 }
-uint32_t AudioDeviceInfo::Type()
+uint32_t AudioDeviceInfo::Type() const
 {
   return mType;
 }
-uint32_t AudioDeviceInfo::State()
+uint32_t AudioDeviceInfo::State() const
 {
   return mState;
 }
 
 /* readonly attribute DOMString name; */
 NS_IMETHODIMP
 AudioDeviceInfo::GetName(nsAString& aName)
 {
--- a/dom/media/AudioDeviceInfo.h
+++ b/dom/media/AudioDeviceInfo.h
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_AudioDeviceInfo_H
 #define MOZILLA_AudioDeviceInfo_H
 
 #include "nsIAudioDeviceInfo.h"
 #include "CubebUtils.h"
-#include "nsString.h"
 #include "mozilla/Maybe.h"
 
 // This is mapped to the cubeb_device_info.
 class AudioDeviceInfo final : public nsIAudioDeviceInfo
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIAUDIODEVICEINFO
@@ -30,25 +29,23 @@ public:
                   uint16_t aSupportedFormat,
                   uint16_t aDefaultFormat,
                   uint32_t aMaxChannels,
                   uint32_t aDefaultRate,
                   uint32_t aMaxRate,
                   uint32_t aMinRate,
                   uint32_t aMaxLatency,
                   uint32_t aMinLatency);
+  explicit AudioDeviceInfo(cubeb_device_info* aInfo);
 
-  explicit AudioDeviceInfo(cubeb_device_info* aInfo);
-  // It is possible to not know the device identifier here. It depends on which
-  // ctor this instance has been constructed with.
-  mozilla::Maybe<AudioDeviceID> GetDeviceID();
-  const nsString& FriendlyName();
-  uint32_t MaxChannels();
-  uint32_t Type();
-  uint32_t State();
+  AudioDeviceID DeviceID() const;
+  const nsString& Name() const;
+  uint32_t MaxChannels() const;
+  uint32_t Type() const;
+  uint32_t State() const;
 private:
   virtual ~AudioDeviceInfo() = default;
 
   const AudioDeviceID mDeviceId;
   const nsString mName;
   const nsString mGroupId;
   const nsString mVendor;
   const uint16_t mType;
--- a/dom/media/CubebUtils.h
+++ b/dom/media/CubebUtils.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #if !defined(CubebUtils_h_)
 #define CubebUtils_h_
 
 #include "cubeb/cubeb.h"
 #include "nsString.h"
 #include "mozilla/RefPtr.h"
-#include "mozilla/Maybe.h"
 
 class AudioDeviceInfo;
 
 namespace mozilla {
 namespace CubebUtils {
 
 typedef cubeb_devid AudioDeviceID;