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:
parent
4cebe6cded
commit
c66e8b3f31
@ -52,7 +52,11 @@ RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const 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,
|
_rtpReceiver(configuration.id, configuration.audio, configuration.clock,
|
||||||
this),
|
this),
|
||||||
_rtcpSender(configuration.id, configuration.audio, configuration.clock,
|
_rtcpSender(configuration.id, configuration.audio, configuration.clock,
|
||||||
@ -97,10 +101,8 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
|
|||||||
_rtcpReceiver.RegisterRtcpObservers(configuration.intra_frame_callback,
|
_rtcpReceiver.RegisterRtcpObservers(configuration.intra_frame_callback,
|
||||||
configuration.bandwidth_callback,
|
configuration.bandwidth_callback,
|
||||||
configuration.rtcp_feedback);
|
configuration.rtcp_feedback);
|
||||||
_rtpSender.RegisterAudioCallback(configuration.audio_messages);
|
|
||||||
_rtpReceiver.RegisterIncomingAudioCallback(configuration.audio_messages);
|
_rtpReceiver.RegisterIncomingAudioCallback(configuration.audio_messages);
|
||||||
|
|
||||||
_rtpSender.RegisterSendTransport(configuration.outgoing_transport);
|
|
||||||
_rtcpSender.RegisterSendTransport(configuration.outgoing_transport);
|
_rtcpSender.RegisterSendTransport(configuration.outgoing_transport);
|
||||||
|
|
||||||
// make sure that RTCP objects are aware of our SSRC
|
// make sure that RTCP objects are aware of our SSRC
|
||||||
@ -628,7 +630,8 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetStartTimestamp(
|
|||||||
"SetStartTimestamp(%d)",
|
"SetStartTimestamp(%d)",
|
||||||
timestamp);
|
timestamp);
|
||||||
_rtcpSender.SetStartTimestamp(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 {
|
WebRtc_UWord16 ModuleRtpRtcpImpl::SequenceNumber() const {
|
||||||
@ -646,7 +649,8 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetSequenceNumber(
|
|||||||
"SetSequenceNumber(%d)",
|
"SetSequenceNumber(%d)",
|
||||||
seqNum);
|
seqNum);
|
||||||
|
|
||||||
return _rtpSender.SetSequenceNumber(seqNum);
|
_rtpSender.SetSequenceNumber(seqNum);
|
||||||
|
return 0; // TODO(pwestin): change to void.
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_UWord32 ModuleRtpRtcpImpl::SSRC() const {
|
WebRtc_UWord32 ModuleRtpRtcpImpl::SSRC() const {
|
||||||
@ -659,17 +663,16 @@ WebRtc_UWord32 ModuleRtpRtcpImpl::SSRC() const {
|
|||||||
WebRtc_Word32 ModuleRtpRtcpImpl::SetSSRC(const WebRtc_UWord32 ssrc) {
|
WebRtc_Word32 ModuleRtpRtcpImpl::SetSSRC(const WebRtc_UWord32 ssrc) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SetSSRC(%d)", ssrc);
|
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SetSSRC(%d)", ssrc);
|
||||||
|
|
||||||
if (_rtpSender.SetSSRC(ssrc) == 0) {
|
_rtpSender.SetSSRC(ssrc);
|
||||||
_rtcpReceiver.SetSSRC(ssrc);
|
_rtcpReceiver.SetSSRC(ssrc);
|
||||||
_rtcpSender.SetSSRC(ssrc);
|
_rtcpSender.SetSSRC(ssrc);
|
||||||
return 0;
|
return 0; // TODO(pwestin): change to void.
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 ModuleRtpRtcpImpl::SetCSRCStatus(const bool include) {
|
WebRtc_Word32 ModuleRtpRtcpImpl::SetCSRCStatus(const bool include) {
|
||||||
_rtcpSender.SetCSRCStatus(include);
|
_rtcpSender.SetCSRCStatus(include);
|
||||||
return _rtpSender.SetCSRCStatus(include);
|
_rtpSender.SetCSRCStatus(include);
|
||||||
|
return 0; // TODO(pwestin): change to void.
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 ModuleRtpRtcpImpl::CSRCs(
|
WebRtc_Word32 ModuleRtpRtcpImpl::CSRCs(
|
||||||
@ -702,16 +705,15 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetCSRCs(
|
|||||||
}
|
}
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < arrLength; i++) {
|
for (int i = 0; i < arrLength; i++) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "\tidx:%d CSRC:%u", i,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "\tidx:%d CSRC:%u", i,
|
||||||
arrOfCSRC[i]);
|
arrOfCSRC[i]);
|
||||||
}
|
}
|
||||||
_rtcpSender.SetCSRCs(arrOfCSRC, arrLength);
|
_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 {
|
WebRtc_UWord32 ModuleRtpRtcpImpl::PacketCountSent() const {
|
||||||
@ -1129,7 +1131,8 @@ WebRtc_Word32 ModuleRtpRtcpImpl::ResetSendDataCountersRTP() {
|
|||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
|
||||||
"ResetSendDataCountersRTP()");
|
"ResetSendDataCountersRTP()");
|
||||||
|
|
||||||
return _rtpSender.ResetDataCounters();
|
_rtpSender.ResetDataCounters();
|
||||||
|
return 0; // TODO(pwestin): change to void.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force a send of an RTCP packet
|
// Force a send of an RTCP packet
|
||||||
@ -1495,7 +1498,8 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetStorePacketsStatus(
|
|||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
|
||||||
"SetStorePacketsStatus(disable)");
|
"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
@ -15,9 +15,9 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <map>
|
#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 "rtp_rtcp_defines.h"
|
||||||
#include "common_types.h" // Encryption
|
#include "common_types.h"
|
||||||
#include "ssrc_database.h"
|
#include "ssrc_database.h"
|
||||||
#include "Bitrate.h"
|
#include "Bitrate.h"
|
||||||
#include "rtp_header_extension.h"
|
#include "rtp_header_extension.h"
|
||||||
@ -32,323 +32,315 @@ class RTPPacketHistory;
|
|||||||
class RTPSenderAudio;
|
class RTPSenderAudio;
|
||||||
class RTPSenderVideo;
|
class RTPSenderVideo;
|
||||||
|
|
||||||
class RTPSenderInterface
|
class RTPSenderInterface {
|
||||||
{
|
public:
|
||||||
public:
|
RTPSenderInterface() {}
|
||||||
RTPSenderInterface() {}
|
virtual ~RTPSenderInterface() {}
|
||||||
virtual ~RTPSenderInterface() {}
|
|
||||||
|
|
||||||
virtual WebRtc_UWord32 SSRC() const = 0;
|
virtual WebRtc_UWord32 SSRC() const = 0;
|
||||||
virtual WebRtc_UWord32 Timestamp() 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 WebRtc_Word8 payloadType,
|
||||||
const bool markerBit,
|
const bool markerBit,
|
||||||
const WebRtc_UWord32 captureTimeStamp,
|
const WebRtc_UWord32 captureTimeStamp,
|
||||||
const bool timeStampProvided = true,
|
const bool timeStampProvided = true,
|
||||||
const bool incSequenceNumber = true) = 0;
|
const bool incSequenceNumber = true) = 0;
|
||||||
|
|
||||||
virtual WebRtc_UWord16 RTPHeaderLength() const = 0;
|
virtual WebRtc_UWord16 RTPHeaderLength() const = 0;
|
||||||
virtual WebRtc_UWord16 IncrementSequenceNumber() = 0;
|
virtual WebRtc_UWord16 IncrementSequenceNumber() = 0;
|
||||||
virtual WebRtc_UWord16 SequenceNumber() const = 0;
|
virtual WebRtc_UWord16 SequenceNumber() const = 0;
|
||||||
virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
|
virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
|
||||||
virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
|
virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
|
||||||
virtual WebRtc_UWord16 PacketOverHead() const = 0;
|
virtual WebRtc_UWord16 PacketOverHead() const = 0;
|
||||||
virtual WebRtc_UWord16 ActualSendBitrateKbit() const = 0;
|
virtual WebRtc_UWord16 ActualSendBitrateKbit() const = 0;
|
||||||
|
|
||||||
virtual WebRtc_Word32 SendToNetwork(WebRtc_UWord8* data_buffer,
|
virtual WebRtc_Word32 SendToNetwork(WebRtc_UWord8* data_buffer,
|
||||||
const WebRtc_UWord16 payload_length,
|
WebRtc_UWord16 payload_length,
|
||||||
const WebRtc_UWord16 rtp_header_length,
|
WebRtc_UWord16 rtp_header_length,
|
||||||
int64_t capture_time_ms,
|
int64_t capture_time_ms,
|
||||||
const StorageType storage) = 0;
|
StorageType storage) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RTPSender : public Bitrate, public RTPSenderInterface
|
class RTPSender : public Bitrate, public RTPSenderInterface {
|
||||||
{
|
public:
|
||||||
public:
|
RTPSender(const WebRtc_Word32 id, const bool audio, RtpRtcpClock* clock,
|
||||||
RTPSender(const WebRtc_Word32 id, const bool audio, RtpRtcpClock* clock);
|
Transport* transport, RtpAudioFeedback* audio_feedback);
|
||||||
virtual ~RTPSender();
|
virtual ~RTPSender();
|
||||||
|
|
||||||
void ProcessBitrate();
|
void ProcessBitrate();
|
||||||
void ProcessSendToNetwork();
|
void ProcessSendToNetwork();
|
||||||
|
|
||||||
WebRtc_UWord16 ActualSendBitrateKbit() const;
|
WebRtc_UWord16 ActualSendBitrateKbit() const;
|
||||||
|
|
||||||
WebRtc_UWord32 VideoBitrateSent() const;
|
WebRtc_UWord32 VideoBitrateSent() const;
|
||||||
WebRtc_UWord32 FecOverheadRate() const;
|
WebRtc_UWord32 FecOverheadRate() const;
|
||||||
WebRtc_UWord32 NackOverheadRate() 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 RegisterPayload(
|
||||||
WebRtc_Word32 RegisterSendTransport(Transport* outgoingTransport);
|
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(
|
WebRtc_Word32 DeRegisterSendPayload(const WebRtc_Word8 payloadType);
|
||||||
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_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);
|
// number of sent RTP packets
|
||||||
bool SendingMedia() const;
|
WebRtc_UWord32 Packets() const;
|
||||||
|
|
||||||
// number of sent RTP packets
|
// number of sent RTP bytes
|
||||||
WebRtc_UWord32 Packets() const;
|
WebRtc_UWord32 Bytes() const;
|
||||||
|
|
||||||
// number of sent RTP bytes
|
void ResetDataCounters();
|
||||||
WebRtc_UWord32 Bytes() const;
|
|
||||||
|
|
||||||
WebRtc_Word32 ResetDataCounters();
|
WebRtc_UWord32 StartTimestamp() const;
|
||||||
|
void SetStartTimestamp(WebRtc_UWord32 timestamp, bool force);
|
||||||
|
|
||||||
WebRtc_UWord32 StartTimestamp() const;
|
WebRtc_UWord32 GenerateNewSSRC();
|
||||||
WebRtc_Word32 SetStartTimestamp(const WebRtc_UWord32 timestamp,
|
void SetSSRC(const WebRtc_UWord32 ssrc);
|
||||||
const bool force = false);
|
|
||||||
|
|
||||||
WebRtc_UWord32 GenerateNewSSRC();
|
WebRtc_UWord16 SequenceNumber() const;
|
||||||
WebRtc_Word32 SetSSRC( const WebRtc_UWord32 ssrc);
|
void SetSequenceNumber(WebRtc_UWord16 seq);
|
||||||
|
|
||||||
WebRtc_UWord16 SequenceNumber() const;
|
WebRtc_Word32 CSRCs(WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const;
|
||||||
WebRtc_Word32 SetSequenceNumber( WebRtc_UWord16 seq);
|
|
||||||
|
|
||||||
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],
|
WebRtc_Word32 SetMaxPayloadLength(const WebRtc_UWord16 length,
|
||||||
const WebRtc_UWord8 arrLength);
|
const WebRtc_UWord16 packetOverHead);
|
||||||
|
|
||||||
WebRtc_Word32 SetMaxPayloadLength(const WebRtc_UWord16 length,
|
WebRtc_Word32 SendOutgoingData(const FrameType frameType,
|
||||||
const WebRtc_UWord16 packetOverHead);
|
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,
|
WebRtc_Word32 SendPadData(WebRtc_Word8 payload_type,
|
||||||
const WebRtc_Word8 payloadType,
|
WebRtc_UWord32 capture_timestamp,
|
||||||
const WebRtc_UWord32 timeStamp,
|
int64_t capture_time_ms,
|
||||||
int64_t capture_time_ms,
|
WebRtc_Word32 bytes);
|
||||||
const WebRtc_UWord8* payloadData,
|
/*
|
||||||
const WebRtc_UWord32 payloadSize,
|
* RTP header extension
|
||||||
const RTPFragmentationHeader* fragmentation,
|
*/
|
||||||
VideoCodecInformation* codecInfo = NULL,
|
WebRtc_Word32 SetTransmissionTimeOffset(
|
||||||
const RTPVideoTypeHeader* rtpTypeHdr = NULL);
|
const WebRtc_Word32 transmissionTimeOffset);
|
||||||
|
|
||||||
WebRtc_Word32 SendPadData(WebRtc_Word8 payload_type,
|
WebRtc_Word32 RegisterRtpHeaderExtension(const RTPExtensionType type,
|
||||||
WebRtc_UWord32 capture_timestamp,
|
const WebRtc_UWord8 id);
|
||||||
int64_t capture_time_ms,
|
|
||||||
WebRtc_Word32 bytes);
|
|
||||||
/*
|
|
||||||
* RTP header extension
|
|
||||||
*/
|
|
||||||
WebRtc_Word32 SetTransmissionTimeOffset(
|
|
||||||
const WebRtc_Word32 transmissionTimeOffset);
|
|
||||||
|
|
||||||
WebRtc_Word32 RegisterRtpHeaderExtension(const RTPExtensionType type,
|
WebRtc_Word32 DeregisterRtpHeaderExtension(const RTPExtensionType type);
|
||||||
const WebRtc_UWord8 id);
|
|
||||||
|
|
||||||
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(
|
bool UpdateTransmissionTimeOffset(WebRtc_UWord8* rtp_packet,
|
||||||
WebRtc_UWord8* dataBuffer) const;
|
const WebRtc_UWord16 rtp_packet_length,
|
||||||
|
const WebRtcRTPHeader& rtp_header,
|
||||||
|
const WebRtc_Word64 time_diff_ms) const;
|
||||||
|
|
||||||
bool UpdateTransmissionTimeOffset(WebRtc_UWord8* rtp_packet,
|
void SetTransmissionSmoothingStatus(const bool enable);
|
||||||
const WebRtc_UWord16 rtp_packet_length,
|
|
||||||
const WebRtcRTPHeader& rtp_header,
|
|
||||||
const WebRtc_Word64 time_diff_ms) const;
|
|
||||||
|
|
||||||
void SetTransmissionSmoothingStatus(const bool enable);
|
bool TransmissionSmoothingStatus() const;
|
||||||
|
|
||||||
bool TransmissionSmoothingStatus() const;
|
/*
|
||||||
|
|
||||||
/*
|
|
||||||
* NACK
|
* NACK
|
||||||
*/
|
*/
|
||||||
int SelectiveRetransmissions() const;
|
int SelectiveRetransmissions() const;
|
||||||
int SetSelectiveRetransmissions(uint8_t settings);
|
int SetSelectiveRetransmissions(uint8_t settings);
|
||||||
void OnReceivedNACK(const WebRtc_UWord16 nackSequenceNumbersLength,
|
void OnReceivedNACK(const WebRtc_UWord16 nackSequenceNumbersLength,
|
||||||
const WebRtc_UWord16* nackSequenceNumbers,
|
const WebRtc_UWord16* nackSequenceNumbers,
|
||||||
const WebRtc_UWord16 avgRTT);
|
const WebRtc_UWord16 avgRTT);
|
||||||
|
|
||||||
WebRtc_Word32 SetStorePacketsStatus(const bool enable,
|
void SetStorePacketsStatus(const bool enable,
|
||||||
const WebRtc_UWord16 numberToStore);
|
const WebRtc_UWord16 numberToStore);
|
||||||
|
|
||||||
bool StorePackets() const;
|
bool StorePackets() const;
|
||||||
|
|
||||||
WebRtc_Word32 ReSendPacket(WebRtc_UWord16 packet_id,
|
WebRtc_Word32 ReSendPacket(WebRtc_UWord16 packet_id,
|
||||||
WebRtc_UWord32 min_resend_time = 0);
|
WebRtc_UWord32 min_resend_time = 0);
|
||||||
|
|
||||||
WebRtc_Word32 ReSendToNetwork(const WebRtc_UWord8* packet,
|
WebRtc_Word32 ReSendToNetwork(const WebRtc_UWord8* packet,
|
||||||
const WebRtc_UWord32 size);
|
const WebRtc_UWord32 size);
|
||||||
|
|
||||||
bool ProcessNACKBitRate(const WebRtc_UWord32 now);
|
bool ProcessNACKBitRate(const WebRtc_UWord32 now);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RTX
|
* RTX
|
||||||
*/
|
*/
|
||||||
void SetRTXStatus(const bool enable,
|
void SetRTXStatus(const bool enable,
|
||||||
const bool setSSRC,
|
const bool setSSRC,
|
||||||
const WebRtc_UWord32 SSRC);
|
const WebRtc_UWord32 SSRC);
|
||||||
|
|
||||||
void RTXStatus(bool* enable, WebRtc_UWord32* SSRC) const;
|
void RTXStatus(bool* enable, WebRtc_UWord32* SSRC) const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions wrapping RTPSenderInterface
|
* Functions wrapping RTPSenderInterface
|
||||||
*/
|
*/
|
||||||
virtual WebRtc_Word32 BuildRTPheader(WebRtc_UWord8* dataBuffer,
|
virtual WebRtc_Word32 BuildRTPheader(WebRtc_UWord8* dataBuffer,
|
||||||
const WebRtc_Word8 payloadType,
|
const WebRtc_Word8 payloadType,
|
||||||
const bool markerBit,
|
const bool markerBit,
|
||||||
const WebRtc_UWord32 captureTimeStamp,
|
const WebRtc_UWord32 captureTimeStamp,
|
||||||
const bool timeStampProvided = true,
|
const bool timeStampProvided = true,
|
||||||
const bool incSequenceNumber = true);
|
const bool incSequenceNumber = true);
|
||||||
|
|
||||||
virtual WebRtc_UWord16 RTPHeaderLength() const ;
|
virtual WebRtc_UWord16 RTPHeaderLength() const ;
|
||||||
virtual WebRtc_UWord16 IncrementSequenceNumber();
|
virtual WebRtc_UWord16 IncrementSequenceNumber();
|
||||||
virtual WebRtc_UWord16 MaxPayloadLength() const;
|
virtual WebRtc_UWord16 MaxPayloadLength() const;
|
||||||
virtual WebRtc_UWord16 PacketOverHead() const;
|
virtual WebRtc_UWord16 PacketOverHead() const;
|
||||||
|
|
||||||
// current timestamp
|
// current timestamp
|
||||||
virtual WebRtc_UWord32 Timestamp() const;
|
virtual WebRtc_UWord32 Timestamp() const;
|
||||||
virtual WebRtc_UWord32 SSRC() const;
|
virtual WebRtc_UWord32 SSRC() const;
|
||||||
|
|
||||||
virtual WebRtc_Word32 SendToNetwork(WebRtc_UWord8* data_buffer,
|
virtual WebRtc_Word32 SendToNetwork(WebRtc_UWord8* data_buffer,
|
||||||
const WebRtc_UWord16 payload_length,
|
WebRtc_UWord16 payload_length,
|
||||||
const WebRtc_UWord16 rtp_header_length,
|
WebRtc_UWord16 rtp_header_length,
|
||||||
int64_t capture_time_ms,
|
int64_t capture_time_ms,
|
||||||
const StorageType storage);
|
StorageType storage);
|
||||||
|
/*
|
||||||
/*
|
|
||||||
* Audio
|
* 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)
|
bool SendTelephoneEventActive(WebRtc_Word8& telephoneEvent) const;
|
||||||
WebRtc_Word32 SendTelephoneEvent(const WebRtc_UWord8 key,
|
|
||||||
const WebRtc_UWord16 time_ms,
|
|
||||||
const WebRtc_UWord8 level);
|
|
||||||
|
|
||||||
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)
|
// Set status and ID for header-extension-for-audio-level-indication.
|
||||||
WebRtc_Word32 SetAudioPacketSize(const WebRtc_UWord16 packetSizeSamples);
|
WebRtc_Word32 SetAudioLevelIndicationStatus(const bool enable,
|
||||||
|
const WebRtc_UWord8 ID);
|
||||||
|
|
||||||
// Set status and ID for header-extension-for-audio-level-indication.
|
// Get status and ID for header-extension-for-audio-level-indication.
|
||||||
WebRtc_Word32 SetAudioLevelIndicationStatus(const bool enable,
|
WebRtc_Word32 AudioLevelIndicationStatus(bool& enable,
|
||||||
const WebRtc_UWord8 ID);
|
WebRtc_UWord8& ID) const;
|
||||||
|
|
||||||
// Get status and ID for header-extension-for-audio-level-indication.
|
// Store the audio level in dBov for
|
||||||
WebRtc_Word32 AudioLevelIndicationStatus(bool& enable,
|
// header-extension-for-audio-level-indication.
|
||||||
WebRtc_UWord8& ID) const;
|
WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov);
|
||||||
|
|
||||||
// Store the audio level in dBov for header-extension-for-audio-level-indication.
|
// Set payload type for Redundant Audio Data RFC 2198
|
||||||
WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov);
|
WebRtc_Word32 SetRED(const WebRtc_Word8 payloadType);
|
||||||
|
|
||||||
// Set payload type for Redundant Audio Data RFC 2198
|
// Get payload type for Redundant Audio Data RFC 2198
|
||||||
WebRtc_Word32 SetRED(const WebRtc_Word8 payloadType);
|
WebRtc_Word32 RED(WebRtc_Word8& payloadType) const;
|
||||||
|
|
||||||
// Get payload type for Redundant Audio Data RFC 2198
|
/*
|
||||||
WebRtc_Word32 RED(WebRtc_Word8& payloadType) const;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Video
|
* 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
|
// FEC
|
||||||
WebRtc_Word32 SetGenericFECStatus(const bool enable,
|
WebRtc_Word32 SetGenericFECStatus(const bool enable,
|
||||||
const WebRtc_UWord8 payloadTypeRED,
|
const WebRtc_UWord8 payloadTypeRED,
|
||||||
const WebRtc_UWord8 payloadTypeFEC);
|
const WebRtc_UWord8 payloadTypeFEC);
|
||||||
|
|
||||||
WebRtc_Word32 GenericFECStatus(bool& enable,
|
WebRtc_Word32 GenericFECStatus(bool& enable,
|
||||||
WebRtc_UWord8& payloadTypeRED,
|
WebRtc_UWord8& payloadTypeRED,
|
||||||
WebRtc_UWord8& payloadTypeFEC) const;
|
WebRtc_UWord8& payloadTypeFEC) const;
|
||||||
|
|
||||||
WebRtc_Word32 SetFecParameters(
|
WebRtc_Word32 SetFecParameters(
|
||||||
const FecProtectionParams* delta_params,
|
const FecProtectionParams* delta_params,
|
||||||
const FecProtectionParams* key_params);
|
const FecProtectionParams* key_params);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WebRtc_Word32 CheckPayloadType(const WebRtc_Word8 payloadType,
|
WebRtc_Word32 CheckPayloadType(const WebRtc_Word8 payloadType,
|
||||||
RtpVideoCodecTypes& videoType);
|
RtpVideoCodecTypes& videoType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdateNACKBitRate(const WebRtc_UWord32 bytes,
|
void UpdateNACKBitRate(const WebRtc_UWord32 bytes,
|
||||||
const WebRtc_UWord32 now);
|
const WebRtc_UWord32 now);
|
||||||
|
|
||||||
WebRtc_Word32 SendPaddingAccordingToBitrate(
|
WebRtc_Word32 SendPaddingAccordingToBitrate(
|
||||||
WebRtc_Word8 payload_type,
|
WebRtc_Word8 payload_type,
|
||||||
WebRtc_UWord32 capture_timestamp,
|
WebRtc_UWord32 capture_timestamp,
|
||||||
int64_t capture_time_ms);
|
int64_t capture_time_ms);
|
||||||
|
|
||||||
WebRtc_Word32 _id;
|
WebRtc_Word32 _id;
|
||||||
const bool _audioConfigured;
|
const bool _audioConfigured;
|
||||||
RTPSenderAudio* _audio;
|
RTPSenderAudio* _audio;
|
||||||
RTPSenderVideo* _video;
|
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_Word8 _payloadType;
|
||||||
WebRtc_UWord16 _targetSendBitrate;
|
std::map<WebRtc_Word8, ModuleRTPUtility::Payload*> _payloadTypeMap;
|
||||||
WebRtc_UWord16 _packetOverHead;
|
|
||||||
|
|
||||||
WebRtc_Word8 _payloadType;
|
RtpHeaderExtensionMap _rtpHeaderExtensionMap;
|
||||||
std::map<WebRtc_Word8, ModuleRTPUtility::Payload*> _payloadTypeMap;
|
WebRtc_Word32 _transmissionTimeOffset;
|
||||||
|
|
||||||
RtpHeaderExtensionMap _rtpHeaderExtensionMap;
|
// NACK
|
||||||
WebRtc_Word32 _transmissionTimeOffset;
|
WebRtc_UWord32 _nackByteCountTimes[NACK_BYTECOUNT_SIZE];
|
||||||
|
WebRtc_Word32 _nackByteCount[NACK_BYTECOUNT_SIZE];
|
||||||
|
Bitrate _nackBitrate;
|
||||||
|
|
||||||
// NACK
|
RTPPacketHistory* _packetHistory;
|
||||||
WebRtc_UWord32 _nackByteCountTimes[NACK_BYTECOUNT_SIZE];
|
TransmissionBucket _sendBucket;
|
||||||
WebRtc_Word32 _nackByteCount[NACK_BYTECOUNT_SIZE];
|
WebRtc_Word64 _timeLastSendToNetworkUpdate;
|
||||||
Bitrate _nackBitrate;
|
bool _transmissionSmoothing;
|
||||||
|
|
||||||
RTPPacketHistory* _packetHistory;
|
// Statistics
|
||||||
TransmissionBucket _sendBucket;
|
WebRtc_UWord32 _packetsSent;
|
||||||
WebRtc_Word64 _timeLastSendToNetworkUpdate;
|
WebRtc_UWord32 _payloadBytesSent;
|
||||||
bool _transmissionSmoothing;
|
|
||||||
|
|
||||||
// statistics
|
// RTP variables
|
||||||
WebRtc_UWord32 _packetsSent;
|
bool _startTimeStampForced;
|
||||||
WebRtc_UWord32 _payloadBytesSent;
|
WebRtc_UWord32 _startTimeStamp;
|
||||||
|
SSRCDatabase& _ssrcDB;
|
||||||
// RTP variables
|
WebRtc_UWord32 _remoteSSRC;
|
||||||
bool _startTimeStampForced;
|
bool _sequenceNumberForced;
|
||||||
WebRtc_UWord32 _startTimeStamp;
|
WebRtc_UWord16 _sequenceNumber;
|
||||||
SSRCDatabase& _ssrcDB;
|
WebRtc_UWord16 _sequenceNumberRTX;
|
||||||
WebRtc_UWord32 _remoteSSRC;
|
bool _ssrcForced;
|
||||||
bool _sequenceNumberForced;
|
WebRtc_UWord32 _ssrc;
|
||||||
WebRtc_UWord16 _sequenceNumber;
|
WebRtc_UWord32 _timeStamp;
|
||||||
WebRtc_UWord16 _sequenceNumberRTX;
|
WebRtc_UWord8 _CSRCs;
|
||||||
bool _ssrcForced;
|
WebRtc_UWord32 _CSRC[kRtpCsrcSize];
|
||||||
WebRtc_UWord32 _ssrc;
|
bool _includeCSRCs;
|
||||||
WebRtc_UWord32 _timeStamp;
|
bool _RTX;
|
||||||
WebRtc_UWord8 _CSRCs;
|
WebRtc_UWord32 _ssrcRTX;
|
||||||
WebRtc_UWord32 _CSRC[kRtpCsrcSize];
|
|
||||||
bool _includeCSRCs;
|
|
||||||
bool _RTX;
|
|
||||||
WebRtc_UWord32 _ssrcRTX;
|
|
||||||
};
|
};
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
|
@ -78,12 +78,11 @@ class RtpSenderTest : public ::testing::Test {
|
|||||||
protected:
|
protected:
|
||||||
RtpSenderTest()
|
RtpSenderTest()
|
||||||
: fake_clock_(),
|
: fake_clock_(),
|
||||||
rtp_sender_(new RTPSender(0, false, &fake_clock_)),
|
rtp_sender_(new RTPSender(0, false, &fake_clock_, &transport_, NULL)),
|
||||||
transport_(),
|
|
||||||
kMarkerBit(true),
|
kMarkerBit(true),
|
||||||
kType(kRtpExtensionTransmissionTimeOffset),
|
kType(kRtpExtensionTransmissionTimeOffset),
|
||||||
packet_() {
|
packet_() {
|
||||||
EXPECT_EQ(0, rtp_sender_->SetSequenceNumber(kSeqNum));
|
rtp_sender_->SetSequenceNumber(kSeqNum);
|
||||||
}
|
}
|
||||||
~RtpSenderTest() {
|
~RtpSenderTest() {
|
||||||
delete rtp_sender_;
|
delete rtp_sender_;
|
||||||
@ -199,8 +198,6 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithNegativeTransmissionOffsetExtension) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(RtpSenderTest, NoTrafficSmoothing) {
|
TEST_F(RtpSenderTest, NoTrafficSmoothing) {
|
||||||
EXPECT_EQ(0, rtp_sender_->RegisterSendTransport(&transport_));
|
|
||||||
|
|
||||||
WebRtc_Word32 rtp_length = rtp_sender_->BuildRTPheader(packet_,
|
WebRtc_Word32 rtp_length = rtp_sender_->BuildRTPheader(packet_,
|
||||||
kPayload,
|
kPayload,
|
||||||
kMarkerBit,
|
kMarkerBit,
|
||||||
@ -218,9 +215,8 @@ TEST_F(RtpSenderTest, NoTrafficSmoothing) {
|
|||||||
|
|
||||||
TEST_F(RtpSenderTest, TrafficSmoothing) {
|
TEST_F(RtpSenderTest, TrafficSmoothing) {
|
||||||
rtp_sender_->SetTransmissionSmoothingStatus(true);
|
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_->RegisterRtpHeaderExtension(kType, kId));
|
||||||
EXPECT_EQ(0, rtp_sender_->RegisterSendTransport(&transport_));
|
|
||||||
rtp_sender_->SetTargetSendBitrate(300000);
|
rtp_sender_->SetTargetSendBitrate(300000);
|
||||||
|
|
||||||
WebRtc_Word32 rtp_length = rtp_sender_->BuildRTPheader(packet_,
|
WebRtc_Word32 rtp_length = rtp_sender_->BuildRTPheader(packet_,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user