rtp_sender_video.h revision 2f44673d665899ca788ae44247a9a7f4764f5e2b
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 16#include "typedefs.h" 17#include "common_types.h" // Transport 18#include "rtp_rtcp_config.h" 19 20#include "rtp_rtcp_defines.h" 21#include "rtp_utility.h" 22 23#include "video_codec_information.h" 24#include "forward_error_correction.h" 25#include "bitrate.h" 26#include "rtp_sender.h" 27#include "producer_fec.h" 28 29namespace webrtc { 30class CriticalSectionWrapper; 31struct RtpPacket; 32 33class RTPSenderVideo 34{ 35public: 36 RTPSenderVideo(const int32_t id, Clock* clock, 37 RTPSenderInterface* rtpSender); 38 virtual ~RTPSenderVideo(); 39 40 virtual RtpVideoCodecTypes VideoCodecType() const; 41 42 uint16_t FECPacketOverhead() const; 43 44 int32_t RegisterVideoPayload( 45 const char payloadName[RTP_PAYLOAD_NAME_SIZE], 46 const int8_t payloadType, 47 const uint32_t maxBitRate, 48 ModuleRTPUtility::Payload*& payload); 49 50 int32_t SendVideo(const RtpVideoCodecTypes videoType, 51 const FrameType frameType, 52 const int8_t payloadType, 53 const uint32_t captureTimeStamp, 54 int64_t capture_time_ms, 55 const uint8_t* payloadData, 56 const uint32_t payloadSize, 57 const RTPFragmentationHeader* fragmentation, 58 VideoCodecInformation* codecInfo, 59 const RTPVideoTypeHeader* rtpTypeHdr); 60 61 int32_t SendRTPIntraRequest(); 62 63 void SetVideoCodecType(RtpVideoCodecTypes type); 64 65 VideoCodecInformation* CodecInformationVideo(); 66 67 void SetMaxConfiguredBitrateVideo(const uint32_t maxBitrate); 68 69 uint32_t MaxConfiguredBitrateVideo() const; 70 71 // FEC 72 int32_t SetGenericFECStatus(const bool enable, 73 const uint8_t payloadTypeRED, 74 const uint8_t payloadTypeFEC); 75 76 int32_t GenericFECStatus(bool& enable, 77 uint8_t& payloadTypeRED, 78 uint8_t& payloadTypeFEC) const; 79 80 int32_t SetFecParameters(const FecProtectionParams* delta_params, 81 const FecProtectionParams* key_params); 82 83 void ProcessBitrate(); 84 85 uint32_t VideoBitrateSent() const; 86 uint32_t FecOverheadRate() const; 87 88 int SelectiveRetransmissions() const; 89 int SetSelectiveRetransmissions(uint8_t settings); 90 91protected: 92 virtual int32_t SendVideoPacket(uint8_t* dataBuffer, 93 const uint16_t payloadLength, 94 const uint16_t rtpHeaderLength, 95 int64_t capture_time_ms, 96 StorageType storage, 97 bool protect); 98 99private: 100 int32_t SendGeneric(const FrameType frame_type, 101 const int8_t payload_type, 102 const uint32_t capture_timestamp, 103 int64_t capture_time_ms, 104 const uint8_t* payload, const uint32_t size); 105 106 int32_t SendVP8(const FrameType frameType, 107 const int8_t payloadType, 108 const uint32_t captureTimeStamp, 109 int64_t capture_time_ms, 110 const uint8_t* payloadData, 111 const uint32_t payloadSize, 112 const RTPFragmentationHeader* fragmentation, 113 const RTPVideoTypeHeader* rtpTypeHdr); 114 115private: 116 int32_t _id; 117 RTPSenderInterface& _rtpSender; 118 119 CriticalSectionWrapper* _sendVideoCritsect; 120 RtpVideoCodecTypes _videoType; 121 VideoCodecInformation* _videoCodecInformation; 122 uint32_t _maxBitrate; 123 int32_t _retransmissionSettings; 124 125 // FEC 126 ForwardErrorCorrection _fec; 127 bool _fecEnabled; 128 int8_t _payloadTypeRED; 129 int8_t _payloadTypeFEC; 130 unsigned int _numberFirstPartition; 131 FecProtectionParams delta_fec_params_; 132 FecProtectionParams key_fec_params_; 133 ProducerFec producer_fec_; 134 135 // Bitrate used for FEC payload, RED headers, RTP headers for FEC packets 136 // and any padding overhead. 137 Bitrate _fecOverheadRate; 138 // Bitrate used for video payload and RTP headers 139 Bitrate _videoBitrate; 140}; 141} // namespace webrtc 142 143#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ 144