summaryrefslogtreecommitdiff
path: root/dom/base
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2021-09-23 22:46:30 -0400
committerMoonchild <moonchild@palemoon.org>2022-04-01 14:31:39 +0200
commit3635039d2be6264673f3b89b8df390f03159fcaa (patch)
tree95d05b42c8f0af58e2608bbe53fe1ab800a88a94 /dom/base
parent711e049432900fcfb421e6cceb6ed311519fd6c1 (diff)
downloaduxp-3635039d2be6264673f3b89b8df390f03159fcaa.tar.gz
Issue #1806 - Part 2: Adjust the platform for lib changes
Diffstat (limited to 'dom/base')
-rw-r--r--dom/base/nsDOMWindowUtils.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp
index d05f3b71fc..eb09a6f14f 100644
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -74,6 +74,7 @@
#include "Layers.h"
#include "gfxPrefs.h"
+#include "mozilla/dom/AudioDeviceInfo.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/IDBFactoryBinding.h"
@@ -2371,6 +2372,46 @@ nsDOMWindowUtils::GetCurrentAudioBackend(nsAString& aBackend)
}
NS_IMETHODIMP
+nsDOMWindowUtils::GetCurrentMaxAudioChannels(uint32_t* aChannels)
+{
+ *aChannels = CubebUtils::MaxNumberOfChannels();
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsDOMWindowUtils::GetCurrentPreferredSampleRate(uint32_t* aRate)
+{
+ *aRate = CubebUtils::PreferredSampleRate();
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsDOMWindowUtils::AudioDevices(uint16_t aSide, nsIArray** aDevices)
+{
+ NS_ENSURE_ARG_POINTER(aDevices);
+ NS_ENSURE_ARG((aSide == AUDIO_INPUT) || (aSide == AUDIO_OUTPUT));
+ *aDevices = nullptr;
+
+ nsresult rv = NS_OK;
+ nsCOMPtr<nsIMutableArray> devices =
+ do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsTArray<RefPtr<AudioDeviceInfo>> collection;
+ CubebUtils::GetDeviceCollection(collection,
+ aSide == AUDIO_INPUT
+ ? CubebUtils::Side::Input
+ : CubebUtils::Side::Output);
+ for (auto device: collection) {
+ devices->AppendElement(device, false);
+ }
+
+ devices.forget(aDevices);
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP
nsDOMWindowUtils::StartFrameTimeRecording(uint32_t *startIndex)
{
NS_ENSURE_ARG_POINTER(startIndex);