LCOV - code coverage report
Current view: top level - media/webrtc/signaling/src/peerconnection - PeerConnectionMedia.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 108 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 54 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       3             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #ifndef _PEER_CONNECTION_MEDIA_H_
       6             : #define _PEER_CONNECTION_MEDIA_H_
       7             : 
       8             : #include <string>
       9             : #include <vector>
      10             : #include <map>
      11             : 
      12             : #include "nspr.h"
      13             : #include "prlock.h"
      14             : 
      15             : #include "mozilla/RefPtr.h"
      16             : #include "mozilla/UniquePtr.h"
      17             : #include "mozilla/net/StunAddrsRequestChild.h"
      18             : #include "nsComponentManagerUtils.h"
      19             : #include "nsIProtocolProxyCallback.h"
      20             : 
      21             : #include "signaling/src/jsep/JsepSession.h"
      22             : #include "AudioSegment.h"
      23             : 
      24             : #include "Layers.h"
      25             : #include "VideoUtils.h"
      26             : #include "ImageLayers.h"
      27             : #include "VideoSegment.h"
      28             : #include "MediaStreamTrack.h"
      29             : 
      30             : class nsIPrincipal;
      31             : 
      32             : namespace mozilla {
      33             : class DataChannel;
      34             : class PeerIdentity;
      35             : class MediaPipelineFactory;
      36             : namespace dom {
      37             : struct RTCInboundRTPStreamStats;
      38             : struct RTCOutboundRTPStreamStats;
      39             : }
      40             : }
      41             : 
      42             : #include "nricectxhandler.h"
      43             : #include "nriceresolver.h"
      44             : #include "nricemediastream.h"
      45             : #include "MediaPipeline.h"
      46             : 
      47             : namespace mozilla {
      48             : 
      49             : class PeerConnectionImpl;
      50             : class PeerConnectionMedia;
      51             : class PCUuidGenerator;
      52             : 
      53             : class SourceStreamInfo {
      54             : public:
      55           0 :   SourceStreamInfo(DOMMediaStream* aMediaStream,
      56             :                    PeerConnectionMedia *aParent,
      57             :                    const std::string& aId)
      58           0 :       : mMediaStream(aMediaStream),
      59             :         mParent(aParent),
      60           0 :         mId(aId) {
      61           0 :     MOZ_ASSERT(mMediaStream);
      62           0 :   }
      63             : 
      64           0 :   SourceStreamInfo(already_AddRefed<DOMMediaStream>& aMediaStream,
      65             :                    PeerConnectionMedia *aParent,
      66             :                    const std::string& aId)
      67           0 :       : mMediaStream(aMediaStream),
      68             :         mParent(aParent),
      69           0 :         mId(aId) {
      70           0 :     MOZ_ASSERT(mMediaStream);
      71           0 :   }
      72             : 
      73           0 :   virtual ~SourceStreamInfo() {}
      74             : 
      75           0 :   DOMMediaStream* GetMediaStream() const {
      76           0 :     return mMediaStream;
      77             :   }
      78             : 
      79             :   nsresult StorePipeline(const std::string& trackId,
      80             :                          const RefPtr<MediaPipeline>& aPipeline);
      81             : 
      82           0 :   virtual void AddTrack(const std::string& trackId,
      83             :                         const RefPtr<dom::MediaStreamTrack>& aTrack)
      84             :   {
      85           0 :     mTracks.insert(std::make_pair(trackId, aTrack));
      86           0 :   }
      87             :   virtual void RemoveTrack(const std::string& trackId);
      88           0 :   bool HasTrack(const std::string& trackId) const
      89             :   {
      90           0 :     return !!mTracks.count(trackId);
      91             :   }
      92           0 :   size_t GetTrackCount() const { return mTracks.size(); }
      93             : 
      94             :   // This method exists for stats and the unittests.
      95             :   // It allows visibility into the pipelines and flows.
      96             :   const std::map<std::string, RefPtr<MediaPipeline>>&
      97           0 :   GetPipelines() const { return mPipelines; }
      98             :   RefPtr<MediaPipeline> GetPipelineByTrackId_m(const std::string& trackId);
      99             :   // This is needed so PeerConnectionImpl can unregister itself as
     100             :   // PrincipalChangeObserver from each track.
     101             :   const std::map<std::string, RefPtr<dom::MediaStreamTrack>>&
     102           0 :   GetMediaStreamTracks() const { return mTracks; }
     103           0 :   dom::MediaStreamTrack* GetTrackById(const std::string& trackId) const
     104             :   {
     105           0 :     auto it = mTracks.find(trackId);
     106           0 :     if (it == mTracks.end()) {
     107           0 :       return nullptr;
     108             :     }
     109             : 
     110           0 :     return it->second;
     111             :   }
     112           0 :   const std::string& GetId() const { return mId; }
     113             : 
     114             :   void DetachTransport_s();
     115             :   virtual void DetachMedia_m();
     116             :   bool AnyCodecHasPluginID(uint64_t aPluginID);
     117             : protected:
     118             :   void EndTrack(MediaStream* stream, dom::MediaStreamTrack* track);
     119             :   RefPtr<DOMMediaStream> mMediaStream;
     120             :   PeerConnectionMedia *mParent;
     121             :   const std::string mId;
     122             :   // These get set up before we generate our local description, the pipelines
     123             :   // and conduits are set up once offer/answer completes.
     124             :   std::map<std::string, RefPtr<dom::MediaStreamTrack>> mTracks;
     125             :   std::map<std::string, RefPtr<MediaPipeline>> mPipelines;
     126             : };
     127             : 
     128             : // TODO(ekr@rtfm.com): Refactor {Local,Remote}SourceStreamInfo
     129             : // bug 837539.
     130             : class LocalSourceStreamInfo : public SourceStreamInfo {
     131           0 :   ~LocalSourceStreamInfo() {
     132           0 :     mMediaStream = nullptr;
     133           0 :   }
     134             : public:
     135           0 :   LocalSourceStreamInfo(DOMMediaStream *aMediaStream,
     136             :                         PeerConnectionMedia *aParent,
     137             :                         const std::string& aId)
     138           0 :      : SourceStreamInfo(aMediaStream, aParent, aId) {}
     139             : 
     140             :   nsresult TakePipelineFrom(RefPtr<LocalSourceStreamInfo>& info,
     141             :                             const std::string& oldTrackId,
     142             :                             dom::MediaStreamTrack& aNewTrack,
     143             :                             const std::string& newTrackId);
     144             : 
     145             :   void UpdateSinkIdentity_m(dom::MediaStreamTrack* aTrack,
     146             :                             nsIPrincipal* aPrincipal,
     147             :                             const PeerIdentity* aSinkIdentity);
     148             : 
     149           0 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(LocalSourceStreamInfo)
     150             : 
     151             : private:
     152             :   already_AddRefed<MediaPipeline> ForgetPipelineByTrackId_m(
     153             :       const std::string& trackId);
     154             : };
     155             : 
     156             : class RemoteTrackSource : public dom::MediaStreamTrackSource
     157             : {
     158             : public:
     159           0 :   explicit RemoteTrackSource(nsIPrincipal* aPrincipal, const nsString& aLabel)
     160           0 :     : dom::MediaStreamTrackSource(aPrincipal, aLabel) {}
     161             : 
     162           0 :   dom::MediaSourceEnum GetMediaSource() const override
     163             :   {
     164           0 :     return dom::MediaSourceEnum::Other;
     165             :   }
     166             : 
     167             :   already_AddRefed<PledgeVoid>
     168             :   ApplyConstraints(nsPIDOMWindowInner* aWindow,
     169             :                    const dom::MediaTrackConstraints& aConstraints,
     170             :                    dom::CallerType aCallerType) override;
     171             : 
     172           0 :   void Stop() override
     173             :   {
     174             :     // XXX (Bug 1314270): Implement rejection logic if necessary when we have
     175             :     //                    clarity in the spec.
     176           0 :   }
     177             : 
     178           0 :   void SetPrincipal(nsIPrincipal* aPrincipal)
     179             :   {
     180           0 :     mPrincipal = aPrincipal;
     181           0 :     PrincipalChanged();
     182           0 :   }
     183             : 
     184             : protected:
     185           0 :   virtual ~RemoteTrackSource() {}
     186             : };
     187             : 
     188             : class RemoteSourceStreamInfo : public SourceStreamInfo {
     189           0 :   ~RemoteSourceStreamInfo() {}
     190             :  public:
     191           0 :   RemoteSourceStreamInfo(already_AddRefed<DOMMediaStream> aMediaStream,
     192             :                          PeerConnectionMedia *aParent,
     193             :                          const std::string& aId)
     194           0 :     : SourceStreamInfo(aMediaStream, aParent, aId),
     195           0 :       mReceiving(false)
     196             :   {
     197           0 :   }
     198             : 
     199             :   void DetachMedia_m() override;
     200             :   void RemoveTrack(const std::string& trackId) override;
     201             :   void SyncPipeline(RefPtr<MediaPipelineReceive> aPipeline);
     202             : 
     203             :   void UpdatePrincipal_m(nsIPrincipal* aPrincipal);
     204             : 
     205           0 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteSourceStreamInfo)
     206             : 
     207           0 :   void AddTrack(const std::string& trackId,
     208             :                 const RefPtr<dom::MediaStreamTrack>& aTrack) override
     209             :   {
     210           0 :     SourceStreamInfo::AddTrack(trackId, aTrack);
     211           0 :   }
     212             : 
     213           0 :   TrackID GetNumericTrackId(const std::string& trackId) const
     214             :   {
     215           0 :     dom::MediaStreamTrack* track = GetTrackById(trackId);
     216           0 :     if (!track) {
     217           0 :       return TRACK_INVALID;
     218             :     }
     219           0 :     return track->mTrackID;
     220             :   }
     221             : 
     222             :   void StartReceiving();
     223             : 
     224             :  private:
     225             :   // True iff SetPullEnabled(true) has been called on the DOMMediaStream. This
     226             :   // happens when offer/answer concludes.
     227             :   bool mReceiving;
     228             : };
     229             : 
     230             : class PeerConnectionMedia : public sigslot::has_slots<> {
     231           0 :   ~PeerConnectionMedia()
     232           0 :   {
     233           0 :     MOZ_RELEASE_ASSERT(!mMainThread);
     234           0 :   }
     235             : 
     236             :  public:
     237             :   explicit PeerConnectionMedia(PeerConnectionImpl *parent);
     238             : 
     239             :   enum IceRestartState { ICE_RESTART_NONE,
     240             :                          ICE_RESTART_PROVISIONAL,
     241             :                          ICE_RESTART_COMMITTED
     242             :   };
     243             : 
     244           0 :   PeerConnectionImpl* GetPC() { return mParent; }
     245             :   nsresult Init(const std::vector<NrIceStunServer>& stun_servers,
     246             :                 const std::vector<NrIceTurnServer>& turn_servers,
     247             :                 NrIceCtx::Policy policy);
     248             :   // WARNING: This destroys the object!
     249             :   void SelfDestruct();
     250             : 
     251             :   RefPtr<NrIceCtxHandler> ice_ctx_hdlr() const { return mIceCtxHdlr; }
     252           0 :   RefPtr<NrIceCtx> ice_ctx() const { return mIceCtxHdlr->ctx(); }
     253             : 
     254           0 :   RefPtr<NrIceMediaStream> ice_media_stream(size_t i) const {
     255           0 :     return mIceCtxHdlr->ctx()->GetStream(i);
     256             :   }
     257             : 
     258             :   size_t num_ice_media_streams() const {
     259             :     return mIceCtxHdlr->ctx()->GetStreamCount();
     260             :   }
     261             : 
     262             :   // Ensure ICE transports exist that we might need when offer/answer concludes
     263             :   void EnsureTransports(const JsepSession& aSession);
     264             : 
     265             :   // Activate or remove ICE transports at the conclusion of offer/answer,
     266             :   // or when rollback occurs.
     267             :   void ActivateOrRemoveTransports(const JsepSession& aSession,
     268             :                                   const bool forceIceTcp);
     269             : 
     270             :   // Start ICE checks.
     271             :   void StartIceChecks(const JsepSession& session);
     272             : 
     273             :   bool IsIceRestarting() const;
     274             :   IceRestartState GetIceRestartState() const;
     275             : 
     276             :   // Begin ICE restart
     277             :   void BeginIceRestart(const std::string& ufrag,
     278             :                        const std::string& pwd);
     279             :   // Commit ICE Restart - offer/answer complete, no rollback possible
     280             :   void CommitIceRestart();
     281             :   // Finalize ICE restart
     282             :   void FinalizeIceRestart();
     283             :   // Abort ICE restart
     284             :   void RollbackIceRestart();
     285             : 
     286             :   // Process a trickle ICE candidate.
     287             :   void AddIceCandidate(const std::string& candidate, const std::string& mid,
     288             :                        uint32_t aMLine);
     289             : 
     290             :   // Handle notifications of network online/offline events.
     291             :   void UpdateNetworkState(bool online);
     292             : 
     293             :   // Handle complete media pipelines.
     294             :   nsresult UpdateMediaPipelines(const JsepSession& session);
     295             : 
     296             :   // Add a track (main thread only)
     297             :   nsresult AddTrack(DOMMediaStream& aMediaStream,
     298             :                     const std::string& streamId,
     299             :                     dom::MediaStreamTrack& aTrack,
     300             :                     const std::string& trackId);
     301             : 
     302             :   nsresult RemoveLocalTrack(const std::string& streamId,
     303             :                             const std::string& trackId);
     304             :   nsresult RemoveRemoteTrack(const std::string& streamId,
     305             :                             const std::string& trackId);
     306             : 
     307             :   // Get a specific local stream
     308           0 :   uint32_t LocalStreamsLength()
     309             :   {
     310           0 :     return mLocalSourceStreams.Length();
     311             :   }
     312             :   LocalSourceStreamInfo* GetLocalStreamByIndex(int index);
     313             :   LocalSourceStreamInfo* GetLocalStreamById(const std::string& id);
     314             :   LocalSourceStreamInfo* GetLocalStreamByTrackId(const std::string& id);
     315             : 
     316             :   // Get a specific remote stream
     317           0 :   uint32_t RemoteStreamsLength()
     318             :   {
     319           0 :     return mRemoteSourceStreams.Length();
     320             :   }
     321             : 
     322             :   RemoteSourceStreamInfo* GetRemoteStreamByIndex(size_t index);
     323             :   RemoteSourceStreamInfo* GetRemoteStreamById(const std::string& id);
     324             :   RemoteSourceStreamInfo* GetRemoteStreamByTrackId(const std::string& id);
     325             : 
     326             :   // Add a remote stream.
     327             :   nsresult AddRemoteStream(RefPtr<RemoteSourceStreamInfo> aInfo);
     328             : 
     329             :   nsresult ReplaceTrack(const std::string& aOldStreamId,
     330             :                         const std::string& aOldTrackId,
     331             :                         dom::MediaStreamTrack& aNewTrack,
     332             :                         const std::string& aNewStreamId,
     333             :                         const std::string& aNewTrackId);
     334             : 
     335             :   // In cases where the peer isn't yet identified, we disable the pipeline (not
     336             :   // the stream, that would potentially affect others), so that it sends
     337             :   // black/silence.  Once the peer is identified, re-enable those streams.
     338             :   // aTrack will be set if this update came from a principal change on aTrack.
     339             :   void UpdateSinkIdentity_m(dom::MediaStreamTrack* aTrack,
     340             :                             nsIPrincipal* aPrincipal,
     341             :                             const PeerIdentity* aSinkIdentity);
     342             :   // this determines if any track is peerIdentity constrained
     343             :   bool AnyLocalTrackHasPeerIdentity() const;
     344             :   // When we finally learn who is on the other end, we need to change the ownership
     345             :   // on streams
     346             :   void UpdateRemoteStreamPrincipals_m(nsIPrincipal* aPrincipal);
     347             : 
     348             :   bool AnyCodecHasPluginID(uint64_t aPluginID);
     349             : 
     350           0 :   const nsCOMPtr<nsIThread>& GetMainThread() const { return mMainThread; }
     351           0 :   const nsCOMPtr<nsIEventTarget>& GetSTSThread() const { return mSTSThread; }
     352             : 
     353           0 :   static size_t GetTransportFlowIndex(int aStreamIndex, bool aRtcp)
     354             :   {
     355           0 :     return aStreamIndex * 2 + (aRtcp ? 1 : 0);
     356             :   }
     357             : 
     358             :   // Get a transport flow either RTP/RTCP for a particular stream
     359             :   // A stream can be of audio/video/datachannel/budled(?) types
     360           0 :   RefPtr<TransportFlow> GetTransportFlow(int aStreamIndex, bool aIsRtcp) {
     361           0 :     int index_inner = GetTransportFlowIndex(aStreamIndex, aIsRtcp);
     362             : 
     363           0 :     if (mTransportFlows.find(index_inner) == mTransportFlows.end())
     364           0 :       return nullptr;
     365             : 
     366           0 :     return mTransportFlows[index_inner];
     367             :   }
     368             : 
     369             :   // Add a transport flow
     370             :   void AddTransportFlow(int aIndex, bool aRtcp,
     371             :                         const RefPtr<TransportFlow> &aFlow);
     372             :   void RemoveTransportFlow(int aIndex, bool aRtcp);
     373             :   void ConnectDtlsListener_s(const RefPtr<TransportFlow>& aFlow);
     374             :   void DtlsConnected_s(TransportLayer* aFlow,
     375             :                        TransportLayer::State state);
     376             :   static void DtlsConnected_m(const std::string& aParentHandle,
     377             :                               bool aPrivacyRequested);
     378             : 
     379           0 :   RefPtr<AudioSessionConduit> GetAudioConduit(size_t level) {
     380           0 :     auto it = mConduits.find(level);
     381           0 :     if (it == mConduits.end()) {
     382           0 :       return nullptr;
     383             :     }
     384             : 
     385           0 :     if (it->second.first) {
     386           0 :       MOZ_ASSERT(false, "In GetAudioConduit, we found a video conduit!");
     387             :       return nullptr;
     388             :     }
     389             : 
     390             :     return RefPtr<AudioSessionConduit>(
     391           0 :         static_cast<AudioSessionConduit*>(it->second.second.get()));
     392             :   }
     393             : 
     394           0 :   RefPtr<VideoSessionConduit> GetVideoConduit(size_t level) {
     395           0 :     auto it = mConduits.find(level);
     396           0 :     if (it == mConduits.end()) {
     397           0 :       return nullptr;
     398             :     }
     399             : 
     400           0 :     if (!it->second.first) {
     401           0 :       MOZ_ASSERT(false, "In GetVideoConduit, we found an audio conduit!");
     402             :       return nullptr;
     403             :     }
     404             : 
     405             :     return RefPtr<VideoSessionConduit>(
     406           0 :         static_cast<VideoSessionConduit*>(it->second.second.get()));
     407             :   }
     408             : 
     409           0 :   void AddVideoConduit(size_t level, const RefPtr<VideoSessionConduit> &aConduit) {
     410           0 :     mConduits[level] = std::make_pair(true, aConduit);
     411           0 :   }
     412             : 
     413             :   // Add a conduit
     414           0 :   void AddAudioConduit(size_t level, const RefPtr<AudioSessionConduit> &aConduit) {
     415           0 :     mConduits[level] = std::make_pair(false, aConduit);
     416           0 :   }
     417             : 
     418             :   // ICE state signals
     419             :   sigslot::signal2<NrIceCtx*, NrIceCtx::GatheringState>
     420             :       SignalIceGatheringStateChange;
     421             :   sigslot::signal2<NrIceCtx*, NrIceCtx::ConnectionState>
     422             :       SignalIceConnectionStateChange;
     423             :   // This passes a candidate:... attribute  and level
     424             :   sigslot::signal2<const std::string&, uint16_t> SignalCandidate;
     425             :   // This passes address, port, level of the default candidate.
     426             :   sigslot::signal5<const std::string&, uint16_t,
     427             :                    const std::string&, uint16_t, uint16_t>
     428             :       SignalUpdateDefaultCandidate;
     429             :   sigslot::signal1<uint16_t>
     430             :       SignalEndOfLocalCandidates;
     431             : 
     432             :   RefPtr<WebRtcCallWrapper> mCall;
     433             : 
     434             :  private:
     435             :   void InitLocalAddrs(); // for stun local address IPC request
     436             :   nsresult InitProxy();
     437             :   class ProtocolProxyQueryHandler : public nsIProtocolProxyCallback {
     438             :    public:
     439           0 :     explicit ProtocolProxyQueryHandler(PeerConnectionMedia *pcm) :
     440           0 :       pcm_(pcm) {}
     441             : 
     442             :     NS_IMETHOD OnProxyAvailable(nsICancelable *request,
     443             :                                 nsIChannel *aChannel,
     444             :                                 nsIProxyInfo *proxyinfo,
     445             :                                 nsresult result) override;
     446             :     NS_DECL_ISUPPORTS
     447             : 
     448             :    private:
     449             :     void SetProxyOnPcm(nsIProxyInfo& proxyinfo);
     450             :     RefPtr<PeerConnectionMedia> pcm_;
     451           0 :     virtual ~ProtocolProxyQueryHandler() {}
     452             :   };
     453             : 
     454             :   class StunAddrsHandler : public net::StunAddrsListener {
     455             :    public:
     456           0 :     explicit StunAddrsHandler(PeerConnectionMedia *pcm) :
     457           0 :       pcm_(pcm) {}
     458             :     void OnStunAddrsAvailable(
     459             :         const mozilla::net::NrIceStunAddrArray& addrs) override;
     460             :    private:
     461             :     RefPtr<PeerConnectionMedia> pcm_;
     462           0 :     virtual ~StunAddrsHandler() {}
     463             :   };
     464             : 
     465             :   // Shutdown media transport. Must be called on STS thread.
     466             :   void ShutdownMediaTransport_s();
     467             : 
     468             :   // Final destruction of the media stream. Must be called on the main
     469             :   // thread.
     470             :   void SelfDestruct_m();
     471             : 
     472             :   // Manage ICE transports.
     473             :   void EnsureTransport_s(size_t aLevel, size_t aComponentCount);
     474             :   void ActivateOrRemoveTransport_s(
     475             :       size_t aMLine,
     476             :       size_t aComponentCount,
     477             :       const std::string& aUfrag,
     478             :       const std::string& aPassword,
     479             :       const std::vector<std::string>& aCandidateList);
     480             :   void RemoveTransportsAtOrAfter_s(size_t aMLine);
     481             : 
     482             :   void GatherIfReady();
     483             :   void FlushIceCtxOperationQueueIfReady();
     484             :   void PerformOrEnqueueIceCtxOperation(nsIRunnable* runnable);
     485             :   void EnsureIceGathering_s(bool aDefaultRouteOnly, bool aProxyOnly);
     486             :   void StartIceChecks_s(bool aIsControlling,
     487             :                         bool aIsOfferer,
     488             :                         bool aIsIceLite,
     489             :                         const std::vector<std::string>& aIceOptionsList);
     490             : 
     491             :   void BeginIceRestart_s(RefPtr<NrIceCtx> new_ctx);
     492             :   void FinalizeIceRestart_s();
     493             :   void RollbackIceRestart_s();
     494             :   bool GetPrefDefaultAddressOnly() const;
     495             :   bool GetPrefProxyOnly() const;
     496             : 
     497             :   void ConnectSignals(NrIceCtx *aCtx, NrIceCtx *aOldCtx=nullptr);
     498             : 
     499             :   // Process a trickle ICE candidate.
     500             :   void AddIceCandidate_s(const std::string& aCandidate, const std::string& aMid,
     501             :                          uint32_t aMLine);
     502             : 
     503             :   void UpdateNetworkState_s(bool online);
     504             : 
     505             :   // ICE events
     506             :   void IceGatheringStateChange_s(NrIceCtx* ctx,
     507             :                                NrIceCtx::GatheringState state);
     508             :   void IceConnectionStateChange_s(NrIceCtx* ctx,
     509             :                                 NrIceCtx::ConnectionState state);
     510             :   void IceStreamReady_s(NrIceMediaStream *aStream);
     511             :   void OnCandidateFound_s(NrIceMediaStream *aStream,
     512             :                           const std::string& aCandidate);
     513             :   void EndOfLocalCandidates(const std::string& aDefaultAddr,
     514             :                             uint16_t aDefaultPort,
     515             :                             const std::string& aDefaultRtcpAddr,
     516             :                             uint16_t aDefaultRtcpPort,
     517             :                             uint16_t aMLine);
     518             :   void GetDefaultCandidates(const NrIceMediaStream& aStream,
     519             :                             NrIceCandidate* aCandidate,
     520             :                             NrIceCandidate* aRtcpCandidate);
     521             : 
     522             :   void IceGatheringStateChange_m(NrIceCtx* ctx,
     523             :                                  NrIceCtx::GatheringState state);
     524             :   void IceConnectionStateChange_m(NrIceCtx* ctx,
     525             :                                   NrIceCtx::ConnectionState state);
     526             :   void OnCandidateFound_m(const std::string& aCandidateLine,
     527             :                           const std::string& aDefaultAddr,
     528             :                           uint16_t aDefaultPort,
     529             :                           const std::string& aDefaultRtcpAddr,
     530             :                           uint16_t aDefaultRtcpPort,
     531             :                           uint16_t aMLine);
     532             :   void EndOfLocalCandidates_m(const std::string& aDefaultAddr,
     533             :                               uint16_t aDefaultPort,
     534             :                               const std::string& aDefaultRtcpAddr,
     535             :                               uint16_t aDefaultRtcpPort,
     536             :                               uint16_t aMLine);
     537           0 :   bool IsIceCtxReady() const {
     538           0 :     return mProxyResolveCompleted && mLocalAddrsCompleted;
     539             :   }
     540             : 
     541             :   // The parent PC
     542             :   PeerConnectionImpl *mParent;
     543             :   // and a loose handle on it for event driven stuff
     544             :   std::string mParentHandle;
     545             :   std::string mParentName;
     546             : 
     547             :   // A list of streams returned from GetUserMedia
     548             :   // This is only accessed on the main thread (with one special exception)
     549             :   nsTArray<RefPtr<LocalSourceStreamInfo> > mLocalSourceStreams;
     550             : 
     551             :   // A list of streams provided by the other side
     552             :   // This is only accessed on the main thread (with one special exception)
     553             :   nsTArray<RefPtr<RemoteSourceStreamInfo> > mRemoteSourceStreams;
     554             : 
     555             :   std::map<size_t, std::pair<bool, RefPtr<MediaSessionConduit>>> mConduits;
     556             : 
     557             :   // ICE objects
     558             :   RefPtr<NrIceCtxHandler> mIceCtxHdlr;
     559             : 
     560             :   // DNS
     561             :   RefPtr<NrIceResolver> mDNSResolver;
     562             : 
     563             :   // Transport flows: even is RTP, odd is RTCP
     564             :   std::map<int, RefPtr<TransportFlow> > mTransportFlows;
     565             : 
     566             :   // UUID Generator
     567             :   UniquePtr<PCUuidGenerator> mUuidGen;
     568             : 
     569             :   // The main thread.
     570             :   nsCOMPtr<nsIThread> mMainThread;
     571             : 
     572             :   // The STS thread.
     573             :   nsCOMPtr<nsIEventTarget> mSTSThread;
     574             : 
     575             :   // Used whenever we need to dispatch a runnable to STS to tweak something
     576             :   // on our ICE ctx, but are not ready to do so at the moment (eg; we are
     577             :   // waiting to get a callback with our http proxy config before we start
     578             :   // gathering or start checking)
     579             :   std::vector<nsCOMPtr<nsIRunnable>> mQueuedIceCtxOperations;
     580             : 
     581             :   // Used to cancel any ongoing proxy request.
     582             :   nsCOMPtr<nsICancelable> mProxyRequest;
     583             : 
     584             :   // Used to track the state of the request.
     585             :   bool mProxyResolveCompleted;
     586             : 
     587             :   // Used to store the result of the request.
     588             :   UniquePtr<NrIceProxyServer> mProxyServer;
     589             : 
     590             :   // Used to track the state of ice restart
     591             :   IceRestartState mIceRestartState;
     592             : 
     593             :   // Used to cancel incoming stun addrs response
     594             :   RefPtr<net::StunAddrsRequestChild> mStunAddrsRequest;
     595             : 
     596             :   // Used to track the state of the stun addr IPC request
     597             :   bool mLocalAddrsCompleted;
     598             : 
     599             :   // Used to store the result of the stun addr IPC request
     600             :   nsTArray<NrIceStunAddr> mStunAddrs;
     601             : 
     602           0 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PeerConnectionMedia)
     603             : };
     604             : 
     605             : } // namespace mozilla
     606             : 
     607             : #endif

Generated by: LCOV version 1.13