summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-07-29 18:00:14 +0000
committerMoonchild <moonchild@palemoon.org>2022-07-29 18:00:14 +0000
commit32c8246e1615dcf1dbcf775141ee044def649ae7 (patch)
tree88b57f3d116bacc7398cc387238a12653183da1b
parentd60f501490398dfce8d270f8345fa674eae9e64b (diff)
parent27bbc35768d62648a752a2e0771408c0a00415c0 (diff)
downloaduxp-32c8246e1615dcf1dbcf775141ee044def649ae7.tar.gz
Merge pull request 'Revert "Issue #1806 - Follow-up: Fix WebRTC issues with cubeb update."' (#1979) from Basilisk-Dev/UXP:master into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/1979
-rw-r--r--dom/media/webrtc/MediaEngineWebRTC.cpp28
-rw-r--r--dom/media/webrtc/MediaEngineWebRTC.h7
2 files changed, 17 insertions, 18 deletions
diff --git a/dom/media/webrtc/MediaEngineWebRTC.cpp b/dom/media/webrtc/MediaEngineWebRTC.cpp
index 5d0cfd6bf9..3e978571f6 100644
--- a/dom/media/webrtc/MediaEngineWebRTC.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTC.cpp
@@ -48,7 +48,7 @@ void AudioInputCubeb::UpdateDeviceList()
return;
}
- cubeb_device_collection devices = { nullptr, 0 };
+ cubeb_device_collection *devices = nullptr;
if (CUBEB_OK != cubeb_enumerate_devices(cubebContext,
CUBEB_DEVICE_TYPE_INPUT,
@@ -67,27 +67,27 @@ void AudioInputCubeb::UpdateDeviceList()
// For some reason the "fake" device for automation is marked as DISABLED,
// so white-list it.
mDefaultDevice = -1;
- for (uint32_t i = 0; i < devices.count; i++) {
+ for (uint32_t i = 0; i < devices->count; i++) {
LOG(("Cubeb device %u: type 0x%x, state 0x%x, name %s, id %p",
- i, devices.device[i].type, devices.device[i].state,
- devices.device[i].friendly_name, devices.device[i].device_id));
- if (devices.device[i].type == CUBEB_DEVICE_TYPE_INPUT && // paranoia
- (devices.device[i].state == CUBEB_DEVICE_STATE_ENABLED ||
- (devices.device[i].state == CUBEB_DEVICE_STATE_DISABLED &&
- devices.device[i].friendly_name &&
- strcmp(devices.device[i].friendly_name, "Sine source at 440 Hz") == 0)))
+ i, devices->device[i]->type, devices->device[i]->state,
+ devices->device[i]->friendly_name, devices->device[i]->device_id));
+ if (devices->device[i]->type == CUBEB_DEVICE_TYPE_INPUT && // paranoia
+ (devices->device[i]->state == CUBEB_DEVICE_STATE_ENABLED ||
+ (devices->device[i]->state == CUBEB_DEVICE_STATE_DISABLED &&
+ devices->device[i]->friendly_name &&
+ strcmp(devices->device[i]->friendly_name, "Sine source at 440 Hz") == 0)))
{
- auto j = mDeviceNames->IndexOf(devices.device[i].device_id);
+ auto j = mDeviceNames->IndexOf(devices->device[i]->device_id);
if (j != nsTArray<nsCString>::NoIndex) {
// match! update the mapping
(*mDeviceIndexes)[j] = i;
} else {
// new device, add to the array
mDeviceIndexes->AppendElement(i);
- mDeviceNames->AppendElement(devices.device[i].device_id);
+ mDeviceNames->AppendElement(devices->device[i]->device_id);
j = mDeviceIndexes->Length()-1;
}
- if (devices.device[i].preferred & CUBEB_DEVICE_PREF_VOICE) {
+ if (devices->device[i]->preferred & CUBEB_DEVICE_PREF_VOICE) {
// There can be only one... we hope
NS_ASSERTION(mDefaultDevice == -1, "multiple default cubeb input devices!");
mDefaultDevice = j;
@@ -98,9 +98,9 @@ void AudioInputCubeb::UpdateDeviceList()
StaticMutexAutoLock lock(sMutex);
// swap state
if (mDevices) {
- cubeb_device_collection_destroy(cubebContext, mDevices);
+ cubeb_device_collection_destroy(mDevices);
}
- mDevices = &devices;
+ mDevices = devices;
}
MediaEngineWebRTC::MediaEngineWebRTC(MediaEnginePrefs &aPrefs)
diff --git a/dom/media/webrtc/MediaEngineWebRTC.h b/dom/media/webrtc/MediaEngineWebRTC.h
index 2773d7d1cf..1834f3bd39 100644
--- a/dom/media/webrtc/MediaEngineWebRTC.h
+++ b/dom/media/webrtc/MediaEngineWebRTC.h
@@ -180,8 +180,7 @@ public:
{
if (mDevices) {
// This doesn't require anything more than support for free()
- cubeb* context = CubebUtils::GetCubebContext();
- cubeb_device_collection_destroy(context, mDevices);
+ cubeb_device_collection_destroy(mDevices);
mDevices = nullptr;
}
delete mDeviceIndexes;
@@ -225,7 +224,7 @@ public:
sMutex.AssertCurrentThreadOwns();
int dev_index = DeviceIndex(aDeviceIndex);
if (dev_index != -1) {
- aID = mDevices->device[dev_index].devid;
+ aID = mDevices->device[dev_index]->devid;
return true;
}
return false;
@@ -239,7 +238,7 @@ public:
return 1;
}
PR_snprintf(aStrNameUTF8, 128, "%s%s", aIndex == -1 ? "default: " : "",
- mDevices->device[devindex].friendly_name);
+ mDevices->device[devindex]->friendly_name);
aStrGuidUTF8[0] = '\0';
return 0;
}