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
{
19 nsPIDOMWindowInner
* aWindow
, mozilla::MediaTrack
* aInputTrack
,
20 MediaStreamTrackSource
* aSource
,
21 MediaStreamTrackState aReadyState
= MediaStreamTrackState::Live
,
23 const MediaTrackConstraints
& aConstraints
= MediaTrackConstraints())
24 : MediaStreamTrack(aWindow
, aInputTrack
, aSource
, aReadyState
, aMuted
,
27 AudioStreamTrack
* AsAudioStreamTrack() override
{ return this; }
28 const AudioStreamTrack
* AsAudioStreamTrack() const override
{ return this; }
30 // Direct output to aSink, or the default output device if aSink is null.
31 // No more than one output may exist for a single aKey at any one time.
32 // Returns a promise that resolves when the device is processing audio.
33 RefPtr
<GenericPromise
> AddAudioOutput(void* aKey
, AudioDeviceInfo
* aSink
);
34 void RemoveAudioOutput(void* aKey
);
35 void SetAudioOutputVolume(void* aKey
, float aVolume
);
38 void GetKind(nsAString
& aKind
) override
{ aKind
.AssignLiteral("audio"); }
40 void GetLabel(nsAString
& aLabel
, CallerType aCallerType
) override
;
43 already_AddRefed
<MediaStreamTrack
> CloneInternal() override
;
46 } // namespace mozilla::dom
48 #endif /* AUDIOSTREAMTRACK_H_ */