Bug 1772053 - Enable dynamic code disable mitigations only on Windows 10 1703+ r...
[gecko.git] / dom / media / AudioStreamTrack.h
blobf6a0c92c1eaabb86bda405d1e35b2b1e5d577a0f
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 #ifndef AUDIOSTREAMTRACK_H_
7 #define AUDIOSTREAMTRACK_H_
9 #include "MediaStreamTrack.h"
10 #include "DOMMediaStream.h"
11 #include "CrossGraphPort.h"
12 #include "nsClassHashtable.h"
14 namespace mozilla::dom {
16 class AudioStreamTrack : public MediaStreamTrack {
17 public:
18 AudioStreamTrack(
19 nsPIDOMWindowInner* aWindow, mozilla::MediaTrack* aInputTrack,
20 MediaStreamTrackSource* aSource,
21 MediaStreamTrackState aReadyState = MediaStreamTrackState::Live,
22 bool aMuted = false,
23 const MediaTrackConstraints& aConstraints = MediaTrackConstraints())
24 : MediaStreamTrack(aWindow, aInputTrack, aSource, aReadyState, aMuted,
25 aConstraints) {}
27 AudioStreamTrack* AsAudioStreamTrack() override { return this; }
28 const AudioStreamTrack* AsAudioStreamTrack() const override { return this; }
30 void AddAudioOutput(void* aKey);
31 void RemoveAudioOutput(void* aKey);
32 void SetAudioOutputVolume(void* aKey, float aVolume);
33 RefPtr<GenericPromise> SetAudioOutputDevice(void* key,
34 AudioDeviceInfo* aSink);
36 // WebIDL
37 void GetKind(nsAString& aKind) override { aKind.AssignLiteral("audio"); }
39 void GetLabel(nsAString& aLabel, CallerType aCallerType) override;
41 protected:
42 already_AddRefed<MediaStreamTrack> CloneInternal() override;
43 void SetReadyState(MediaStreamTrackState aState) override;
45 private:
46 // Track CrossGraphPort per AudioOutput key. This is required in order to
47 // redirect all AudioOutput requests (add, remove, set volume) to the
48 // receiver track which, belonging to the remote graph. MainThread only.
49 nsClassHashtable<nsPtrHashKey<void>, UniquePtr<CrossGraphPort>> mCrossGraphs;
52 } // namespace mozilla::dom
54 #endif /* AUDIOSTREAMTRACK_H_ */