зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1624322) for causing bustages in media/MediaManager.cpp
CLOSED TREE Backed out changeset bafcf7076dc0 (bug 1624322) Backed out changeset f6dcb0ce3a5e (bug 1624322) Backed out changeset 1ce0a5921f1c (bug 1624322) --HG-- extra : rebase_source : fab2836f3ff047844a0cac8b1663f097813dec17
This commit is contained in:
Родитель
f70de0e527
Коммит
abb8915aa3
|
@ -870,13 +870,12 @@ MediaDevice::MediaDevice(const RefPtr<AudioDeviceInfo>& aAudioDeviceInfo,
|
|||
}
|
||||
|
||||
MediaDevice::MediaDevice(const RefPtr<MediaDevice>& aOther, const nsString& aID,
|
||||
const nsString& aGroupID, const nsString& aRawID,
|
||||
const nsString& aRawGroupID)
|
||||
: MediaDevice(aOther, aID, aGroupID, aRawID, aRawGroupID, aOther->mName) {}
|
||||
const nsString& aGroupID, const nsString& aRawID)
|
||||
: MediaDevice(aOther, aID, aGroupID, aRawID, aOther->mName) {}
|
||||
|
||||
MediaDevice::MediaDevice(const RefPtr<MediaDevice>& aOther, const nsString& aID,
|
||||
const nsString& aGroupID, const nsString& aRawID,
|
||||
const nsString& aRawGroupID, const nsString& aName)
|
||||
const nsString& aName)
|
||||
: mSource(aOther->mSource),
|
||||
mSinkInfo(aOther->mSinkInfo),
|
||||
mKind(aOther->mKind),
|
||||
|
@ -887,7 +886,6 @@ MediaDevice::MediaDevice(const RefPtr<MediaDevice>& aOther, const nsString& aID,
|
|||
mID(aID),
|
||||
mGroupID(aGroupID),
|
||||
mRawID(aRawID),
|
||||
mRawGroupID(aRawGroupID),
|
||||
mRawName(aOther->mRawName) {
|
||||
MOZ_ASSERT(aOther);
|
||||
}
|
||||
|
@ -1010,13 +1008,6 @@ MediaDevice::GetGroupId(nsAString& aGroupID) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MediaDevice::GetRawGroupId(nsAString& aRawGroupID) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
aRawGroupID.Assign(mRawGroupID);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MediaDevice::GetScary(bool* aScary) {
|
||||
*aScary = mScary;
|
||||
|
@ -1686,8 +1677,8 @@ void MediaManager::GuessVideoDeviceGroupIDs(MediaDeviceSet& aDevices,
|
|||
}
|
||||
}
|
||||
if (updateGroupId) {
|
||||
aVideo = new MediaDevice(aVideo, aVideo->mID, newVideoGroupID,
|
||||
aVideo->mRawID, aVideo->mRawGroupID);
|
||||
aVideo =
|
||||
new MediaDevice(aVideo, aVideo->mID, newVideoGroupID, aVideo->mRawID);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -2938,7 +2929,6 @@ void MediaManager::AnonymizeDevices(MediaDeviceSet& aDevices,
|
|||
|
||||
nsString groupId;
|
||||
device->GetGroupId(groupId);
|
||||
nsString rawGroupId = groupId;
|
||||
// Use window id to salt group id in order to make it session based as
|
||||
// required by the spec. This does not provide unique group ids through
|
||||
// out a browser restart. However, this is not agaist the spec.
|
||||
|
@ -2952,7 +2942,7 @@ void MediaManager::AnonymizeDevices(MediaDeviceSet& aDevices,
|
|||
if (name.Find(NS_LITERAL_STRING("AirPods")) != -1) {
|
||||
name = NS_LITERAL_STRING("AirPods");
|
||||
}
|
||||
device = new MediaDevice(device, id, groupId, rawId, rawGroupId, name);
|
||||
device = new MediaDevice(device, id, groupId, rawId, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4361,6 +4351,7 @@ void SourceListener::SetEnabledFor(MediaTrack* aTrack, bool aEnable) {
|
|||
if (mWindowListener) {
|
||||
mWindowListener->ChromeAffectingStateChanged();
|
||||
}
|
||||
|
||||
if (!state.mOffWhileDisabled) {
|
||||
// If the feature to turn a device off while disabled is itself
|
||||
// disabled we shortcut the device operation and tell the
|
||||
|
@ -4368,38 +4359,9 @@ void SourceListener::SetEnabledFor(MediaTrack* aTrack, bool aEnable) {
|
|||
return DeviceOperationPromise::CreateAndResolve(NS_OK, __func__);
|
||||
}
|
||||
|
||||
nsString inputDeviceGroupId;
|
||||
state.mDevice->GetRawGroupId(inputDeviceGroupId);
|
||||
|
||||
return MediaManager::PostTask<DeviceOperationPromise>(
|
||||
__func__, [self, device = state.mDevice, aEnable, inputDeviceGroupId](
|
||||
__func__, [self, device = state.mDevice, aEnable](
|
||||
MozPromiseHolder<DeviceOperationPromise>& h) {
|
||||
// Only take this branch when muting, to avoid muting, in case
|
||||
// the default audio output device has changed and we need to
|
||||
// really call `Start` on the source. The AudioInput source
|
||||
// start/stop are idempotent, so this works.
|
||||
if (device->mKind == dom::MediaDeviceKind::Audioinput && !aEnable) {
|
||||
// Don't turn off the microphone of a device that is on the same
|
||||
// physical device as the output.
|
||||
CubebDeviceEnumerator* enumerator = CubebDeviceEnumerator::GetInstance();
|
||||
// Get the current graph's device info. This is always the
|
||||
// default audio output device for now.
|
||||
RefPtr<AudioDeviceInfo> outputDevice =
|
||||
enumerator->DefaultDevice(CubebDeviceEnumerator::Side::OUTPUT);
|
||||
if (outputDevice->GroupID().Equals(inputDeviceGroupId)) {
|
||||
LOG("Device group id match when %s, "
|
||||
"not turning the input device off (%s)",
|
||||
aEnable ? "unmuting" : "muting",
|
||||
NS_ConvertUTF16toUTF8(outputDevice->GroupID()).get());
|
||||
h.Resolve(NS_OK, __func__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LOG("Device group id don't match when %s, "
|
||||
"not turning the audio input device off (%s)",
|
||||
aEnable ? "unmuting" : "muting",
|
||||
NS_ConvertUTF16toUTF8(inputDeviceGroupId).get());
|
||||
h.Resolve(aEnable ? device->Start() : device->Stop(),
|
||||
__func__);
|
||||
});
|
||||
|
|
|
@ -75,12 +75,11 @@ class MediaDevice : public nsIMediaDevice {
|
|||
const nsString& aRawID = NS_LITERAL_STRING(""));
|
||||
|
||||
MediaDevice(const RefPtr<MediaDevice>& aOther, const nsString& aID,
|
||||
const nsString& aGroupID, const nsString& aRawID,
|
||||
const nsString& aRawGroupID);
|
||||
const nsString& aGroupID, const nsString& aRawID);
|
||||
|
||||
MediaDevice(const RefPtr<MediaDevice>& aOther, const nsString& aID,
|
||||
const nsString& aGroupID, const nsString& aRawID,
|
||||
const nsString& aRawGroupID, const nsString& aName);
|
||||
const nsString& aName);
|
||||
|
||||
uint32_t GetBestFitnessDistance(
|
||||
const nsTArray<const NormalizedConstraintSet*>& aConstraintSets,
|
||||
|
@ -128,7 +127,6 @@ class MediaDevice : public nsIMediaDevice {
|
|||
const nsString mID;
|
||||
const nsString mGroupID;
|
||||
const nsString mRawID;
|
||||
const nsString mRawGroupID;
|
||||
const nsString mRawName;
|
||||
};
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ interface nsIMediaDevice : nsISupports
|
|||
readonly attribute AString mediaSource;
|
||||
readonly attribute AString rawId;
|
||||
readonly attribute AString groupId;
|
||||
readonly attribute AString rawGroupId;
|
||||
readonly attribute boolean scary;
|
||||
readonly attribute AString rawName; // unfiltered device name, from 1616661
|
||||
};
|
||||
|
|
|
@ -243,9 +243,9 @@ already_AddRefed<AudioDeviceInfo> CubebDeviceEnumerator::DeviceInfoFromID(
|
|||
if (mInputDevices.IsEmpty() || mManualInputInvalidation) {
|
||||
EnumerateAudioDevices(Side::INPUT);
|
||||
}
|
||||
for (RefPtr<AudioDeviceInfo>& device : mInputDevices) {
|
||||
if (device->DeviceID() == aID) {
|
||||
RefPtr<AudioDeviceInfo> other = device;
|
||||
for (uint32_t i = 0; i < mInputDevices.Length(); i++) {
|
||||
if (mInputDevices[i]->DeviceID() == aID) {
|
||||
RefPtr<AudioDeviceInfo> other = mInputDevices[i];
|
||||
return other.forget();
|
||||
}
|
||||
}
|
||||
|
@ -253,9 +253,9 @@ already_AddRefed<AudioDeviceInfo> CubebDeviceEnumerator::DeviceInfoFromID(
|
|||
if (mOutputDevices.IsEmpty() || mManualOutputInvalidation) {
|
||||
EnumerateAudioDevices(Side::OUTPUT);
|
||||
}
|
||||
for (RefPtr<AudioDeviceInfo>& device : mOutputDevices) {
|
||||
if (device->DeviceID() == aID) {
|
||||
RefPtr<AudioDeviceInfo> other = device;
|
||||
for (uint32_t i = 0; i < mOutputDevices.Length(); i++) {
|
||||
if (mOutputDevices[i]->DeviceID() == aID) {
|
||||
RefPtr<AudioDeviceInfo> other = mOutputDevices[i];
|
||||
return other.forget();
|
||||
}
|
||||
}
|
||||
|
@ -283,30 +283,9 @@ already_AddRefed<AudioDeviceInfo> CubebDeviceEnumerator::DeviceInfoFromName(
|
|||
if (devices.IsEmpty() || manualInvalidation) {
|
||||
EnumerateAudioDevices(aSide);
|
||||
}
|
||||
for (RefPtr<AudioDeviceInfo>& device : devices) {
|
||||
if (device->Name().Equals(aName)) {
|
||||
RefPtr<AudioDeviceInfo> other = device;
|
||||
return other.forget();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<AudioDeviceInfo> CubebDeviceEnumerator::DefaultDevice(Side aSide) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
nsTArray<RefPtr<AudioDeviceInfo>>& devices =
|
||||
(aSide == Side::INPUT) ? mInputDevices : mOutputDevices;
|
||||
bool manualInvalidation = (aSide == Side::INPUT) ? mManualInputInvalidation
|
||||
: mManualOutputInvalidation;
|
||||
|
||||
if (devices.IsEmpty() || manualInvalidation) {
|
||||
EnumerateAudioDevices(aSide);
|
||||
}
|
||||
for (RefPtr<AudioDeviceInfo>& device : devices) {
|
||||
if (device->Preferred()) {
|
||||
RefPtr<AudioDeviceInfo> other = device;
|
||||
for (uint32_t i = 0; i < devices.Length(); i++) {
|
||||
if (devices[i]->Name().Equals(aName)) {
|
||||
RefPtr<AudioDeviceInfo> other = devices[i];
|
||||
return other.forget();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,9 +54,6 @@ class CubebDeviceEnumerator final {
|
|||
return mOnOutputDeviceListChange;
|
||||
}
|
||||
|
||||
// Return the default device for a particular side.
|
||||
RefPtr<AudioDeviceInfo> DefaultDevice(Side aSide);
|
||||
|
||||
private:
|
||||
CubebDeviceEnumerator();
|
||||
~CubebDeviceEnumerator();
|
||||
|
|
Загрузка…
Ссылка в новой задаче