RemoteTrackSource.h (2003B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef DOM_MEDIA_WEBRTC_JSAPI_REMOTETRACKSOURCE_H_ 8 #define DOM_MEDIA_WEBRTC_JSAPI_REMOTETRACKSOURCE_H_ 9 10 #include "MediaStreamTrack.h" 11 12 namespace mozilla { 13 14 namespace dom { 15 class RTCRtpReceiver; 16 } 17 18 class SourceMediaTrack; 19 20 class RemoteTrackSource : public dom::MediaStreamTrackSource { 21 public: 22 NS_DECL_ISUPPORTS_INHERITED 23 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RemoteTrackSource, 24 dom::MediaStreamTrackSource) 25 26 RemoteTrackSource(SourceMediaTrack* aStream, dom::RTCRtpReceiver* aReceiver, 27 nsIPrincipal* aPrincipal, const nsString& aLabel, 28 TrackingId aTrackingId); 29 30 void Destroy() override; 31 32 dom::MediaSourceEnum GetMediaSource() const override { 33 return dom::MediaSourceEnum::Other; 34 } 35 36 void GetSettings(dom::MediaTrackSettings& aSettings) override; 37 38 RefPtr<ApplyConstraintsPromise> ApplyConstraints( 39 const dom::MediaTrackConstraints& aConstraints, 40 dom::CallerType aCallerType) override; 41 42 void Stop() override { 43 // XXX (Bug 1314270): Implement rejection logic if necessary when we have 44 // clarity in the spec. 45 } 46 47 void Disable() override {} 48 49 void Enable() override {} 50 51 void SetPrincipal(nsIPrincipal* aPrincipal); 52 void SetMuted(bool aMuted); 53 void ForceEnded(); 54 55 SourceMediaTrack* Stream() const; 56 57 const dom::RTCStatsTimestampMaker* GetTimestampMaker() const override; 58 59 private: 60 virtual ~RemoteTrackSource(); 61 62 RefPtr<SourceMediaTrack> mStream; 63 RefPtr<dom::RTCRtpReceiver> mReceiver; 64 Maybe<gfx::IntSize> mReceivingSizeOnEnded; 65 }; 66 67 } // namespace mozilla 68 69 #endif // DOM_MEDIA_WEBRTC_JSAPI_REMOTETRACKSOURCE_H_