LCOV - code coverage report
Current view: top level - media/webrtc/signaling/src/media-conduit - VideoConduit.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 37 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 27 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 VIDEO_SESSION_H_
       6             : #define VIDEO_SESSION_H_
       7             : 
       8             : #include "mozilla/Atomics.h"
       9             : #include "mozilla/Attributes.h"
      10             : #include "mozilla/SharedThreadPool.h"
      11             : #include "nsAutoPtr.h"
      12             : #include "nsITimer.h"
      13             : 
      14             : #include "MediaConduitInterface.h"
      15             : #include "MediaEngineWrapper.h"
      16             : #include "RunningStat.h"
      17             : #include "runnable_utils.h"
      18             : 
      19             : // conflicts with #include of scoped_ptr.h
      20             : #undef FF
      21             : // Video Engine Includes
      22             : #include "webrtc/call.h"
      23             : #include "webrtc/common_types.h"
      24             : #ifdef FF
      25             : #undef FF // Avoid name collision between scoped_ptr.h and nsCRTGlue.h.
      26             : #endif
      27             : #include "webrtc/video_decoder.h"
      28             : #include "webrtc/video_encoder.h"
      29             : #include "webrtc/config.h"
      30             : #include "webrtc/media/base/videosinkinterface.h"
      31             : #include "webrtc/media/base/videoadapter.h"
      32             : #include "webrtc/media/base/videobroadcaster.h"
      33             : #include <functional>
      34             : #include <memory>
      35             : /** This file hosts several structures identifying different aspects
      36             :  * of a RTP Session.
      37             :  */
      38             : 
      39             : namespace mozilla {
      40             : 
      41             : const int kVideoMtu = 1200;
      42             : const int kQpMax = 56;
      43             : 
      44             : class WebrtcAudioConduit;
      45             : class nsThread;
      46             : 
      47             : // Interface of external video encoder for WebRTC.
      48           0 : class WebrtcVideoEncoder : public VideoEncoder
      49             :                          , public webrtc::VideoEncoder
      50             : {
      51             : };
      52             : 
      53             : // Interface of external video decoder for WebRTC.
      54           0 : class WebrtcVideoDecoder : public VideoDecoder
      55             :                          , public webrtc::VideoDecoder
      56             : {
      57             : };
      58             : 
      59             : /**
      60             :  * Concrete class for Video session. Hooks up
      61             :  *  - media-source and target to external transport
      62             :  */
      63             : class WebrtcVideoConduit : public VideoSessionConduit
      64             :                          , public webrtc::Transport
      65             :                          , public rtc::VideoSinkInterface<webrtc::VideoFrame>
      66             :                          , public rtc::VideoSourceInterface<webrtc::VideoFrame>
      67             : {
      68             : public:
      69             : 
      70             :   /* Default minimum bitrate for video streams. */
      71             :   static const uint32_t kDefaultMinBitrate_bps;
      72             :   /* Default start a.k.a. target bitrate for video streams. */
      73             :   static const uint32_t kDefaultStartBitrate_bps;
      74             :   /* Default maximum bitrate for video streams. */
      75             :   static const uint32_t kDefaultMaxBitrate_bps;
      76             : 
      77             :   //VoiceEngine defined constant for Payload Name Size.
      78             :   static const unsigned int CODEC_PLNAME_SIZE;
      79             : 
      80             :   /**
      81             :   * Add rtp extensions to the the VideoSendStream
      82             :   * TODO(@@NG) promote this the MediaConduitInterface when the VoE rework
      83             :   * hits Webrtc.org.
      84             :   */
      85             :   void SetLocalRTPExtensions(bool aIsSend,
      86             :                              const std::vector<webrtc::RtpExtension>& extensions) override;
      87             :   std::vector<webrtc::RtpExtension> GetLocalRTPExtensions(bool aIsSend) const override;
      88             : 
      89             :   /**
      90             :    * Set up A/V sync between this (incoming) VideoConduit and an audio conduit.
      91             :    */
      92             :   void SyncTo(WebrtcAudioConduit *aConduit);
      93             : 
      94             :   /**
      95             :    * Function to attach Renderer end-point for the Media-Video conduit.
      96             :    * @param aRenderer : Reference to the concrete mozilla Video renderer implementation
      97             :    * Note: Multiple invocations of this API shall remove an existing renderer
      98             :    * and attaches the new to the Conduit.
      99             :    */
     100             :   virtual MediaConduitErrorCode AttachRenderer(RefPtr<mozilla::VideoRenderer> aVideoRenderer) override;
     101             :   virtual void DetachRenderer() override;
     102             : 
     103             :   /**
     104             :    * APIs used by the registered external transport to this Conduit to
     105             :    * feed in received RTP Frames to the VideoEngine for decoding
     106             :    */
     107             :   virtual MediaConduitErrorCode ReceivedRTPPacket(const void* data, int len, uint32_t ssrc) override;
     108             : 
     109             :   /**
     110             :    * APIs used by the registered external transport to this Conduit to
     111             :    * feed in received RTP Frames to the VideoEngine for decoding
     112             :    */
     113             :   virtual MediaConduitErrorCode ReceivedRTCPPacket(const void* data, int len) override;
     114             : 
     115             :   virtual MediaConduitErrorCode StopTransmitting() override;
     116             :   virtual MediaConduitErrorCode StartTransmitting() override;
     117             :   virtual MediaConduitErrorCode StopReceiving() override;
     118             :   virtual MediaConduitErrorCode StartReceiving() override;
     119             : 
     120             :   /**
     121             :    * Function to configure sending codec mode for different content
     122             :    */
     123             :   virtual MediaConduitErrorCode ConfigureCodecMode(webrtc::VideoCodecMode) override;
     124             : 
     125             :    /**
     126             :    * Function to configure send codec for the video session
     127             :    * @param sendSessionConfig: CodecConfiguration
     128             :    * @result: On Success, the video engine is configured with passed in codec for send
     129             :    *          On failure, video engine transmit functionality is disabled.
     130             :    * NOTE: This API can be invoked multiple time. Invoking this API may involve restarting
     131             :    *        transmission sub-system on the engine.
     132             :    */
     133             :   virtual MediaConduitErrorCode ConfigureSendMediaCodec(const VideoCodecConfig* codecInfo) override;
     134             : 
     135             :   /**
     136             :    * Function to configure list of receive codecs for the video session
     137             :    * @param sendSessionConfig: CodecConfiguration
     138             :    * @result: On Success, the video engine is configured with passed in codec for send
     139             :    *          Also the playout is enabled.
     140             :    *          On failure, video engine transmit functionality is disabled.
     141             :    * NOTE: This API can be invoked multiple time. Invoking this API may involve restarting
     142             :    *        transmission sub-system on the engine.
     143             :    */
     144             :    virtual MediaConduitErrorCode ConfigureRecvMediaCodecs(
     145             :        const std::vector<VideoCodecConfig* >& codecConfigList) override;
     146             : 
     147             :   /**
     148             :    * Register Transport for this Conduit. RTP and RTCP frames from the VideoEngine
     149             :    * shall be passed to the registered transport for transporting externally.
     150             :    */
     151             :   virtual MediaConduitErrorCode SetTransmitterTransport(RefPtr<TransportInterface> aTransport) override;
     152             : 
     153             :   virtual MediaConduitErrorCode SetReceiverTransport(RefPtr<TransportInterface> aTransport) override;
     154             : 
     155             :   /**
     156             :    * Function to set the encoding bitrate limits based on incoming frame size and rate
     157             :    * @param width, height: dimensions of the frame
     158             :    * @param cap: user-enforced max bitrate, or 0
     159             :    * @param aLastFramerateTenths: holds the current input framerate
     160             :    * @param aVideoStream stream to apply bitrates to
     161             :    */
     162             :   void SelectBitrates(unsigned short width,
     163             :                       unsigned short height,
     164             :                       int cap,
     165             :                       int32_t aLastFramerateTenths,
     166             :                       webrtc::VideoStream& aVideoStream);
     167             : 
     168             :   /**
     169             :    * Function to select and change the encoding resolution based on incoming frame size
     170             :    * and current available bandwidth.
     171             :    * @param width, height: dimensions of the frame
     172             :    * @param frame: optional frame to submit for encoding after reconfig
     173             :    */
     174             :   bool SelectSendResolution(unsigned short width,
     175             :                             unsigned short height,
     176             :                             webrtc::VideoFrame* frame);
     177             : 
     178             :   /**
     179             :    * Function to reconfigure the current send codec for a different
     180             :    * width/height/framerate/etc.
     181             :    * @param width, height: dimensions of the frame
     182             :    * @param frame: optional frame to submit for encoding after reconfig
     183             :    */
     184             :   nsresult ReconfigureSendCodec(unsigned short width,
     185             :                                 unsigned short height,
     186             :                                 webrtc::VideoFrame* frame);
     187             : 
     188             :   /**
     189             :    * Function to select and change the encoding frame rate based on incoming frame rate
     190             :    * and max-mbps setting.
     191             :    * @param current framerate
     192             :    * @result new framerate
     193             :    */
     194             :   unsigned int SelectSendFrameRate(const VideoCodecConfig* codecConfig,
     195             :                                    unsigned int old_framerate,
     196             :                                    unsigned short sending_width,
     197             :                                    unsigned short sending_height) const;
     198             : 
     199             :   /**
     200             :    * Function to deliver a capture video frame for encoding and transport
     201             :    * @param video_frame: pointer to captured video-frame.
     202             :    * @param video_frame_length: size of the frame
     203             :    * @param width, height: dimensions of the frame
     204             :    * @param video_type: Type of the video frame - I420, RAW
     205             :    * @param captured_time: timestamp when the frame was captured.
     206             :    *                       if 0 timestamp is automatcally generated by the engine.
     207             :    *NOTE: ConfigureSendMediaCodec() SHOULD be called before this function can be invoked
     208             :    *       This ensures the inserted video-frames can be transmitted by the conduit
     209             :    */
     210             :   virtual MediaConduitErrorCode SendVideoFrame(unsigned char* video_frame,
     211             :                                                unsigned int video_frame_length,
     212             :                                                unsigned short width,
     213             :                                                unsigned short height,
     214             :                                                VideoType video_type,
     215             :                                                uint64_t capture_time) override;
     216             :   virtual MediaConduitErrorCode SendVideoFrame(webrtc::VideoFrame& frame) override;
     217             : 
     218             :  /**
     219             :    * webrtc::Transport method implementation
     220             :    * ---------------------------------------
     221             :    * Webrtc transport implementation to send and receive RTP packet.
     222             :    * VideoConduit registers itself as ExternalTransport to the VideoStream
     223             :    */
     224             :   virtual bool SendRtp(const uint8_t* packet, size_t length,
     225             :                        const webrtc::PacketOptions& options) override;
     226             : 
     227             :   /**
     228             :    * webrtc::Transport method implementation
     229             :    * ---------------------------------------
     230             :    * Webrtc transport implementation to send and receive RTCP packet.
     231             :    * VideoConduit registers itself as ExternalTransport to the VideoEngine
     232             :    */
     233             :   virtual bool SendRtcp(const uint8_t* packet, size_t length) override;
     234             : 
     235             : 
     236             :   /*
     237             :    * webrtc:VideoSinkInterface implementation
     238             :    * -------------------------------
     239             :    */
     240             :   virtual void OnFrame(const webrtc::VideoFrame& frame) override;
     241             : 
     242             :   /*
     243             :    * webrtc:VideoSourceInterface implementation
     244             :    * -------------------------------
     245             :    */
     246             :   void AddOrUpdateSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
     247             :                        const rtc::VideoSinkWants& wants) override;
     248             :   void RemoveSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override;
     249             : 
     250             :   void OnSinkWantsChanged(const rtc::VideoSinkWants& wants);
     251             : 
     252             :   virtual uint64_t CodecPluginID() override;
     253             : 
     254           0 :   virtual void SetPCHandle(const std::string& aPCHandle) override {
     255           0 :     mPCHandle = aPCHandle;
     256           0 :   }
     257             : 
     258           0 :   unsigned short SendingWidth() override {
     259           0 :     return mSendingWidth;
     260             :   }
     261             : 
     262           0 :   unsigned short SendingHeight() override {
     263           0 :     return mSendingHeight;
     264             :   }
     265             : 
     266           0 :   unsigned int SendingMaxFs() override {
     267           0 :     if(mCurSendCodecConfig) {
     268           0 :       return mCurSendCodecConfig->mEncodingConstraints.maxFs;
     269             :     }
     270           0 :     return 0;
     271             :   }
     272             : 
     273           0 :   unsigned int SendingMaxFr() override {
     274           0 :     if(mCurSendCodecConfig) {
     275           0 :       return mCurSendCodecConfig->mEncodingConstraints.maxFps;
     276             :     }
     277           0 :     return 0;
     278             :   }
     279             : 
     280           0 :   bool Denoising() const {
     281           0 :     return mDenoising;
     282             :   }
     283             : 
     284           0 :   uint8_t SpatialLayers() const {
     285           0 :     return mSpatialLayers;
     286             :   }
     287             : 
     288             :   uint8_t TemporalLayers() const {
     289             :     return mTemporalLayers;
     290             :   }
     291             : 
     292           0 :   webrtc::VideoCodecMode CodecMode() const {
     293           0 :     return mCodecMode;
     294             :   }
     295             : 
     296             :   explicit WebrtcVideoConduit(RefPtr<WebRtcCallWrapper> aCall);
     297             :   virtual ~WebrtcVideoConduit();
     298             : 
     299             :   MediaConduitErrorCode InitMain();
     300             :   virtual MediaConduitErrorCode Init();
     301             :   virtual void Destroy();
     302             : 
     303             :   std::vector<unsigned int> GetLocalSSRCs() const override;
     304             :   bool SetLocalSSRCs(const std::vector<unsigned int> & ssrcs) override;
     305             :   bool GetRemoteSSRC(unsigned int* ssrc) override;
     306             :   bool SetRemoteSSRC(unsigned int ssrc) override;
     307             :   bool SetLocalCNAME(const char* cname) override;
     308             : 
     309             :   bool GetSendPacketTypeStats(
     310             :       webrtc::RtcpPacketTypeCounter* aPacketCounts) override;
     311             : 
     312             :   bool GetRecvPacketTypeStats(
     313             :       webrtc::RtcpPacketTypeCounter* aPacketCounts) override;
     314             : 
     315             :   bool GetVideoEncoderStats(double* framerateMean,
     316             :                             double* framerateStdDev,
     317             :                             double* bitrateMean,
     318             :                             double* bitrateStdDev,
     319             :                             uint32_t* droppedFrames,
     320             :                             uint32_t* framesEncoded) override;
     321             :   bool GetVideoDecoderStats(double* framerateMean,
     322             :                             double* framerateStdDev,
     323             :                             double* bitrateMean,
     324             :                             double* bitrateStdDev,
     325             :                             uint32_t* discardedPackets,
     326             :                             uint32_t* framesDecoded) override;
     327             :   bool GetAVStats(int32_t* jitterBufferDelayMs,
     328             :                   int32_t* playoutBufferDelayMs,
     329             :                   int32_t* avSyncOffsetMs) override;
     330             :   bool GetRTPStats(unsigned int* jitterMs, unsigned int* cumulativeLost) override;
     331             :   bool GetRTCPReceiverReport(DOMHighResTimeStamp* timestamp,
     332             :                              uint32_t* jitterMs,
     333             :                              uint32_t* packetsReceived,
     334             :                              uint64_t* bytesReceived,
     335             :                              uint32_t* cumulativeLost,
     336             :                              int32_t* rttMs) override;
     337             :   bool GetRTCPSenderReport(DOMHighResTimeStamp* timestamp,
     338             :                            unsigned int* packetsSent,
     339             :                            uint64_t* bytesSent) override;
     340             :   uint64_t MozVideoLatencyAvg();
     341             : 
     342             : private:
     343             :   DISALLOW_COPY_AND_ASSIGN(WebrtcVideoConduit);
     344             : 
     345             :   /** Shared statistics for receive and transmit video streams
     346             :    */
     347           0 :   class StreamStatistics {
     348             :   public:
     349             :     void Update(const double aFrameRate, const double aBitrate);
     350             :     /**
     351             :      * Returns gathered stream statistics
     352             :      * @param aOutFrMean: mean framerate
     353             :      * @param aOutFrStdDev: standard deviation of framerate
     354             :      * @param aOutBrMean: mean bitrate
     355             :      * @param aOutBrStdDev: standard deviation of bitrate
     356             :      */
     357             :     bool GetVideoStreamStats(double& aOutFrMean,
     358             :         double& aOutFrStdDev,
     359             :         double& aOutBrMean,
     360             :         double& aOutBrStdDev) const;
     361             :   private:
     362             :     RunningStat mFrameRate;
     363             :     RunningStat mBitrate;
     364             :   };
     365             : 
     366             :   /**
     367             :    * Statistics for sending streams
     368             :    */
     369           0 :   class SendStreamStatistics : public StreamStatistics {
     370             :   public:
     371             :     /**
     372             :      * Returns the calculate number of dropped frames
     373             :      * @param aOutDroppedFrames: the number of dropped frames
     374             :      */
     375             :     void DroppedFrames(uint32_t& aOutDroppedFrames) const;
     376             :     /**
     377             :      * Returns the number of frames that have been encoded so far
     378             :      */
     379           0 :     uint32_t FramesEncoded() const {
     380           0 :       return mFramesEncoded;
     381             :     }
     382             :     void Update(const webrtc::VideoSendStream::Stats& aStats);
     383             :     /**
     384             :      * Call once for every frame delivered for encoding
     385             :      */
     386           0 :     void FrameDeliveredToEncoder() { ++mFramesDeliveredToEncoder; }
     387             :   private:
     388             :     uint32_t mDroppedFrames = 0;
     389             :     uint32_t mFramesEncoded = 0;
     390             :     mozilla::Atomic<int32_t> mFramesDeliveredToEncoder;
     391             :   };
     392             : 
     393             :   /** Statistics for receiving streams
     394             :    */
     395           0 :   class ReceiveStreamStatistics : public StreamStatistics {
     396             :   public:
     397             :     /**
     398             :      * Returns the number of discarded packets
     399             :      * @param aOutDiscPackets: number of discarded packets
     400             :      */
     401             :     void DiscardedPackets(uint32_t& aOutDiscPackets) const;
     402             :    /**
     403             :     * Returns the number of frames decoded
     404             :     * @param aOutDiscPackets: number of frames decoded
     405             :     */
     406             :     void FramesDecoded(uint32_t& aFramesDecoded) const;
     407             :     void Update(const webrtc::VideoReceiveStream::Stats& aStats);
     408             :   private:
     409             :     uint32_t mDiscardedPackets = 0;
     410             :     uint32_t mFramesDecoded = 0;
     411             :   };
     412             :   /*
     413             :    * Stores encoder configuration information and produces
     414             :    * a VideoEncoderConfig from it.
     415             :    */
     416             :   class VideoStreamFactory;
     417             : 
     418           0 :   class VideoEncoderConfigBuilder {
     419             :   public:
     420             :     /**
     421             :      * Stores extended data for Simulcast Streams
     422             :      */
     423           0 :     class SimulcastStreamConfig {
     424             :     public:
     425             :       int jsMaxBitrate; // user-controlled max bitrate
     426             :       double jsScaleDownBy=1.0; // user-controlled downscale
     427             :     };
     428             :     void SetEncoderSpecificSettings(rtc::scoped_refptr<webrtc::VideoEncoderConfig::EncoderSpecificSettings> aSettings);
     429             :     void SetVideoStreamFactory(rtc::scoped_refptr<WebrtcVideoConduit::VideoStreamFactory> aFactory);
     430             :     void SetMinTransmitBitrateBps(int aXmitMinBps);
     431             :     void SetContentType(webrtc::VideoEncoderConfig::ContentType aContentType);
     432             :     void SetResolutionDivisor(unsigned char aDivisor);
     433             :     void SetMaxEncodings(size_t aMaxStreams);
     434             :     void AddStream(webrtc::VideoStream aStream);
     435             :     void AddStream(webrtc::VideoStream aStream,const SimulcastStreamConfig& aSimulcastConfig);
     436             :     size_t StreamCount() const;
     437             :     void ClearStreams();
     438             :     void ForEachStream(
     439             :       const std::function<void(webrtc::VideoStream&, SimulcastStreamConfig&, const size_t index)> && f);
     440           0 :     webrtc::VideoEncoderConfig CopyConfig() const { return mConfig.Copy(); }
     441           0 :     size_t NumberOfStreams() const { return mConfig.number_of_streams; }
     442             : 
     443             :   private:
     444             :     webrtc::VideoEncoderConfig mConfig;
     445             :     std::vector<SimulcastStreamConfig> mSimulcastStreams;
     446             :   };
     447             : 
     448             :   //Function to convert between WebRTC and Conduit codec structures
     449             :   void CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
     450             :                                 webrtc::VideoCodec& cinst);
     451             : 
     452             :   //Checks the codec to be applied
     453             :   MediaConduitErrorCode ValidateCodecConfig(const VideoCodecConfig* codecInfo, bool send);
     454             : 
     455             :   //Utility function to dump recv codec database
     456             :   void DumpCodecDB() const;
     457             : 
     458             :   bool CodecsDifferent(const nsTArray<UniquePtr<VideoCodecConfig>>& a,
     459             :                        const nsTArray<UniquePtr<VideoCodecConfig>>& b);
     460             : 
     461             :   // Factory class for VideoStreams... vie_encoder.cc will call this to reconfigure.
     462             :   // We need to give it access to the conduit to make it's decisions
     463           0 :   class VideoStreamFactory : public webrtc::VideoEncoderConfig::VideoStreamFactoryInterface
     464             :   {
     465             :   public:
     466           0 :     VideoStreamFactory(std::string aCodecName,
     467             :                        WebrtcVideoConduit *aConduit)
     468           0 :       : mCodecName(aCodecName),
     469           0 :         mConduit(aConduit) {}
     470             : 
     471             :   private:
     472             :     std::vector<webrtc::VideoStream>
     473             :       CreateEncoderStreams(int width, int height,
     474             :                            const webrtc::VideoEncoderConfig& config) override;
     475             :     std::string mCodecName;
     476             :     // this is owned by the conduit!
     477             :     WebrtcVideoConduit* mConduit;
     478             :   };
     479             : 
     480             :   // Video Latency Test averaging filter
     481             :   void VideoLatencyUpdate(uint64_t new_sample);
     482             : 
     483             :   MediaConduitErrorCode CreateSendStream();
     484             :   void DeleteSendStream();
     485             :   MediaConduitErrorCode CreateRecvStream();
     486             :   void DeleteRecvStream();
     487             : 
     488             :   webrtc::VideoDecoder* CreateDecoder(webrtc::VideoCodecType aType);
     489             :   webrtc::VideoEncoder* CreateEncoder(webrtc::VideoCodecType aType,
     490             :                                       bool enable_simulcast);
     491             : 
     492             :   MediaConduitErrorCode DeliverPacket(const void *data, int len);
     493             : 
     494             :   bool RequiresNewSendStream(const VideoCodecConfig& newConfig) const;
     495             : 
     496             :   mozilla::ReentrantMonitor mTransportMonitor;
     497             :   RefPtr<TransportInterface> mTransmitterTransport;
     498             :   RefPtr<TransportInterface> mReceiverTransport;
     499             :   RefPtr<mozilla::VideoRenderer> mRenderer;
     500             : 
     501             :   // Frame adapter - handle sinks that we feed data to, and handle resolution
     502             :   // changes needed for them.
     503             :   cricket::VideoAdapter mVideoAdapter;
     504             :   rtc::VideoBroadcaster mVideoBroadcaster;
     505             : 
     506             :   // Engine state we are concerned with.
     507             :   mozilla::Atomic<bool> mEngineTransmitting; // If true ==> Transmit Subsystem is up and running
     508             :   mozilla::Atomic<bool> mEngineReceiving;    // if true ==> Receive Subsystem up and running
     509             : 
     510             :   int mCapId;   // Capturer for this conduit
     511             :   //Local database of currently applied receive codecs
     512             :   nsTArray<UniquePtr<VideoCodecConfig>> mRecvCodecList;
     513             : 
     514             :   // protects mCurSendCodecConfig, mInReconfig,mVideoSend/RecvStreamStats, mSend/RecvStreams, mSendPacketCounts, mRecvPacketCounts
     515             :   Mutex mCodecMutex;
     516             :   nsAutoPtr<VideoCodecConfig> mCurSendCodecConfig;
     517             :   bool mInReconfig;
     518             :   SendStreamStatistics mSendStreamStats;
     519             :   ReceiveStreamStatistics mRecvStreamStats;
     520             :   webrtc::RtcpPacketTypeCounter mSendPacketCounts;
     521             :   webrtc::RtcpPacketTypeCounter mRecvPacketCounts;
     522             : 
     523             :   // Must call webrtc::Call::DestroyVideoReceive/SendStream to delete these:
     524             :   webrtc::VideoReceiveStream* mRecvStream;
     525             :   webrtc::VideoSendStream* mSendStream;
     526             : 
     527             :   unsigned short mLastWidth;
     528             :   unsigned short mLastHeight;
     529             :   unsigned short mSendingWidth;
     530             :   unsigned short mSendingHeight;
     531             :   unsigned short mReceivingWidth;
     532             :   unsigned short mReceivingHeight;
     533             :   unsigned int   mSendingFramerate;
     534             :   // scaled by *10 because Atomic<double/float> isn't supported
     535             :   mozilla::Atomic<int32_t, mozilla::Relaxed> mLastFramerateTenths;
     536             :   unsigned short mNumReceivingStreams;
     537             :   bool mVideoLatencyTestEnable;
     538             :   uint64_t mVideoLatencyAvg;
     539             :   // all in bps!
     540             :   int mMinBitrate;
     541             :   int mStartBitrate;
     542             :   int mPrefMaxBitrate;
     543             :   int mNegotiatedMaxBitrate;
     544             :   int mMinBitrateEstimate;
     545             :   bool mDenoising;
     546             :   bool mLockScaling; // for tests that care about output resolution
     547             :   uint8_t mSpatialLayers;
     548             :   uint8_t mTemporalLayers;
     549             : 
     550             :   static const unsigned int sAlphaNum = 7;
     551             :   static const unsigned int sAlphaDen = 8;
     552             :   static const unsigned int sRoundingPadding = 1024;
     553             : 
     554             :   RefPtr<WebrtcAudioConduit> mSyncedTo;
     555             : 
     556             :   webrtc::VideoCodecMode mCodecMode;
     557             : 
     558             :   // WEBRTC.ORG Call API
     559             :   RefPtr<WebRtcCallWrapper> mCall;
     560             : 
     561             :   webrtc::VideoSendStream::Config mSendStreamConfig;
     562             :   VideoEncoderConfigBuilder mEncoderConfig;
     563             : 
     564             :   webrtc::VideoReceiveStream::Config mRecvStreamConfig;
     565             : 
     566             :   // accessed on creation, and when receiving packets
     567             :   uint32_t mRecvSSRC; // this can change during a stream!
     568             : 
     569             :   // The runnable to set the SSRC is in-flight; queue packets until it's done.
     570             :   bool mRecvSSRCSetInProgress;
     571             :   struct QueuedPacket {
     572             :     int mLen;
     573             :     uint8_t mData[1];
     574             :   };
     575             :   nsTArray<UniquePtr<QueuedPacket>> mQueuedPackets;
     576             : 
     577             :   // The lifetime of these codecs are maintained by the VideoConduit instance.
     578             :   // They are passed to the webrtc::VideoSendStream or VideoReceiveStream,
     579             :   // on construction.
     580             :   nsAutoPtr<webrtc::VideoEncoder> mEncoder; // only one encoder for now
     581             :   std::vector<std::unique_ptr<webrtc::VideoDecoder>> mDecoders;
     582             :   WebrtcVideoEncoder* mSendCodecPlugin;
     583             :   WebrtcVideoDecoder* mRecvCodecPlugin;
     584             : 
     585             :   nsCOMPtr<nsITimer> mVideoStatsTimer;
     586             : 
     587             :   std::string mPCHandle;
     588             : };
     589             : } // end namespace
     590             : 
     591             : #endif

Generated by: LCOV version 1.13