зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1213453 - Add getters/setters for group id in MediaEngineSource and the derived classes. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D20370 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
da31b1b51c
Коммит
871823085b
|
@ -49,6 +49,10 @@ nsCString MediaEngineDefaultVideoSource::GetUUID() const {
|
|||
return NS_LITERAL_CSTRING("1041FCBD-3F12-4F7B-9E9B-1EC556DD5676");
|
||||
}
|
||||
|
||||
nsString MediaEngineDefaultVideoSource::GetGroupId() const {
|
||||
return NS_LITERAL_STRING(u"Default Video Group");
|
||||
}
|
||||
|
||||
uint32_t MediaEngineDefaultVideoSource::GetBestFitnessDistance(
|
||||
const nsTArray<const NormalizedConstraintSet*>& aConstraintSets,
|
||||
const nsString& aDeviceId) const {
|
||||
|
@ -362,6 +366,10 @@ nsCString MediaEngineDefaultAudioSource::GetUUID() const {
|
|||
return NS_LITERAL_CSTRING("B7CBD7C1-53EF-42F9-8353-73F61C70C092");
|
||||
}
|
||||
|
||||
nsString MediaEngineDefaultAudioSource::GetGroupId() const {
|
||||
return NS_LITERAL_STRING(u"Default Audio Group");
|
||||
}
|
||||
|
||||
uint32_t MediaEngineDefaultAudioSource::GetBestFitnessDistance(
|
||||
const nsTArray<const NormalizedConstraintSet*>& aConstraintSets,
|
||||
const nsString& aDeviceId) const {
|
||||
|
@ -553,7 +561,7 @@ void MediaEngineDefault::EnumerateDevices(
|
|||
aDevices->AppendElement(MakeRefPtr<MediaDevice>(
|
||||
newSource, newSource->GetName(),
|
||||
NS_ConvertUTF8toUTF16(newSource->GetUUID()),
|
||||
NS_LITERAL_STRING("GroupID"), NS_LITERAL_STRING("")));
|
||||
newSource->GetGroupId(), NS_LITERAL_STRING("")));
|
||||
return;
|
||||
}
|
||||
case dom::MediaSourceEnum::Microphone: {
|
||||
|
@ -565,7 +573,7 @@ void MediaEngineDefault::EnumerateDevices(
|
|||
aDevices->AppendElement(MakeRefPtr<MediaDevice>(
|
||||
source, source->GetName(),
|
||||
NS_ConvertUTF8toUTF16(source->GetUUID()),
|
||||
NS_LITERAL_STRING("GroupID"), NS_LITERAL_STRING("")));
|
||||
source->GetGroupId(), NS_LITERAL_STRING("")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,7 +584,7 @@ void MediaEngineDefault::EnumerateDevices(
|
|||
aDevices->AppendElement(MakeRefPtr<MediaDevice>(
|
||||
newSource, newSource->GetName(),
|
||||
NS_ConvertUTF8toUTF16(newSource->GetUUID()),
|
||||
NS_LITERAL_STRING("GroupID"), NS_LITERAL_STRING("")));
|
||||
newSource->GetGroupId(), NS_LITERAL_STRING("")));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ class MediaEngineDefaultVideoSource : public MediaEngineSource {
|
|||
|
||||
nsString GetName() const override;
|
||||
nsCString GetUUID() const override;
|
||||
nsString GetGroupId() const override;
|
||||
|
||||
nsresult Allocate(const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs, const nsString& aDeviceId,
|
||||
|
@ -108,6 +109,7 @@ class MediaEngineDefaultAudioSource : public MediaEngineSource {
|
|||
|
||||
nsString GetName() const override;
|
||||
nsCString GetUUID() const override;
|
||||
nsString GetGroupId() const override;
|
||||
|
||||
nsresult Allocate(const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs, const nsString& aDeviceId,
|
||||
|
|
|
@ -86,6 +86,7 @@ void MediaEngineRemoteVideoSource::Init() {
|
|||
|
||||
SetName(NS_ConvertUTF8toUTF16(deviceName));
|
||||
SetUUID(uniqueId);
|
||||
SetGroupId(NS_ConvertUTF8toUTF16(deviceName));
|
||||
|
||||
mInitDone = true;
|
||||
}
|
||||
|
@ -180,6 +181,18 @@ nsCString MediaEngineRemoteVideoSource::GetUUID() const {
|
|||
return mUniqueId;
|
||||
}
|
||||
|
||||
void MediaEngineRemoteVideoSource::SetGroupId(nsString aGroupId) {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
mGroupId = std::move(aGroupId);
|
||||
}
|
||||
|
||||
nsString MediaEngineRemoteVideoSource::GetGroupId() const {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
return mGroupId;
|
||||
}
|
||||
|
||||
nsresult MediaEngineRemoteVideoSource::Allocate(
|
||||
const MediaTrackConstraints& aConstraints, const MediaEnginePrefs& aPrefs,
|
||||
const nsString& aDeviceId,
|
||||
|
@ -992,6 +1005,7 @@ void MediaEngineRemoteVideoSource::Refresh(int aIndex) {
|
|||
|
||||
SetName(NS_ConvertUTF8toUTF16(deviceName));
|
||||
MOZ_ASSERT(mUniqueId.Equals(uniqueId));
|
||||
SetGroupId(NS_ConvertUTF8toUTF16(deviceName));
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -153,6 +153,9 @@ class MediaEngineRemoteVideoSource : public MediaEngineSource,
|
|||
nsCString GetUUID() const override;
|
||||
void SetUUID(const char* aUUID);
|
||||
|
||||
nsString GetGroupId() const override;
|
||||
void SetGroupId(nsString aGroupId);
|
||||
|
||||
bool GetScary() const override { return mScary; }
|
||||
|
||||
RefPtr<GenericNonExclusivePromise> GetFirstFramePromise() const override {
|
||||
|
@ -250,6 +253,7 @@ class MediaEngineRemoteVideoSource : public MediaEngineSource,
|
|||
|
||||
nsString mDeviceName;
|
||||
nsCString mUniqueId;
|
||||
nsString mGroupId;
|
||||
nsString mFacingMode;
|
||||
|
||||
// Whether init has successfully completed.
|
||||
|
|
|
@ -104,6 +104,11 @@ class MediaEngineSourceInterface {
|
|||
*/
|
||||
virtual nsCString GetUUID() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the Group id of this device.
|
||||
*/
|
||||
virtual nsString GetGroupId() const = 0;
|
||||
|
||||
/**
|
||||
* Get the enum describing the underlying type of MediaSource.
|
||||
*/
|
||||
|
|
|
@ -115,6 +115,10 @@ nsCString MediaEngineTabVideoSource::GetUUID() const {
|
|||
return NS_LITERAL_CSTRING("tab");
|
||||
}
|
||||
|
||||
nsString MediaEngineTabVideoSource::GetGroupId() const {
|
||||
return NS_LITERAL_STRING(u"&getUserMedia.videoSource.tabShareGroup;");
|
||||
}
|
||||
|
||||
#define DEFAULT_TABSHARE_VIDEO_MAX_WIDTH 4096
|
||||
#define DEFAULT_TABSHARE_VIDEO_MAX_HEIGHT 4096
|
||||
#define DEFAULT_TABSHARE_VIDEO_FRAMERATE 30
|
||||
|
|
|
@ -21,6 +21,7 @@ class MediaEngineTabVideoSource : public MediaEngineSource {
|
|||
|
||||
nsString GetName() const override;
|
||||
nsCString GetUUID() const override;
|
||||
nsString GetGroupId() const override;
|
||||
|
||||
bool GetScary() const override { return true; }
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ void MediaEngineWebRTC::EnumerateVideoDevices(
|
|||
}
|
||||
aDevices->AppendElement(MakeRefPtr<MediaDevice>(
|
||||
vSource, vSource->GetName(), NS_ConvertUTF8toUTF16(vSource->GetUUID()),
|
||||
NS_LITERAL_STRING("GroupID"), NS_LITERAL_STRING("")));
|
||||
vSource->GetGroupId(), NS_LITERAL_STRING("")));
|
||||
}
|
||||
|
||||
if (mHasTabVideoSource || aCapEngine == camera::BrowserEngine) {
|
||||
|
@ -152,7 +152,7 @@ void MediaEngineWebRTC::EnumerateVideoDevices(
|
|||
aDevices->AppendElement(MakeRefPtr<MediaDevice>(
|
||||
tabVideoSource, tabVideoSource->GetName(),
|
||||
NS_ConvertUTF8toUTF16(tabVideoSource->GetUUID()),
|
||||
NS_LITERAL_STRING("GroupID"), NS_LITERAL_STRING("")));
|
||||
tabVideoSource->GetGroupId(), NS_LITERAL_STRING("")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,11 +181,11 @@ void MediaEngineWebRTC::EnumerateMicrophoneDevices(
|
|||
RefPtr<MediaEngineSource> source = new MediaEngineWebRTCMicrophoneSource(
|
||||
devices[i], devices[i]->Name(),
|
||||
// Lie and provide the name as UUID
|
||||
NS_ConvertUTF16toUTF8(devices[i]->Name()), devices[i]->MaxChannels(),
|
||||
mDelayAgnostic, mExtendedFilter);
|
||||
NS_ConvertUTF16toUTF8(devices[i]->Name()), devices[i]->GroupID(),
|
||||
devices[i]->MaxChannels(), mDelayAgnostic, mExtendedFilter);
|
||||
RefPtr<MediaDevice> device = MakeRefPtr<MediaDevice>(
|
||||
source, source->GetName(), NS_ConvertUTF8toUTF16(source->GetUUID()),
|
||||
NS_LITERAL_STRING("GroupID"), NS_LITERAL_STRING(""));
|
||||
source->GetGroupId(), NS_LITERAL_STRING(""));
|
||||
if (devices[i]->Preferred()) {
|
||||
#ifdef DEBUG
|
||||
if (!foundPreferredDevice) {
|
||||
|
@ -264,7 +264,7 @@ void MediaEngineWebRTC::EnumerateDevices(
|
|||
aDevices->AppendElement(MakeRefPtr<MediaDevice>(
|
||||
audioCaptureSource, audioCaptureSource->GetName(),
|
||||
NS_ConvertUTF8toUTF16(audioCaptureSource->GetUUID()),
|
||||
NS_LITERAL_STRING("GroupID"), NS_LITERAL_STRING("")));
|
||||
audioCaptureSource->GetGroupId(), NS_LITERAL_STRING("")));
|
||||
} else if (aMediaSource == dom::MediaSourceEnum::Microphone) {
|
||||
MOZ_ASSERT(aMediaSource == dom::MediaSourceEnum::Microphone);
|
||||
EnumerateMicrophoneDevices(aWindowId, aDevices);
|
||||
|
|
|
@ -46,8 +46,8 @@ extern LazyLogModule gMediaManagerLog;
|
|||
|
||||
MediaEngineWebRTCMicrophoneSource::MediaEngineWebRTCMicrophoneSource(
|
||||
RefPtr<AudioDeviceInfo> aInfo, const nsString& aDeviceName,
|
||||
const nsCString& aDeviceUUID, uint32_t aMaxChannelCount,
|
||||
bool aDelayAgnostic, bool aExtendedFilter)
|
||||
const nsCString& aDeviceUUID, const nsString& aDeviceGroup,
|
||||
uint32_t aMaxChannelCount, bool aDelayAgnostic, bool aExtendedFilter)
|
||||
: mTrackID(TRACK_NONE),
|
||||
mPrincipal(PRINCIPAL_HANDLE_NONE),
|
||||
mDeviceInfo(std::move(aInfo)),
|
||||
|
@ -55,6 +55,7 @@ MediaEngineWebRTCMicrophoneSource::MediaEngineWebRTCMicrophoneSource(
|
|||
mExtendedFilter(aExtendedFilter),
|
||||
mDeviceName(aDeviceName),
|
||||
mDeviceUUID(aDeviceUUID),
|
||||
mDeviceGroup(aDeviceGroup),
|
||||
mDeviceMaxChannelCount(aMaxChannelCount),
|
||||
mSettings(new nsMainThreadPtrHolder<
|
||||
media::Refcountable<dom::MediaTrackSettings>>(
|
||||
|
@ -84,6 +85,10 @@ nsCString MediaEngineWebRTCMicrophoneSource::GetUUID() const {
|
|||
return mDeviceUUID;
|
||||
}
|
||||
|
||||
nsString MediaEngineWebRTCMicrophoneSource::GetGroupId() const {
|
||||
return mDeviceGroup;
|
||||
}
|
||||
|
||||
// GetBestFitnessDistance returns the best distance the capture device can offer
|
||||
// as a whole, given an accumulated number of ConstraintSets.
|
||||
// Ideal values are considered in the first ConstraintSet only.
|
||||
|
@ -1163,6 +1168,10 @@ nsCString MediaEngineWebRTCAudioCaptureSource::GetUUID() const {
|
|||
return nsCString(Substring(asciiString, 1, NSID_LENGTH - 3));
|
||||
}
|
||||
|
||||
nsString MediaEngineWebRTCAudioCaptureSource::GetGroupId() const {
|
||||
return NS_LITERAL_STRING(u"AudioCaptureGroup");
|
||||
}
|
||||
|
||||
void MediaEngineWebRTCAudioCaptureSource::SetTrack(
|
||||
const RefPtr<const AllocationHandle>&,
|
||||
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
|
||||
|
|
|
@ -28,14 +28,15 @@ class AudioInputProcessing;
|
|||
class MediaEngineWebRTCMicrophoneSource : public MediaEngineSource {
|
||||
public:
|
||||
MediaEngineWebRTCMicrophoneSource(RefPtr<AudioDeviceInfo> aInfo,
|
||||
const nsString& name, const nsCString& uuid,
|
||||
uint32_t maxChannelCount,
|
||||
const nsString& aName, const nsCString& aUuid,
|
||||
const nsString& aGroupId, uint32_t aMaxChannelCount,
|
||||
bool aDelayAgnostic, bool aExtendedFilter);
|
||||
|
||||
bool RequiresSharing() const override { return false; }
|
||||
|
||||
nsString GetName() const override;
|
||||
nsCString GetUUID() const override;
|
||||
nsString GetGroupId() const override;
|
||||
|
||||
nsresult Allocate(const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs, const nsString& aDeviceId,
|
||||
|
@ -117,6 +118,7 @@ class MediaEngineWebRTCMicrophoneSource : public MediaEngineSource {
|
|||
const bool mExtendedFilter;
|
||||
const nsString mDeviceName;
|
||||
const nsCString mDeviceUUID;
|
||||
const nsString mDeviceGroup;
|
||||
|
||||
// The maximum number of channels that this device supports.
|
||||
const uint32_t mDeviceMaxChannelCount;
|
||||
|
@ -255,6 +257,7 @@ class MediaEngineWebRTCAudioCaptureSource : public MediaEngineSource {
|
|||
explicit MediaEngineWebRTCAudioCaptureSource(const char* aUuid) {}
|
||||
nsString GetName() const override;
|
||||
nsCString GetUUID() const override;
|
||||
nsString GetGroupId() const override;
|
||||
nsresult Allocate(const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs, const nsString& aDeviceId,
|
||||
const ipc::PrincipalInfo& aPrincipalInfo,
|
||||
|
|
|
@ -519,7 +519,7 @@ uint32_t MediaConstraintsHelper::FitnessDistance(
|
|||
AutoTArray<RefPtr<MediaDevice>, 1> devices;
|
||||
devices.AppendElement(MakeRefPtr<MediaDevice>(
|
||||
aMediaEngineSource, aMediaEngineSource->GetName(), aDeviceId,
|
||||
NS_LITERAL_STRING("GroupID"), NS_LITERAL_STRING("")));
|
||||
aMediaEngineSource->GetGroupId(), NS_LITERAL_STRING("")));
|
||||
return FindBadConstraint(aConstraints, devices);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче