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)
|
||||
: _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) {
|
||||
_rtpSender.SetSSRC(ssrc);
|
||||
_rtcpReceiver.SetSSRC(ssrc);
|
||||
_rtcpSender.SetSSRC(ssrc);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
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
@ -17,7 +17,7 @@
|
||||
|
||||
#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,9 +32,8 @@ class RTPPacketHistory;
|
||||
class RTPSenderAudio;
|
||||
class RTPSenderVideo;
|
||||
|
||||
class RTPSenderInterface
|
||||
{
|
||||
public:
|
||||
class RTPSenderInterface {
|
||||
public:
|
||||
RTPSenderInterface() {}
|
||||
virtual ~RTPSenderInterface() {}
|
||||
|
||||
@ -57,16 +56,16 @@ public:
|
||||
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,
|
||||
WebRtc_UWord16 payload_length,
|
||||
WebRtc_UWord16 rtp_header_length,
|
||||
int64_t capture_time_ms,
|
||||
const StorageType storage) = 0;
|
||||
StorageType storage) = 0;
|
||||
};
|
||||
|
||||
class RTPSender : public Bitrate, public RTPSenderInterface
|
||||
{
|
||||
public:
|
||||
RTPSender(const WebRtc_Word32 id, const bool audio, RtpRtcpClock* clock);
|
||||
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();
|
||||
@ -82,9 +81,6 @@ public:
|
||||
|
||||
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,
|
||||
@ -109,23 +105,22 @@ public:
|
||||
// number of sent RTP bytes
|
||||
WebRtc_UWord32 Bytes() const;
|
||||
|
||||
WebRtc_Word32 ResetDataCounters();
|
||||
void ResetDataCounters();
|
||||
|
||||
WebRtc_UWord32 StartTimestamp() const;
|
||||
WebRtc_Word32 SetStartTimestamp(const WebRtc_UWord32 timestamp,
|
||||
const bool force = false);
|
||||
void SetStartTimestamp(WebRtc_UWord32 timestamp, bool force);
|
||||
|
||||
WebRtc_UWord32 GenerateNewSSRC();
|
||||
WebRtc_Word32 SetSSRC( const WebRtc_UWord32 ssrc);
|
||||
void SetSSRC(const WebRtc_UWord32 ssrc);
|
||||
|
||||
WebRtc_UWord16 SequenceNumber() const;
|
||||
WebRtc_Word32 SetSequenceNumber( WebRtc_UWord16 seq);
|
||||
void SetSequenceNumber(WebRtc_UWord16 seq);
|
||||
|
||||
WebRtc_Word32 CSRCs(WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const;
|
||||
|
||||
WebRtc_Word32 SetCSRCStatus(const bool include);
|
||||
void SetCSRCStatus(const bool include);
|
||||
|
||||
WebRtc_Word32 SetCSRCs(const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
|
||||
void SetCSRCs(const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
|
||||
const WebRtc_UWord8 arrLength);
|
||||
|
||||
WebRtc_Word32 SetMaxPayloadLength(const WebRtc_UWord16 length,
|
||||
@ -181,7 +176,7 @@ public:
|
||||
const WebRtc_UWord16* nackSequenceNumbers,
|
||||
const WebRtc_UWord16 avgRTT);
|
||||
|
||||
WebRtc_Word32 SetStorePacketsStatus(const bool enable,
|
||||
void SetStorePacketsStatus(const bool enable,
|
||||
const WebRtc_UWord16 numberToStore);
|
||||
|
||||
bool StorePackets() const;
|
||||
@ -223,16 +218,13 @@ public:
|
||||
virtual WebRtc_UWord32 SSRC() const;
|
||||
|
||||
virtual WebRtc_Word32 SendToNetwork(WebRtc_UWord8* data_buffer,
|
||||
const WebRtc_UWord16 payload_length,
|
||||
const WebRtc_UWord16 rtp_header_length,
|
||||
WebRtc_UWord16 payload_length,
|
||||
WebRtc_UWord16 rtp_header_length,
|
||||
int64_t capture_time_ms,
|
||||
const StorageType storage);
|
||||
|
||||
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,
|
||||
@ -240,7 +232,8 @@ public:
|
||||
|
||||
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)
|
||||
// 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.
|
||||
@ -251,7 +244,8 @@ public:
|
||||
WebRtc_Word32 AudioLevelIndicationStatus(bool& enable,
|
||||
WebRtc_UWord8& ID) const;
|
||||
|
||||
// Store the audio level in dBov for header-extension-for-audio-level-indication.
|
||||
// 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
|
||||
@ -284,11 +278,11 @@ public:
|
||||
const FecProtectionParams* delta_params,
|
||||
const FecProtectionParams* key_params);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
WebRtc_Word32 CheckPayloadType(const WebRtc_Word8 payloadType,
|
||||
RtpVideoCodecTypes& videoType);
|
||||
|
||||
private:
|
||||
private:
|
||||
void UpdateNACKBitRate(const WebRtc_UWord32 bytes,
|
||||
const WebRtc_UWord32 now);
|
||||
|
||||
@ -304,9 +298,7 @@ private:
|
||||
|
||||
CriticalSectionWrapper* _sendCritsect;
|
||||
|
||||
CriticalSectionWrapper* _transportCritsect;
|
||||
Transport* _transport;
|
||||
|
||||
bool _sendingMedia;
|
||||
|
||||
WebRtc_UWord16 _maxPayloadLength;
|
||||
@ -329,7 +321,7 @@ private:
|
||||
WebRtc_Word64 _timeLastSendToNetworkUpdate;
|
||||
bool _transmissionSmoothing;
|
||||
|
||||
// statistics
|
||||
// Statistics
|
||||
WebRtc_UWord32 _packetsSent;
|
||||
WebRtc_UWord32 _payloadBytesSent;
|
||||
|
||||
|
@ -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_,
|
||||
|
Loading…
x
Reference in New Issue
Block a user