1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "AudioStreamTrack.h"
8 #include "MediaTrackGraph.h"
9 #include "nsContentUtils.h"
11 namespace mozilla::dom
{
13 RefPtr
<GenericPromise
> AudioStreamTrack::AddAudioOutput(
14 void* aKey
, AudioDeviceInfo
* aSink
) {
16 return GenericPromise::CreateAndResolve(true, __func__
);
19 mTrack
->AddAudioOutput(aKey
, aSink
);
20 return mTrack
->Graph()->NotifyWhenDeviceStarted(aSink
);
23 void AudioStreamTrack::RemoveAudioOutput(void* aKey
) {
28 mTrack
->RemoveAudioOutput(aKey
);
31 void AudioStreamTrack::SetAudioOutputVolume(void* aKey
, float aVolume
) {
36 mTrack
->SetAudioOutputVolume(aKey
, aVolume
);
39 void AudioStreamTrack::GetLabel(nsAString
& aLabel
, CallerType aCallerType
) {
40 nsIGlobalObject
* global
=
41 GetParentObject() ? GetParentObject()->AsGlobal() : nullptr;
42 if (nsContentUtils::ShouldResistFingerprinting(aCallerType
, global
,
43 RFPTarget::StreamTrackLabel
)) {
44 aLabel
.AssignLiteral("Internal Microphone");
47 MediaStreamTrack::GetLabel(aLabel
, aCallerType
);
50 already_AddRefed
<MediaStreamTrack
> AudioStreamTrack::CloneInternal() {
51 return do_AddRef(new AudioStreamTrack(mWindow
, mInputTrack
, mSource
,
52 ReadyState(), Muted(), mConstraints
));
55 } // namespace mozilla::dom