pre-factor cleanup pre-work.

Review URL: https://webrtc-codereview.appspot.com/938010

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3054 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pwestin@webrtc.org 2012-11-07 17:01:04 +00:00
parent 4cebe6cded
commit c66e8b3f31
4 changed files with 803 additions and 1111 deletions

View File

@ -52,7 +52,11 @@ RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) {
}
ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
: _rtpSender(configuration.id, configuration.audio, configuration.clock),
: _rtpSender(configuration.id,
configuration.audio,
configuration.clock,
configuration.outgoing_transport,
configuration.audio_messages),
_rtpReceiver(configuration.id, configuration.audio, configuration.clock,
this),
_rtcpSender(configuration.id, configuration.audio, configuration.clock,
@ -97,10 +101,8 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
_rtcpReceiver.RegisterRtcpObservers(configuration.intra_frame_callback,
configuration.bandwidth_callback,
configuration.rtcp_feedback);
_rtpSender.RegisterAudioCallback(configuration.audio_messages);
_rtpReceiver.RegisterIncomingAudioCallback(configuration.audio_messages);
_rtpSender.RegisterSendTransport(configuration.outgoing_transport);
_rtcpSender.RegisterSendTransport(configuration.outgoing_transport);
// make sure that RTCP objects are aware of our SSRC
@ -628,7 +630,8 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetStartTimestamp(
"SetStartTimestamp(%d)",
timestamp);
_rtcpSender.SetStartTimestamp(timestamp);
return _rtpSender.SetStartTimestamp(timestamp, true);
_rtpSender.SetStartTimestamp(timestamp, true);
return 0; // TODO(pwestin): change to void.
}
WebRtc_UWord16 ModuleRtpRtcpImpl::SequenceNumber() const {
@ -646,7 +649,8 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetSequenceNumber(
"SetSequenceNumber(%d)",
seqNum);
return _rtpSender.SetSequenceNumber(seqNum);
_rtpSender.SetSequenceNumber(seqNum);
return 0; // TODO(pwestin): change to void.
}
WebRtc_UWord32 ModuleRtpRtcpImpl::SSRC() const {
@ -659,17 +663,16 @@ WebRtc_UWord32 ModuleRtpRtcpImpl::SSRC() const {
WebRtc_Word32 ModuleRtpRtcpImpl::SetSSRC(const WebRtc_UWord32 ssrc) {
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SetSSRC(%d)", ssrc);
if (_rtpSender.SetSSRC(ssrc) == 0) {
_rtcpReceiver.SetSSRC(ssrc);
_rtcpSender.SetSSRC(ssrc);
return 0;
}
return -1;
_rtpSender.SetSSRC(ssrc);
_rtcpReceiver.SetSSRC(ssrc);
_rtcpSender.SetSSRC(ssrc);
return 0; // TODO(pwestin): change to void.
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetCSRCStatus(const bool include) {
_rtcpSender.SetCSRCStatus(include);
return _rtpSender.SetCSRCStatus(include);
_rtpSender.SetCSRCStatus(include);
return 0; // TODO(pwestin): change to void.
}
WebRtc_Word32 ModuleRtpRtcpImpl::CSRCs(
@ -702,16 +705,15 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetCSRCs(
}
it++;
}
return 0;
} else {
for (int i = 0; i < arrLength; i++) {
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "\tidx:%d CSRC:%u", i,
arrOfCSRC[i]);
}
_rtcpSender.SetCSRCs(arrOfCSRC, arrLength);
return _rtpSender.SetCSRCs(arrOfCSRC, arrLength);
_rtpSender.SetCSRCs(arrOfCSRC, arrLength);
}
return 0; // TODO(pwestin): change to void.
}
WebRtc_UWord32 ModuleRtpRtcpImpl::PacketCountSent() const {
@ -1129,7 +1131,8 @@ WebRtc_Word32 ModuleRtpRtcpImpl::ResetSendDataCountersRTP() {
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
"ResetSendDataCountersRTP()");
return _rtpSender.ResetDataCounters();
_rtpSender.ResetDataCounters();
return 0; // TODO(pwestin): change to void.
}
// Force a send of an RTCP packet
@ -1495,7 +1498,8 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetStorePacketsStatus(
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
"SetStorePacketsStatus(disable)");
}
return _rtpSender.SetStorePacketsStatus(enable, numberToStore);
_rtpSender.SetStorePacketsStatus(enable, numberToStore);
return 0; // TODO(pwestin): change to void.
}
/*

File diff suppressed because it is too large Load Diff

View File

@ -15,9 +15,9 @@
#include <cmath>
#include <map>
#include "rtp_rtcp_config.h" // misc. defines (e.g. MAX_PACKET_LENGTH)
#include "rtp_rtcp_config.h" // misc. defines (e.g. MAX_PACKET_LENGTH)
#include "rtp_rtcp_defines.h"
#include "common_types.h" // Encryption
#include "common_types.h"
#include "ssrc_database.h"
#include "Bitrate.h"
#include "rtp_header_extension.h"
@ -32,323 +32,315 @@ class RTPPacketHistory;
class RTPSenderAudio;
class RTPSenderVideo;
class RTPSenderInterface
{
public:
RTPSenderInterface() {}
virtual ~RTPSenderInterface() {}
class RTPSenderInterface {
public:
RTPSenderInterface() {}
virtual ~RTPSenderInterface() {}
virtual WebRtc_UWord32 SSRC() const = 0;
virtual WebRtc_UWord32 Timestamp() const = 0;
virtual WebRtc_UWord32 SSRC() const = 0;
virtual WebRtc_UWord32 Timestamp() const = 0;
virtual WebRtc_Word32 BuildRTPheader(WebRtc_UWord8* dataBuffer,
virtual WebRtc_Word32 BuildRTPheader(WebRtc_UWord8* dataBuffer,
const WebRtc_Word8 payloadType,
const bool markerBit,
const WebRtc_UWord32 captureTimeStamp,
const bool timeStampProvided = true,
const bool incSequenceNumber = true) = 0;
virtual WebRtc_UWord16 RTPHeaderLength() const = 0;
virtual WebRtc_UWord16 IncrementSequenceNumber() = 0;
virtual WebRtc_UWord16 SequenceNumber() const = 0;
virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
virtual WebRtc_UWord16 PacketOverHead() const = 0;
virtual WebRtc_UWord16 ActualSendBitrateKbit() const = 0;
virtual WebRtc_UWord16 RTPHeaderLength() const = 0;
virtual WebRtc_UWord16 IncrementSequenceNumber() = 0;
virtual WebRtc_UWord16 SequenceNumber() const = 0;
virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
virtual WebRtc_UWord16 PacketOverHead() const = 0;
virtual WebRtc_UWord16 ActualSendBitrateKbit() const = 0;
virtual WebRtc_Word32 SendToNetwork(WebRtc_UWord8* data_buffer,
const WebRtc_UWord16 payload_length,
const WebRtc_UWord16 rtp_header_length,
int64_t capture_time_ms,
const StorageType storage) = 0;
virtual WebRtc_Word32 SendToNetwork(WebRtc_UWord8* data_buffer,
WebRtc_UWord16 payload_length,
WebRtc_UWord16 rtp_header_length,
int64_t capture_time_ms,
StorageType storage) = 0;
};
class RTPSender : public Bitrate, public RTPSenderInterface
{
public:
RTPSender(const WebRtc_Word32 id, const bool audio, RtpRtcpClock* clock);
virtual ~RTPSender();
class RTPSender : public Bitrate, public RTPSenderInterface {
public:
RTPSender(const WebRtc_Word32 id, const bool audio, RtpRtcpClock* clock,
Transport* transport, RtpAudioFeedback* audio_feedback);
virtual ~RTPSender();
void ProcessBitrate();
void ProcessSendToNetwork();
void ProcessBitrate();
void ProcessSendToNetwork();
WebRtc_UWord16 ActualSendBitrateKbit() const;
WebRtc_UWord16 ActualSendBitrateKbit() const;
WebRtc_UWord32 VideoBitrateSent() const;
WebRtc_UWord32 FecOverheadRate() const;
WebRtc_UWord32 NackOverheadRate() const;
WebRtc_UWord32 VideoBitrateSent() const;
WebRtc_UWord32 FecOverheadRate() const;
WebRtc_UWord32 NackOverheadRate() const;
void SetTargetSendBitrate(const WebRtc_UWord32 bits);
void SetTargetSendBitrate(const WebRtc_UWord32 bits);
WebRtc_UWord16 MaxDataPayloadLength() const; // with RTP and FEC headers
WebRtc_UWord16 MaxDataPayloadLength() const; // with RTP and FEC headers
// callback
WebRtc_Word32 RegisterSendTransport(Transport* outgoingTransport);
WebRtc_Word32 RegisterPayload(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate);
WebRtc_Word32 RegisterPayload(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate);
WebRtc_Word32 DeRegisterSendPayload(const WebRtc_Word8 payloadType);
WebRtc_Word32 DeRegisterSendPayload(const WebRtc_Word8 payloadType);
WebRtc_Word8 SendPayloadType() const;
WebRtc_Word8 SendPayloadType() const;
int SendPayloadFrequency() const;
int SendPayloadFrequency() const;
void SetSendingStatus(const bool enabled);
void SetSendingStatus(const bool enabled);
void SetSendingMediaStatus(const bool enabled);
bool SendingMedia() const;
void SetSendingMediaStatus(const bool enabled);
bool SendingMedia() const;
// number of sent RTP packets
WebRtc_UWord32 Packets() const;
// number of sent RTP packets
WebRtc_UWord32 Packets() const;
// number of sent RTP bytes
WebRtc_UWord32 Bytes() const;
// number of sent RTP bytes
WebRtc_UWord32 Bytes() const;
void ResetDataCounters();
WebRtc_Word32 ResetDataCounters();
WebRtc_UWord32 StartTimestamp() const;
void SetStartTimestamp(WebRtc_UWord32 timestamp, bool force);
WebRtc_UWord32 StartTimestamp() const;
WebRtc_Word32 SetStartTimestamp(const WebRtc_UWord32 timestamp,
const bool force = false);
WebRtc_UWord32 GenerateNewSSRC();
void SetSSRC(const WebRtc_UWord32 ssrc);
WebRtc_UWord32 GenerateNewSSRC();
WebRtc_Word32 SetSSRC( const WebRtc_UWord32 ssrc);
WebRtc_UWord16 SequenceNumber() const;
void SetSequenceNumber(WebRtc_UWord16 seq);
WebRtc_UWord16 SequenceNumber() const;
WebRtc_Word32 SetSequenceNumber( WebRtc_UWord16 seq);
WebRtc_Word32 CSRCs(WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const;
WebRtc_Word32 CSRCs(WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const;
void SetCSRCStatus(const bool include);
WebRtc_Word32 SetCSRCStatus(const bool include);
void SetCSRCs(const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
const WebRtc_UWord8 arrLength);
WebRtc_Word32 SetCSRCs(const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
const WebRtc_UWord8 arrLength);
WebRtc_Word32 SetMaxPayloadLength(const WebRtc_UWord16 length,
const WebRtc_UWord16 packetOverHead);
WebRtc_Word32 SetMaxPayloadLength(const WebRtc_UWord16 length,
const WebRtc_UWord16 packetOverHead);
WebRtc_Word32 SendOutgoingData(const FrameType frameType,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 timeStamp,
int64_t capture_time_ms,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
const RTPFragmentationHeader* fragmentation,
VideoCodecInformation* codecInfo = NULL,
const RTPVideoTypeHeader* rtpTypeHdr = NULL);
WebRtc_Word32 SendOutgoingData(const FrameType frameType,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 timeStamp,
int64_t capture_time_ms,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
const RTPFragmentationHeader* fragmentation,
VideoCodecInformation* codecInfo = NULL,
const RTPVideoTypeHeader* rtpTypeHdr = NULL);
WebRtc_Word32 SendPadData(WebRtc_Word8 payload_type,
WebRtc_UWord32 capture_timestamp,
int64_t capture_time_ms,
WebRtc_Word32 bytes);
/*
* RTP header extension
*/
WebRtc_Word32 SetTransmissionTimeOffset(
const WebRtc_Word32 transmissionTimeOffset);
WebRtc_Word32 SendPadData(WebRtc_Word8 payload_type,
WebRtc_UWord32 capture_timestamp,
int64_t capture_time_ms,
WebRtc_Word32 bytes);
/*
* RTP header extension
*/
WebRtc_Word32 SetTransmissionTimeOffset(
const WebRtc_Word32 transmissionTimeOffset);
WebRtc_Word32 RegisterRtpHeaderExtension(const RTPExtensionType type,
const WebRtc_UWord8 id);
WebRtc_Word32 RegisterRtpHeaderExtension(const RTPExtensionType type,
const WebRtc_UWord8 id);
WebRtc_Word32 DeregisterRtpHeaderExtension(const RTPExtensionType type);
WebRtc_Word32 DeregisterRtpHeaderExtension(const RTPExtensionType type);
WebRtc_UWord16 RtpHeaderExtensionTotalLength() const;
WebRtc_UWord16 RtpHeaderExtensionTotalLength() const;
WebRtc_UWord16 BuildRTPHeaderExtension(WebRtc_UWord8* dataBuffer) const;
WebRtc_UWord16 BuildRTPHeaderExtension(WebRtc_UWord8* dataBuffer) const;
WebRtc_UWord8 BuildTransmissionTimeOffsetExtension(
WebRtc_UWord8* dataBuffer) const;
WebRtc_UWord8 BuildTransmissionTimeOffsetExtension(
WebRtc_UWord8* dataBuffer) const;
bool UpdateTransmissionTimeOffset(WebRtc_UWord8* rtp_packet,
const WebRtc_UWord16 rtp_packet_length,
const WebRtcRTPHeader& rtp_header,
const WebRtc_Word64 time_diff_ms) const;
bool UpdateTransmissionTimeOffset(WebRtc_UWord8* rtp_packet,
const WebRtc_UWord16 rtp_packet_length,
const WebRtcRTPHeader& rtp_header,
const WebRtc_Word64 time_diff_ms) const;
void SetTransmissionSmoothingStatus(const bool enable);
void SetTransmissionSmoothingStatus(const bool enable);
bool TransmissionSmoothingStatus() const;
bool TransmissionSmoothingStatus() const;
/*
/*
* NACK
*/
int SelectiveRetransmissions() const;
int SetSelectiveRetransmissions(uint8_t settings);
void OnReceivedNACK(const WebRtc_UWord16 nackSequenceNumbersLength,
const WebRtc_UWord16* nackSequenceNumbers,
const WebRtc_UWord16 avgRTT);
int SelectiveRetransmissions() const;
int SetSelectiveRetransmissions(uint8_t settings);
void OnReceivedNACK(const WebRtc_UWord16 nackSequenceNumbersLength,
const WebRtc_UWord16* nackSequenceNumbers,
const WebRtc_UWord16 avgRTT);
WebRtc_Word32 SetStorePacketsStatus(const bool enable,
const WebRtc_UWord16 numberToStore);
void SetStorePacketsStatus(const bool enable,
const WebRtc_UWord16 numberToStore);
bool StorePackets() const;
bool StorePackets() const;
WebRtc_Word32 ReSendPacket(WebRtc_UWord16 packet_id,
WebRtc_UWord32 min_resend_time = 0);
WebRtc_Word32 ReSendPacket(WebRtc_UWord16 packet_id,
WebRtc_UWord32 min_resend_time = 0);
WebRtc_Word32 ReSendToNetwork(const WebRtc_UWord8* packet,
const WebRtc_UWord32 size);
WebRtc_Word32 ReSendToNetwork(const WebRtc_UWord8* packet,
const WebRtc_UWord32 size);
bool ProcessNACKBitRate(const WebRtc_UWord32 now);
bool ProcessNACKBitRate(const WebRtc_UWord32 now);
/*
/*
* RTX
*/
void SetRTXStatus(const bool enable,
const bool setSSRC,
const WebRtc_UWord32 SSRC);
void SetRTXStatus(const bool enable,
const bool setSSRC,
const WebRtc_UWord32 SSRC);
void RTXStatus(bool* enable, WebRtc_UWord32* SSRC) const;
void RTXStatus(bool* enable, WebRtc_UWord32* SSRC) const;
/*
/*
* Functions wrapping RTPSenderInterface
*/
virtual WebRtc_Word32 BuildRTPheader(WebRtc_UWord8* dataBuffer,
const WebRtc_Word8 payloadType,
const bool markerBit,
const WebRtc_UWord32 captureTimeStamp,
const bool timeStampProvided = true,
const bool incSequenceNumber = true);
virtual WebRtc_Word32 BuildRTPheader(WebRtc_UWord8* dataBuffer,
const WebRtc_Word8 payloadType,
const bool markerBit,
const WebRtc_UWord32 captureTimeStamp,
const bool timeStampProvided = true,
const bool incSequenceNumber = true);
virtual WebRtc_UWord16 RTPHeaderLength() const ;
virtual WebRtc_UWord16 IncrementSequenceNumber();
virtual WebRtc_UWord16 MaxPayloadLength() const;
virtual WebRtc_UWord16 PacketOverHead() const;
virtual WebRtc_UWord16 RTPHeaderLength() const ;
virtual WebRtc_UWord16 IncrementSequenceNumber();
virtual WebRtc_UWord16 MaxPayloadLength() const;
virtual WebRtc_UWord16 PacketOverHead() const;
// current timestamp
virtual WebRtc_UWord32 Timestamp() const;
virtual WebRtc_UWord32 SSRC() const;
// current timestamp
virtual WebRtc_UWord32 Timestamp() const;
virtual WebRtc_UWord32 SSRC() const;
virtual WebRtc_Word32 SendToNetwork(WebRtc_UWord8* data_buffer,
const WebRtc_UWord16 payload_length,
const WebRtc_UWord16 rtp_header_length,
int64_t capture_time_ms,
const StorageType storage);
/*
virtual WebRtc_Word32 SendToNetwork(WebRtc_UWord8* data_buffer,
WebRtc_UWord16 payload_length,
WebRtc_UWord16 rtp_header_length,
int64_t capture_time_ms,
StorageType storage);
/*
* Audio
*/
WebRtc_Word32 RegisterAudioCallback(RtpAudioFeedback* messagesCallback);
// Send a DTMF tone using RFC 2833 (4733)
WebRtc_Word32 SendTelephoneEvent(const WebRtc_UWord8 key,
const WebRtc_UWord16 time_ms,
const WebRtc_UWord8 level);
// Send a DTMF tone using RFC 2833 (4733)
WebRtc_Word32 SendTelephoneEvent(const WebRtc_UWord8 key,
const WebRtc_UWord16 time_ms,
const WebRtc_UWord8 level);
bool SendTelephoneEventActive(WebRtc_Word8& telephoneEvent) const;
bool SendTelephoneEventActive(WebRtc_Word8& telephoneEvent) const;
// Set audio packet size, used to determine when it's time to send a DTMF
// packet in silence (CNG)
WebRtc_Word32 SetAudioPacketSize(const WebRtc_UWord16 packetSizeSamples);
// set audio packet size, used to determine when it's time to send a DTMF packet in silence (CNG)
WebRtc_Word32 SetAudioPacketSize(const WebRtc_UWord16 packetSizeSamples);
// Set status and ID for header-extension-for-audio-level-indication.
WebRtc_Word32 SetAudioLevelIndicationStatus(const bool enable,
const WebRtc_UWord8 ID);
// Set status and ID for header-extension-for-audio-level-indication.
WebRtc_Word32 SetAudioLevelIndicationStatus(const bool enable,
const WebRtc_UWord8 ID);
// Get status and ID for header-extension-for-audio-level-indication.
WebRtc_Word32 AudioLevelIndicationStatus(bool& enable,
WebRtc_UWord8& ID) const;
// Get status and ID for header-extension-for-audio-level-indication.
WebRtc_Word32 AudioLevelIndicationStatus(bool& enable,
WebRtc_UWord8& ID) const;
// Store the audio level in dBov for
// header-extension-for-audio-level-indication.
WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov);
// Store the audio level in dBov for header-extension-for-audio-level-indication.
WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov);
// Set payload type for Redundant Audio Data RFC 2198
WebRtc_Word32 SetRED(const WebRtc_Word8 payloadType);
// Set payload type for Redundant Audio Data RFC 2198
WebRtc_Word32 SetRED(const WebRtc_Word8 payloadType);
// Get payload type for Redundant Audio Data RFC 2198
WebRtc_Word32 RED(WebRtc_Word8& payloadType) const;
// Get payload type for Redundant Audio Data RFC 2198
WebRtc_Word32 RED(WebRtc_Word8& payloadType) const;
/*
/*
* Video
*/
VideoCodecInformation* CodecInformationVideo();
VideoCodecInformation* CodecInformationVideo();
RtpVideoCodecTypes VideoCodecType() const;
RtpVideoCodecTypes VideoCodecType() const;
WebRtc_UWord32 MaxConfiguredBitrateVideo() const;
WebRtc_UWord32 MaxConfiguredBitrateVideo() const;
WebRtc_Word32 SendRTPIntraRequest();
WebRtc_Word32 SendRTPIntraRequest();
// FEC
WebRtc_Word32 SetGenericFECStatus(const bool enable,
const WebRtc_UWord8 payloadTypeRED,
const WebRtc_UWord8 payloadTypeFEC);
// FEC
WebRtc_Word32 SetGenericFECStatus(const bool enable,
const WebRtc_UWord8 payloadTypeRED,
const WebRtc_UWord8 payloadTypeFEC);
WebRtc_Word32 GenericFECStatus(bool& enable,
WebRtc_UWord8& payloadTypeRED,
WebRtc_UWord8& payloadTypeFEC) const;
WebRtc_Word32 GenericFECStatus(bool& enable,
WebRtc_UWord8& payloadTypeRED,
WebRtc_UWord8& payloadTypeFEC) const;
WebRtc_Word32 SetFecParameters(
const FecProtectionParams* delta_params,
const FecProtectionParams* key_params);
WebRtc_Word32 SetFecParameters(
const FecProtectionParams* delta_params,
const FecProtectionParams* key_params);
protected:
WebRtc_Word32 CheckPayloadType(const WebRtc_Word8 payloadType,
RtpVideoCodecTypes& videoType);
protected:
WebRtc_Word32 CheckPayloadType(const WebRtc_Word8 payloadType,
RtpVideoCodecTypes& videoType);
private:
void UpdateNACKBitRate(const WebRtc_UWord32 bytes,
const WebRtc_UWord32 now);
private:
void UpdateNACKBitRate(const WebRtc_UWord32 bytes,
const WebRtc_UWord32 now);
WebRtc_Word32 SendPaddingAccordingToBitrate(
WebRtc_Word8 payload_type,
WebRtc_UWord32 capture_timestamp,
int64_t capture_time_ms);
WebRtc_Word32 SendPaddingAccordingToBitrate(
WebRtc_Word8 payload_type,
WebRtc_UWord32 capture_timestamp,
int64_t capture_time_ms);
WebRtc_Word32 _id;
const bool _audioConfigured;
RTPSenderAudio* _audio;
RTPSenderVideo* _video;
WebRtc_Word32 _id;
const bool _audioConfigured;
RTPSenderAudio* _audio;
RTPSenderVideo* _video;
CriticalSectionWrapper* _sendCritsect;
CriticalSectionWrapper* _sendCritsect;
CriticalSectionWrapper* _transportCritsect;
Transport* _transport;
Transport* _transport;
bool _sendingMedia;
bool _sendingMedia;
WebRtc_UWord16 _maxPayloadLength;
WebRtc_UWord16 _targetSendBitrate;
WebRtc_UWord16 _packetOverHead;
WebRtc_UWord16 _maxPayloadLength;
WebRtc_UWord16 _targetSendBitrate;
WebRtc_UWord16 _packetOverHead;
WebRtc_Word8 _payloadType;
std::map<WebRtc_Word8, ModuleRTPUtility::Payload*> _payloadTypeMap;
WebRtc_Word8 _payloadType;
std::map<WebRtc_Word8, ModuleRTPUtility::Payload*> _payloadTypeMap;
RtpHeaderExtensionMap _rtpHeaderExtensionMap;
WebRtc_Word32 _transmissionTimeOffset;
RtpHeaderExtensionMap _rtpHeaderExtensionMap;
WebRtc_Word32 _transmissionTimeOffset;
// NACK
WebRtc_UWord32 _nackByteCountTimes[NACK_BYTECOUNT_SIZE];
WebRtc_Word32 _nackByteCount[NACK_BYTECOUNT_SIZE];
Bitrate _nackBitrate;
// NACK
WebRtc_UWord32 _nackByteCountTimes[NACK_BYTECOUNT_SIZE];
WebRtc_Word32 _nackByteCount[NACK_BYTECOUNT_SIZE];
Bitrate _nackBitrate;
RTPPacketHistory* _packetHistory;
TransmissionBucket _sendBucket;
WebRtc_Word64 _timeLastSendToNetworkUpdate;
bool _transmissionSmoothing;
RTPPacketHistory* _packetHistory;
TransmissionBucket _sendBucket;
WebRtc_Word64 _timeLastSendToNetworkUpdate;
bool _transmissionSmoothing;
// Statistics
WebRtc_UWord32 _packetsSent;
WebRtc_UWord32 _payloadBytesSent;
// statistics
WebRtc_UWord32 _packetsSent;
WebRtc_UWord32 _payloadBytesSent;
// RTP variables
bool _startTimeStampForced;
WebRtc_UWord32 _startTimeStamp;
SSRCDatabase& _ssrcDB;
WebRtc_UWord32 _remoteSSRC;
bool _sequenceNumberForced;
WebRtc_UWord16 _sequenceNumber;
WebRtc_UWord16 _sequenceNumberRTX;
bool _ssrcForced;
WebRtc_UWord32 _ssrc;
WebRtc_UWord32 _timeStamp;
WebRtc_UWord8 _CSRCs;
WebRtc_UWord32 _CSRC[kRtpCsrcSize];
bool _includeCSRCs;
bool _RTX;
WebRtc_UWord32 _ssrcRTX;
// RTP variables
bool _startTimeStampForced;
WebRtc_UWord32 _startTimeStamp;
SSRCDatabase& _ssrcDB;
WebRtc_UWord32 _remoteSSRC;
bool _sequenceNumberForced;
WebRtc_UWord16 _sequenceNumber;
WebRtc_UWord16 _sequenceNumberRTX;
bool _ssrcForced;
WebRtc_UWord32 _ssrc;
WebRtc_UWord32 _timeStamp;
WebRtc_UWord8 _CSRCs;
WebRtc_UWord32 _CSRC[kRtpCsrcSize];
bool _includeCSRCs;
bool _RTX;
WebRtc_UWord32 _ssrcRTX;
};
} // namespace webrtc

