LCOV - code coverage report
Current view: top level - dom/media/mediasink - OutputStreamManager.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 10 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef OutputStreamManager_h
       8             : #define OutputStreamManager_h
       9             : 
      10             : #include "mozilla/RefPtr.h"
      11             : #include "nsTArray.h"
      12             : 
      13             : namespace mozilla {
      14             : 
      15             : class MediaInputPort;
      16             : class MediaStream;
      17             : class MediaStreamGraph;
      18             : class OutputStreamManager;
      19             : class ProcessedMediaStream;
      20             : 
      21           0 : class OutputStreamData {
      22             : public:
      23             :   ~OutputStreamData();
      24             :   void Init(OutputStreamManager* aOwner, ProcessedMediaStream* aStream);
      25             : 
      26             :   // Connect mStream to the input stream.
      27             :   // Return false is mStream is already destroyed, otherwise true.
      28             :   bool Connect(MediaStream* aStream);
      29             :   // Disconnect mStream from its input stream.
      30             :   // Return false is mStream is already destroyed, otherwise true.
      31             :   bool Disconnect();
      32             :   // Return true if aStream points to the same object as mStream.
      33             :   // Used by OutputStreamManager to remove an output stream.
      34             :   bool Equals(MediaStream* aStream) const;
      35             :   // Return the graph mStream belongs to.
      36             :   MediaStreamGraph* Graph() const;
      37             : 
      38             : private:
      39             :   OutputStreamManager* mOwner;
      40             :   RefPtr<ProcessedMediaStream> mStream;
      41             :   // mPort connects our mStream to an input stream.
      42             :   RefPtr<MediaInputPort> mPort;
      43             : };
      44             : 
      45           0 : class OutputStreamManager {
      46           0 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(OutputStreamManager);
      47             : 
      48             : public:
      49             :   // Add the output stream to the collection.
      50             :   void Add(ProcessedMediaStream* aStream, bool aFinishWhenEnded);
      51             :   // Remove the output stream from the collection.
      52             :   void Remove(MediaStream* aStream);
      53             :   // Return true if the collection empty.
      54           0 :   bool IsEmpty() const
      55             :   {
      56           0 :     MOZ_ASSERT(NS_IsMainThread());
      57           0 :     return mStreams.IsEmpty();
      58             :   }
      59             :   // Connect all output streams in the collection to the input stream.
      60             :   void Connect(MediaStream* aStream);
      61             :   // Disconnect all output streams from the input stream.
      62             :   void Disconnect();
      63             :   // Return the graph these streams belong to or null if empty.
      64           0 :   MediaStreamGraph* Graph() const
      65             :   {
      66           0 :     MOZ_ASSERT(NS_IsMainThread());
      67           0 :     return !IsEmpty() ? mStreams[0].Graph() : nullptr;
      68             :   }
      69             : 
      70             : private:
      71           0 :   ~OutputStreamManager() {}
      72             :   // Keep the input stream so we can connect the output streams that
      73             :   // are added after Connect().
      74             :   RefPtr<MediaStream> mInputStream;
      75             :   nsTArray<OutputStreamData> mStreams;
      76             : };
      77             : 
      78             : } // namespace mozilla
      79             : 
      80             : #endif // OutputStreamManager_h

Generated by: LCOV version 1.13