LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/rtp_rtcp/source - rtp_sender_video.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 8 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
       3             :  *
       4             :  *  Use of this source code is governed by a BSD-style license
       5             :  *  that can be found in the LICENSE file in the root of the source
       6             :  *  tree. An additional intellectual property rights grant can be found
       7             :  *  in the file PATENTS.  All contributing project authors may
       8             :  *  be found in the AUTHORS file in the root of the source tree.
       9             :  */
      10             : 
      11             : #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_
      12             : #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_
      13             : 
      14             : #include <list>
      15             : #include <memory>
      16             : #include <vector>
      17             : 
      18             : #include "webrtc/base/criticalsection.h"
      19             : #include "webrtc/base/onetimeevent.h"
      20             : #include "webrtc/base/optional.h"
      21             : #include "webrtc/base/rate_statistics.h"
      22             : #include "webrtc/base/sequenced_task_checker.h"
      23             : #include "webrtc/base/thread_annotations.h"
      24             : #include "webrtc/common_types.h"
      25             : #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h"
      26             : #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
      27             : #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
      28             : #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h"
      29             : #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
      30             : #include "webrtc/modules/rtp_rtcp/source/ulpfec_generator.h"
      31             : #include "webrtc/modules/rtp_rtcp/source/video_codec_information.h"
      32             : #include "webrtc/typedefs.h"
      33             : 
      34             : namespace webrtc {
      35             : class RtpPacketToSend;
      36             : 
      37             : class RTPSenderVideo {
      38             :  public:
      39             :   RTPSenderVideo(Clock* clock,
      40             :                  RTPSender* rtpSender,
      41             :                  FlexfecSender* flexfec_sender);
      42             :   virtual ~RTPSenderVideo();
      43             : 
      44             :   virtual RtpVideoCodecTypes VideoCodecType() const;
      45             : 
      46           0 :   size_t FecPacketOverhead() const {
      47           0 :     rtc::CritScope cs(&crit_);
      48           0 :     return CalculateFecPacketOverhead();
      49             :   }
      50             : 
      51             :   static RtpUtility::Payload* CreateVideoPayload(
      52             :       const char payload_name[RTP_PAYLOAD_NAME_SIZE],
      53             :       int8_t payload_type);
      54             : 
      55             :   bool SendVideo(RtpVideoCodecTypes video_type,
      56             :                  FrameType frame_type,
      57             :                  int8_t payload_type,
      58             :                  uint32_t capture_timestamp,
      59             :                  int64_t capture_time_ms,
      60             :                  const uint8_t* payload_data,
      61             :                  size_t payload_size,
      62             :                  const RTPFragmentationHeader* fragmentation,
      63             :                  const RTPVideoHeader* video_header,
      64             :                  const char* rid);
      65             : 
      66             :   void SetVideoCodecType(RtpVideoCodecTypes type);
      67             : 
      68             :   // ULPFEC.
      69             :   void SetUlpfecConfig(int red_payload_type, int ulpfec_payload_type);
      70             :   void GetUlpfecConfig(int* red_payload_type, int* ulpfec_payload_type) const;
      71             : 
      72             :   // FlexFEC/ULPFEC.
      73             :   void SetFecParameters(const FecProtectionParams& delta_params,
      74             :                         const FecProtectionParams& key_params);
      75             : 
      76             :   // FlexFEC.
      77             :   rtc::Optional<uint32_t> FlexfecSsrc() const;
      78             : 
      79             :   uint32_t VideoBitrateSent() const;
      80             :   uint32_t FecOverheadRate() const;
      81             : 
      82             :   int SelectiveRetransmissions() const;
      83             :   void SetSelectiveRetransmissions(uint8_t settings);
      84             : 
      85             :  private:
      86             :   size_t CalculateFecPacketOverhead() const EXCLUSIVE_LOCKS_REQUIRED(crit_);
      87             : 
      88             :   void SendVideoPacket(std::unique_ptr<RtpPacketToSend> packet,
      89             :                        StorageType storage);
      90             : 
      91             :   void SendVideoPacketAsRedMaybeWithUlpfec(
      92             :       std::unique_ptr<RtpPacketToSend> media_packet,
      93             :       StorageType media_packet_storage,
      94             :       bool protect_media_packet);
      95             : 
      96             :   // TODO(brandtr): Remove the FlexFEC functions when FlexfecSender has been
      97             :   // moved to PacedSender.
      98             :   void SendVideoPacketWithFlexfec(std::unique_ptr<RtpPacketToSend> media_packet,
      99             :                                   StorageType media_packet_storage,
     100             :                                   bool protect_media_packet);
     101             : 
     102           0 :   bool red_enabled() const EXCLUSIVE_LOCKS_REQUIRED(crit_) {
     103           0 :     return red_payload_type_ >= 0;
     104             :   }
     105             : 
     106           0 :   bool ulpfec_enabled() const EXCLUSIVE_LOCKS_REQUIRED(crit_) {
     107           0 :     return ulpfec_payload_type_ >= 0;
     108             :   }
     109             : 
     110           0 :   bool flexfec_enabled() const { return flexfec_sender_ != nullptr; }
     111             : 
     112             :   RTPSender* const rtp_sender_;
     113             :   Clock* const clock_;
     114             : 
     115             :   // Should never be held when calling out of this class.
     116             :   rtc::CriticalSection crit_;
     117             : 
     118             :   RtpVideoCodecTypes video_type_;
     119             :   int32_t retransmission_settings_ GUARDED_BY(crit_);
     120             :   VideoRotation last_rotation_ GUARDED_BY(crit_);
     121             : 
     122             :   // RED/ULPFEC.
     123             :   int red_payload_type_ GUARDED_BY(crit_);
     124             :   int ulpfec_payload_type_ GUARDED_BY(crit_);
     125             :   UlpfecGenerator ulpfec_generator_ GUARDED_BY(crit_);
     126             : 
     127             :   // FlexFEC.
     128             :   FlexfecSender* const flexfec_sender_;
     129             : 
     130             :   // FEC parameters, applicable to either ULPFEC or FlexFEC.
     131             :   FecProtectionParams delta_fec_params_ GUARDED_BY(crit_);
     132             :   FecProtectionParams key_fec_params_ GUARDED_BY(crit_);
     133             : 
     134             :   rtc::CriticalSection stats_crit_;
     135             :   // Bitrate used for FEC payload, RED headers, RTP headers for FEC packets
     136             :   // and any padding overhead.
     137             :   RateStatistics fec_bitrate_ GUARDED_BY(stats_crit_);
     138             :   // Bitrate used for video payload and RTP headers.
     139             :   RateStatistics video_bitrate_ GUARDED_BY(stats_crit_);
     140             :   OneTimeEvent first_frame_sent_;
     141             : };
     142             : 
     143             : }  // namespace webrtc
     144             : 
     145             : #endif  // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_

Generated by: LCOV version 1.13