View File

@ -78,12 +78,11 @@ class RtpSenderTest : public ::testing::Test {
protected:
RtpSenderTest()
: fake_clock_(),
rtp_sender_(new RTPSender(0, false, &fake_clock_)),
transport_(),
rtp_sender_(new RTPSender(0, false, &fake_clock_, &transport_, NULL)),
kMarkerBit(true),
kType(kRtpExtensionTransmissionTimeOffset),
packet_() {
EXPECT_EQ(0, rtp_sender_->SetSequenceNumber(kSeqNum));
rtp_sender_->SetSequenceNumber(kSeqNum);
}
~RtpSenderTest() {
delete rtp_sender_;
@ -199,8 +198,6 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithNegativeTransmissionOffsetExtension) {
}
TEST_F(RtpSenderTest, NoTrafficSmoothing) {
EXPECT_EQ(0, rtp_sender_->RegisterSendTransport(&transport_));
WebRtc_Word32 rtp_length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
@ -218,9 +215,8 @@ TEST_F(RtpSenderTest, NoTrafficSmoothing) {
TEST_F(RtpSenderTest, TrafficSmoothing) {
rtp_sender_->SetTransmissionSmoothingStatus(true);
EXPECT_EQ(0, rtp_sender_->SetStorePacketsStatus(true, 10));
rtp_sender_->SetStorePacketsStatus(true, 10);
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kType, kId));
EXPECT_EQ(0, rtp_sender_->RegisterSendTransport(&transport_));
rtp_sender_->SetTargetSendBitrate(300000);
WebRtc_Word32 rtp_length = rtp_sender_->BuildRTPheader(packet_,