2013-03-27 05:32:51 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef AUDIOSTREAMTRACK_H_
|
|
|
|
#define AUDIOSTREAMTRACK_H_
|
|
|
|
|
|
|
|
#include "MediaStreamTrack.h"
|
2013-09-06 00:25:17 +04:00
|
|
|
#include "DOMMediaStream.h"
|
2020-06-12 17:03:30 +03:00
|
|
|
#include "CrossGraphTrack.h"
|
2013-03-27 05:32:51 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class AudioStreamTrack : public MediaStreamTrack {
|
|
|
|
public:
|
2016-04-06 15:46:56 +03:00
|
|
|
AudioStreamTrack(
|
2019-10-02 13:23:02 +03:00
|
|
|
nsPIDOMWindowInner* aWindow, mozilla::MediaTrack* aInputTrack,
|
2015-11-25 07:42:26 +03:00
|
|
|
MediaStreamTrackSource* aSource,
|
2019-08-19 22:26:25 +03:00
|
|
|
MediaStreamTrackState aReadyState = MediaStreamTrackState::Live,
|
2019-11-20 18:24:34 +03:00
|
|
|
bool aMuted = false,
|
2015-11-25 07:42:26 +03:00
|
|
|
const MediaTrackConstraints& aConstraints = MediaTrackConstraints())
|
2019-11-20 18:24:34 +03:00
|
|
|
: MediaStreamTrack(aWindow, aInputTrack, aSource, aReadyState, aMuted,
|
2015-11-25 07:42:26 +03:00
|
|
|
aConstraints) {}
|
2013-03-27 05:32:51 +04:00
|
|
|
|
2016-01-18 06:50:29 +03:00
|
|
|
AudioStreamTrack* AsAudioStreamTrack() override { return this; }
|
2016-02-01 17:43:38 +03:00
|
|
|
const AudioStreamTrack* AsAudioStreamTrack() const override { return this; }
|
|
|
|
|
2019-07-31 10:58:17 +03:00
|
|
|
void AddAudioOutput(void* aKey);
|
|
|
|
void RemoveAudioOutput(void* aKey);
|
|
|
|
void SetAudioOutputVolume(void* aKey, float aVolume);
|
2020-06-12 17:03:30 +03:00
|
|
|
RefPtr<GenericPromise> SetAudioOutputDevice(void* key,
|
|
|
|
AudioDeviceInfo* aSink);
|
2019-07-31 10:58:17 +03:00
|
|
|
|
2013-03-27 05:32:51 +04:00
|
|
|
// WebIDL
|
2016-01-18 06:50:29 +03:00
|
|
|
void GetKind(nsAString& aKind) override { aKind.AssignLiteral("audio"); }
|
2016-01-22 11:27:51 +03:00
|
|
|
|
2017-10-13 06:57:25 +03:00
|
|
|
void GetLabel(nsAString& aLabel, CallerType aCallerType) override;
|
|
|
|
|
2016-01-22 11:27:51 +03:00
|
|
|
protected:
|
2019-08-19 22:26:25 +03:00
|
|
|
already_AddRefed<MediaStreamTrack> CloneInternal() override;
|
2020-06-12 17:03:30 +03:00
|
|
|
void SetReadyState(MediaStreamTrackState aState) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Track CrossGraphManager per AudioOutput key. This is required in order to
|
|
|
|
// redirect all AudioOutput requests (add, remove, set volume) to the
|
|
|
|
// receiver track which, belonging to the remote graph. MainThread only.
|
|
|
|
nsClassHashtable<nsPtrHashKey<void>, UniquePtr<CrossGraphManager>>
|
|
|
|
mCrossGraphs;
|
2013-03-27 05:32:51 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2013-03-27 05:32:51 +04:00
|
|
|
|
|
|
|
#endif /* AUDIOSTREAMTRACK_H_ */
|