diff options
author | Jeremy Andrews <athenian200@outlook.com> | 2021-08-24 14:35:49 -0500 |
---|---|---|
committer | Jeremy Andrews <athenian200@outlook.com> | 2021-08-24 14:35:49 -0500 |
commit | 893fc903790e1ca5bba598113c49d94a165e333b (patch) | |
tree | 3d5c4f557b0ddf422d75b3616015cde10b390cd5 /dom/base | |
parent | 41b1b3947c99d5f9478e0d3bd60a95b781c69431 (diff) | |
download | uxp-893fc903790e1ca5bba598113c49d94a165e333b.tar.gz |
Issue #1806 - Part 4: Add more audio troubleshooting information.
This should help us troubleshoot audio issues better in the future in general, since we'll know more about the hardware involved, etc.
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/nsDOMWindowUtils.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index d05f3b71fc..3606a1b0bc 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,53 @@ nsDOMWindowUtils::GetCurrentAudioBackend(nsAString& aBackend) } NS_IMETHODIMP +nsDOMWindowUtils::GetCurrentMaxAudioChannels(uint32_t* aChannels) +{ + *aChannels = CubebUtils::MaxNumberOfChannels(); + return NS_OK; +} + +NS_IMETHODIMP +nsDOMWindowUtils::GetCurrentPreferredChannelLayout(nsAString& aLayout) +{ + CubebUtils::GetPreferredChannelLayout(aLayout); + 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); |