blob: 05fae356464afbe09ec2afa8ce7776cd6ded1e6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/* 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 _REMOTE_TRACK_SOURCE_H_
#define _REMOTE_TRACK_SOURCE_H_
#include "MediaStreamTrack.h"
#include "MediaStreamError.h"
namespace mozilla {
class RemoteTrackSource : public dom::MediaStreamTrackSource {
public:
explicit RemoteTrackSource(SourceMediaTrack* aStream,
nsIPrincipal* aPrincipal, const nsString& aLabel)
: dom::MediaStreamTrackSource(aPrincipal, aLabel), mStream(aStream) {}
dom::MediaSourceEnum GetMediaSource() const override {
return dom::MediaSourceEnum::Other;
}
RefPtr<ApplyConstraintsPromise> ApplyConstraints(
const dom::MediaTrackConstraints& aConstraints,
dom::CallerType aCallerType) override {
return ApplyConstraintsPromise::CreateAndReject(
MakeRefPtr<MediaMgrError>(
dom::MediaStreamError::Name::OverconstrainedError, ""),
__func__);
}
void Stop() override {
// XXX (Bug 1314270): Implement rejection logic if necessary when we have
// clarity in the spec.
}
void Disable() override {}
void Enable() override {}
void SetPrincipal(nsIPrincipal* aPrincipal) {
mPrincipal = aPrincipal;
PrincipalChanged();
}
void SetMuted(bool aMuted) { MutedChanged(aMuted); }
void ForceEnded() { OverrideEnded(); }
const RefPtr<SourceMediaTrack> mStream;
protected:
virtual ~RemoteTrackSource() {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mStream->IsDestroyed());
}
};
} // namespace mozilla
#endif // _REMOTE_TRACK_SOURCE_H_
|