Reformatted rtp_rtcp_impl*.
BUG=
TEST=Trybots.
Review URL: https://webrtc-codereview.appspot.com/1035004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@3374 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 52600d9..8ddb7a9 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -10,9 +10,10 @@
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
-#include <cassert>
#include <string.h>
+#include <cassert>
+
#include "webrtc/common_types.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_video.h"
@@ -21,19 +22,18 @@
#ifdef MATLAB
#include "webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.h"
-extern MatlabEngine eng; // global variable defined elsewhere
+extern MatlabEngine eng; // Global variable defined elsewhere.
#endif
-
-// local for this file
+// Local for this file.
namespace {
-const float FracMS = 4.294967296E6f;
+const float kFracMs = 4.294967296E6f;
-} // namepace
+} // namespace
#ifdef _WIN32
-// disable warning C4355: 'this' : used in base member initializer list
+// Disable warning C4355: 'this' : used in base member initializer list.
#pragma warning(disable : 4355)
#endif
@@ -89,165 +89,167 @@
}
ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
- : _rtpSender(configuration.id,
- configuration.audio,
- configuration.clock,
- configuration.outgoing_transport,
- configuration.audio_messages,
- configuration.paced_sender),
- _rtpReceiver(configuration.id, configuration.audio, configuration.clock,
- this, configuration.audio_messages,
- configuration.incoming_data,
- configuration.incoming_messages),
- _rtcpSender(configuration.id, configuration.audio, configuration.clock,
- this),
- _rtcpReceiver(configuration.id, configuration.clock, this),
- _owns_clock(false),
- _clock(*configuration.clock),
- _id(configuration.id),
- _audio(configuration.audio),
- _collisionDetected(false),
- _lastProcessTime(configuration.clock->GetTimeInMS()),
- _lastBitrateProcessTime(configuration.clock->GetTimeInMS()),
- _lastPacketTimeoutProcessTime(configuration.clock->GetTimeInMS()),
- _packetOverHead(28), // IPV4 UDP
- _criticalSectionModulePtrs(
- CriticalSectionWrapper::CreateCriticalSection()),
- _criticalSectionModulePtrsFeedback(
- CriticalSectionWrapper::CreateCriticalSection()),
- _defaultModule(
- static_cast<ModuleRtpRtcpImpl*>(configuration.default_module)),
- _deadOrAliveActive(false),
- _deadOrAliveTimeoutMS(0),
- _deadOrAliveLastTimer(0),
- _nackMethod(kNackOff),
- _nackLastTimeSent(0),
- _nackLastSeqNumberSent(0),
- _simulcast(false),
- _keyFrameReqMethod(kKeyFrameReqFirRtp),
+ : rtp_sender_(configuration.id,
+ configuration.audio,
+ configuration.clock,
+ configuration.outgoing_transport,
+ configuration.audio_messages,
+ configuration.paced_sender),
+ rtp_receiver_(configuration.id, configuration.audio, configuration.clock,
+ this, configuration.audio_messages,
+ configuration.incoming_data,
+ configuration.incoming_messages),
+ rtcp_sender_(configuration.id, configuration.audio, configuration.clock,
+ this),
+ rtcp_receiver_(configuration.id, configuration.clock, this),
+ owns_clock_(false),
+ clock_(*configuration.clock),
+ id_(configuration.id),
+ audio_(configuration.audio),
+ collision_detected_(false),
+ last_process_time_(configuration.clock->GetTimeInMS()),
+ last_bitrate_process_time_(configuration.clock->GetTimeInMS()),
+ last_packet_timeout_process_time_(configuration.clock->GetTimeInMS()),
+ packet_overhead_(28), // IPV4 UDP.
+ critical_section_module_ptrs_(
+ CriticalSectionWrapper::CreateCriticalSection()),
+ critical_section_module_ptrs_feedback_(
+ CriticalSectionWrapper::CreateCriticalSection()),
+ default_module_(
+ static_cast<ModuleRtpRtcpImpl*>(configuration.default_module)),
+ dead_or_alive_active_(false),
+ dead_or_alive_timeout_ms_(0),
+ dead_or_alive_last_timer_(0),
+ nack_method_(kNackOff),
+ nack_last_time_sent_(0),
+ nack_last_seq_number_sent_(0),
+ simulcast_(false),
+ key_frame_req_method_(kKeyFrameReqFirRtp),
remote_bitrate_(configuration.remote_bitrate_estimator),
rtt_observer_(configuration.rtt_observer)
#ifdef MATLAB
- , _plot1(NULL)
+ , plot1_(NULL)
#endif
{
- _sendVideoCodec.codecType = kVideoCodecUnknown;
+ send_video_codec_.codecType = kVideoCodecUnknown;
- if (_defaultModule) {
- _defaultModule->RegisterChildModule(this);
+ if (default_module_) {
+ default_module_->RegisterChildModule(this);
}
// TODO(pwestin) move to constructors of each rtp/rtcp sender/receiver object.
- _rtcpReceiver.RegisterRtcpObservers(configuration.intra_frame_callback,
- configuration.bandwidth_callback,
- configuration.rtcp_feedback);
- _rtcpSender.RegisterSendTransport(configuration.outgoing_transport);
+ rtcp_receiver_.RegisterRtcpObservers(configuration.intra_frame_callback,
+ configuration.bandwidth_callback,
+ configuration.rtcp_feedback);
+ rtcp_sender_.RegisterSendTransport(configuration.outgoing_transport);
- // make sure that RTCP objects are aware of our SSRC
- WebRtc_UWord32 SSRC = _rtpSender.SSRC();
- _rtcpSender.SetSSRC(SSRC);
- _rtcpReceiver.SetSSRC(SSRC);
+ // Make sure that RTCP objects are aware of our SSRC
+ WebRtc_UWord32 SSRC = rtp_sender_.SSRC();
+ rtcp_sender_.SetSSRC(SSRC);
+ rtcp_receiver_.SetSSRC(SSRC);
- WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, _id, "%s created", __FUNCTION__);
+ WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id_, "%s created", __FUNCTION__);
}
ModuleRtpRtcpImpl::~ModuleRtpRtcpImpl() {
- WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, _id, "%s deleted", __FUNCTION__);
+ WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id_, "%s deleted", __FUNCTION__);
// All child modules MUST be deleted before deleting the default.
- assert(_childModules.empty());
+ assert(child_modules_.empty());
- // Deregister for the child modules
- // will go in to the default and remove it self
- if (_defaultModule) {
- _defaultModule->DeRegisterChildModule(this);
+ // Deregister for the child modules.
+ // Will go in to the default and remove it self.
+ if (default_module_) {
+ default_module_->DeRegisterChildModule(this);
}
#ifdef MATLAB
- if (_plot1) {
- eng.DeletePlot(_plot1);
- _plot1 = NULL;
+ if (plot1_) {
+ eng.DeletePlot(plot1_);
+ plot1_ = NULL;
}
#endif
- if (_owns_clock) {
- delete &_clock;
+ if (owns_clock_) {
+ delete &clock_;
}
}
void ModuleRtpRtcpImpl::RegisterChildModule(RtpRtcp* module) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"RegisterChildModule(module:0x%x)",
module);
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
+ CriticalSectionScoped lock(
+ critical_section_module_ptrs_.get());
+ CriticalSectionScoped double_lock(
+ critical_section_module_ptrs_feedback_.get());
- CriticalSectionScoped doubleLock(_criticalSectionModulePtrsFeedback.get());
- // we use two locks for protecting _childModules one
- // (_criticalSectionModulePtrsFeedback) for incoming
- // messages (BitrateSent) and _criticalSectionModulePtrs
- // for all outgoing messages sending packets etc
- _childModules.push_back((ModuleRtpRtcpImpl*)module);
+ // We use two locks for protecting child_modules_, one
+ // (critical_section_module_ptrs_feedback_) for incoming
+ // messages (BitrateSent) and critical_section_module_ptrs_
+ // for all outgoing messages sending packets etc.
+ child_modules_.push_back(static_cast<ModuleRtpRtcpImpl*>(module));
}
-void ModuleRtpRtcpImpl::DeRegisterChildModule(RtpRtcp* removeModule) {
+void ModuleRtpRtcpImpl::DeRegisterChildModule(RtpRtcp* remove_module) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "DeRegisterChildModule(module:0x%x)", removeModule);
+ id_,
+ "DeRegisterChildModule(module:0x%x)", remove_module);
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
+ CriticalSectionScoped lock(
+ critical_section_module_ptrs_.get());
+ CriticalSectionScoped double_lock(
+ critical_section_module_ptrs_feedback_.get());
- CriticalSectionScoped doubleLock(_criticalSectionModulePtrsFeedback.get());
-
- std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
- while (it != _childModules.end()) {
+ std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
+ while (it != child_modules_.end()) {
RtpRtcp* module = *it;
- if (module == removeModule) {
- _childModules.erase(it);
+ if (module == remove_module) {
+ child_modules_.erase(it);
return;
}
it++;
}
}
-// returns the number of milliseconds until the module want a worker thread
-// to call Process
+// Returns the number of milliseconds until the module want a worker thread
+// to call Process.
WebRtc_Word32 ModuleRtpRtcpImpl::TimeUntilNextProcess() {
- const WebRtc_Word64 now = _clock.GetTimeInMS();
- return kRtpRtcpMaxIdleTimeProcess - (now - _lastProcessTime);
+ const WebRtc_Word64 now = clock_.GetTimeInMS();
+ return kRtpRtcpMaxIdleTimeProcess - (now - last_process_time_);
}
-// Process any pending tasks such as timeouts
-// non time critical events
+// Process any pending tasks such as timeouts (non time critical events).
WebRtc_Word32 ModuleRtpRtcpImpl::Process() {
- const WebRtc_Word64 now = _clock.GetTimeInMS();
- _lastProcessTime = now;
+ const WebRtc_Word64 now = clock_.GetTimeInMS();
+ last_process_time_ = now;
- if (now >= _lastPacketTimeoutProcessTime +
- kRtpRtcpPacketTimeoutProcessTimeMs) {
- _rtpReceiver.PacketTimeout();
- _rtcpReceiver.PacketTimeout();
- _lastPacketTimeoutProcessTime = now;
+ if (now >=
+ last_packet_timeout_process_time_ + kRtpRtcpPacketTimeoutProcessTimeMs) {
+ rtp_receiver_.PacketTimeout();
+ rtcp_receiver_.PacketTimeout();
+ last_packet_timeout_process_time_ = now;
}
- if (now >= _lastBitrateProcessTime + kRtpRtcpBitrateProcessTimeMs) {
- _rtpSender.ProcessBitrate();
- _rtpReceiver.ProcessBitrate();
- _lastBitrateProcessTime = now;
+ if (now >= last_bitrate_process_time_ + kRtpRtcpBitrateProcessTimeMs) {
+ rtp_sender_.ProcessBitrate();
+ rtp_receiver_.ProcessBitrate();
+ last_bitrate_process_time_ = now;
}
ProcessDeadOrAliveTimer();
- const bool defaultInstance(_childModules.empty() ? false : true);
- if (!defaultInstance && _rtcpSender.TimeToSendRTCPReport()) {
+ const bool default_instance(child_modules_.empty() ? false : true);
+ if (!default_instance && rtcp_sender_.TimeToSendRTCPReport()) {
WebRtc_UWord16 max_rtt = 0;
- if (_rtcpSender.Sending()) {
+ if (rtcp_sender_.Sending()) {
std::vector<RTCPReportBlock> receive_blocks;
- _rtcpReceiver.StatisticsReceived(&receive_blocks);
+ rtcp_receiver_.StatisticsReceived(&receive_blocks);
for (std::vector<RTCPReportBlock>::iterator it = receive_blocks.begin();
it != receive_blocks.end(); ++it) {
WebRtc_UWord16 rtt = 0;
- _rtcpReceiver.RTT(it->remoteSSRC, &rtt, NULL, NULL, NULL);
+ rtcp_receiver_.RTT(it->remoteSSRC, &rtt, NULL, NULL, NULL);
max_rtt = (rtt > max_rtt) ? rtt : max_rtt;
}
// Report the rtt.
@@ -256,7 +258,7 @@
} else {
// No valid RTT estimate, probably since this is a receive only channel.
// Use an estimate set by a send module.
- max_rtt = _rtcpReceiver.RTT();
+ max_rtt = rtcp_receiver_.RTT();
}
if (max_rtt == 0) {
// No own rtt calculation or set rtt, use default value.
@@ -265,11 +267,11 @@
// Verify receiver reports are delivered and the reported sequence number is
// increasing.
- if (_rtcpSender.Sending()) {
+ if (rtcp_sender_.Sending()) {
int64_t rtcp_interval = RtcpReportInterval();
- if (_rtcpReceiver.RtcpRrTimeout(rtcp_interval)) {
+ if (rtcp_receiver_.RtcpRrTimeout(rtcp_interval)) {
LOG_F(LS_WARNING) << "Timeout: No RTCP RR received.";
- } else if (_rtcpReceiver.RtcpRrSequenceNumberTimeout(rtcp_interval)) {
+ } else if (rtcp_receiver_.RtcpRrSequenceNumberTimeout(rtcp_interval)) {
LOG_F(LS_WARNING) <<
"Timeout: No increase in RTCP RR extended highest sequence number.";
}
@@ -278,7 +280,7 @@
if (remote_bitrate_) {
// TODO(mflodman) Remove this and let this be propagated by CallStats.
remote_bitrate_->SetRtt(max_rtt);
- remote_bitrate_->UpdateEstimate(_rtpReceiver.SSRC(), now);
+ remote_bitrate_->UpdateEstimate(rtp_receiver_.SSRC(), now);
if (TMMBR()) {
unsigned int target_bitrate = 0;
std::vector<unsigned int> ssrcs;
@@ -286,574 +288,567 @@
if (!ssrcs.empty()) {
target_bitrate = target_bitrate / ssrcs.size();
}
- _rtcpSender.SetTargetBitrate(target_bitrate);
+ rtcp_sender_.SetTargetBitrate(target_bitrate);
}
}
}
- _rtcpSender.SendRTCP(kRtcpReport);
+ rtcp_sender_.SendRTCP(kRtcpReport);
}
if (UpdateRTCPReceiveInformationTimers()) {
- // a receiver has timed out
- _rtcpReceiver.UpdateTMMBR();
+ // A receiver has timed out
+ rtcp_receiver_.UpdateTMMBR();
}
return 0;
}
-/**
-* Receiver
-*/
-
void ModuleRtpRtcpImpl::ProcessDeadOrAliveTimer() {
- if (_deadOrAliveActive) {
- const WebRtc_Word64 now = _clock.GetTimeInMS();
- if (now > _deadOrAliveTimeoutMS + _deadOrAliveLastTimer) {
- // RTCP is alive if we have received a report the last 12 seconds
- _deadOrAliveLastTimer += _deadOrAliveTimeoutMS;
+ if (dead_or_alive_active_) {
+ const WebRtc_Word64 now = clock_.GetTimeInMS();
+ if (now > dead_or_alive_timeout_ms_ + dead_or_alive_last_timer_) {
+ // RTCP is alive if we have received a report the last 12 seconds.
+ dead_or_alive_last_timer_ += dead_or_alive_timeout_ms_;
bool RTCPalive = false;
- if (_rtcpReceiver.LastReceived() + 12000 > now) {
+ if (rtcp_receiver_.LastReceived() + 12000 > now) {
RTCPalive = true;
}
- _rtpReceiver.ProcessDeadOrAlive(RTCPalive, now);
+ rtp_receiver_.ProcessDeadOrAlive(RTCPalive, now);
}
}
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetPeriodicDeadOrAliveStatus(
- const bool enable,
- const WebRtc_UWord8 sampleTimeSeconds) {
+ const bool enable,
+ const WebRtc_UWord8 sample_time_seconds) {
if (enable) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetPeriodicDeadOrAliveStatus(enable, %d)",
- sampleTimeSeconds);
+ sample_time_seconds);
} else {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetPeriodicDeadOrAliveStatus(disable)");
}
- if (sampleTimeSeconds == 0) {
+ if (sample_time_seconds == 0) {
return -1;
}
- _deadOrAliveActive = enable;
- _deadOrAliveTimeoutMS = sampleTimeSeconds * 1000;
- // trigger the first after one period
- _deadOrAliveLastTimer = _clock.GetTimeInMS();
+ dead_or_alive_active_ = enable;
+ dead_or_alive_timeout_ms_ = sample_time_seconds * 1000;
+ // Trigger the first after one period.
+ dead_or_alive_last_timer_ = clock_.GetTimeInMS();
return 0;
}
WebRtc_Word32 ModuleRtpRtcpImpl::PeriodicDeadOrAliveStatus(
bool& enable,
- WebRtc_UWord8& sampleTimeSeconds) {
+ WebRtc_UWord8& sample_time_seconds) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"PeriodicDeadOrAliveStatus()");
- enable = _deadOrAliveActive;
- sampleTimeSeconds = (WebRtc_UWord8)(_deadOrAliveTimeoutMS / 1000);
+ enable = dead_or_alive_active_;
+ sample_time_seconds =
+ static_cast<WebRtc_UWord8>(dead_or_alive_timeout_ms_ / 1000);
return 0;
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetPacketTimeout(
- const WebRtc_UWord32 RTPtimeoutMS,
- const WebRtc_UWord32 RTCPtimeoutMS) {
+ const WebRtc_UWord32 rtp_timeout_ms,
+ const WebRtc_UWord32 rtcp_timeout_ms) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetPacketTimeout(%u,%u)",
- RTPtimeoutMS,
- RTCPtimeoutMS);
+ rtp_timeout_ms,
+ rtcp_timeout_ms);
- if (_rtpReceiver.SetPacketTimeout(RTPtimeoutMS) == 0) {
- return _rtcpReceiver.SetPacketTimeout(RTCPtimeoutMS);
+ if (rtp_receiver_.SetPacketTimeout(rtp_timeout_ms) == 0) {
+ return rtcp_receiver_.SetPacketTimeout(rtcp_timeout_ms);
}
return -1;
}
WebRtc_Word32 ModuleRtpRtcpImpl::RegisterReceivePayload(
- const CodecInst& voiceCodec) {
+ const CodecInst& voice_codec) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "RegisterReceivePayload(voiceCodec)");
+ id_,
+ "RegisterReceivePayload(voice_codec)");
- return _rtpReceiver.RegisterReceivePayload(
- voiceCodec.plname,
- voiceCodec.pltype,
- voiceCodec.plfreq,
- voiceCodec.channels,
- (voiceCodec.rate < 0) ? 0 : voiceCodec.rate);
+ return rtp_receiver_.RegisterReceivePayload(
+ voice_codec.plname,
+ voice_codec.pltype,
+ voice_codec.plfreq,
+ voice_codec.channels,
+ (voice_codec.rate < 0) ? 0 : voice_codec.rate);
}
WebRtc_Word32 ModuleRtpRtcpImpl::RegisterReceivePayload(
- const VideoCodec& videoCodec) {
+ const VideoCodec& video_codec) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "RegisterReceivePayload(videoCodec)");
+ id_,
+ "RegisterReceivePayload(video_codec)");
- return _rtpReceiver.RegisterReceivePayload(videoCodec.plName,
- videoCodec.plType,
- 90000,
- 0,
- videoCodec.maxBitrate);
+ return rtp_receiver_.RegisterReceivePayload(video_codec.plName,
+ video_codec.plType,
+ 90000,
+ 0,
+ video_codec.maxBitrate);
}
WebRtc_Word32 ModuleRtpRtcpImpl::ReceivePayloadType(
- const CodecInst& voiceCodec,
- WebRtc_Word8* plType) {
+ const CodecInst& voice_codec,
+ WebRtc_Word8* pl_type) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "ReceivePayloadType(voiceCodec)");
+ id_,
+ "ReceivePayloadType(voice_codec)");
- return _rtpReceiver.ReceivePayloadType(
- voiceCodec.plname,
- voiceCodec.plfreq,
- voiceCodec.channels,
- (voiceCodec.rate < 0) ? 0 : voiceCodec.rate,
- plType);
+ return rtp_receiver_.ReceivePayloadType(
+ voice_codec.plname,
+ voice_codec.plfreq,
+ voice_codec.channels,
+ (voice_codec.rate < 0) ? 0 : voice_codec.rate,
+ pl_type);
}
WebRtc_Word32 ModuleRtpRtcpImpl::ReceivePayloadType(
- const VideoCodec& videoCodec,
- WebRtc_Word8* plType) {
+ const VideoCodec& video_codec,
+ WebRtc_Word8* pl_type) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "ReceivePayloadType(videoCodec)");
+ id_,
+ "ReceivePayloadType(video_codec)");
- return _rtpReceiver.ReceivePayloadType(videoCodec.plName,
- 90000,
- 0,
- videoCodec.maxBitrate,
- plType);
+ return rtp_receiver_.ReceivePayloadType(video_codec.plName,
+ 90000,
+ 0,
+ video_codec.maxBitrate,
+ pl_type);
}
WebRtc_Word32 ModuleRtpRtcpImpl::DeRegisterReceivePayload(
- const WebRtc_Word8 payloadType) {
+ const WebRtc_Word8 payload_type) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"DeRegisterReceivePayload(%d)",
- payloadType);
+ payload_type);
- return _rtpReceiver.DeRegisterReceivePayload(payloadType);
+ return rtp_receiver_.DeRegisterReceivePayload(payload_type);
}
-// get the currently configured SSRC filter
-WebRtc_Word32 ModuleRtpRtcpImpl::SSRCFilter(WebRtc_UWord32& allowedSSRC) const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SSRCFilter()");
+// Get the currently configured SSRC filter.
+WebRtc_Word32 ModuleRtpRtcpImpl::SSRCFilter(
+ WebRtc_UWord32& allowed_ssrc) const {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SSRCFilter()");
- return _rtpReceiver.SSRCFilter(allowedSSRC);
+ return rtp_receiver_.SSRCFilter(allowed_ssrc);
}
-// set a SSRC to be used as a filter for incoming RTP streams
+// Set a SSRC to be used as a filter for incoming RTP streams.
WebRtc_Word32 ModuleRtpRtcpImpl::SetSSRCFilter(
- const bool enable,
- const WebRtc_UWord32 allowedSSRC) {
+ const bool enable,
+ const WebRtc_UWord32 allowed_ssrc) {
if (enable) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetSSRCFilter(enable, 0x%x)",
- allowedSSRC);
+ allowed_ssrc);
} else {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetSSRCFilter(disable)");
}
- return _rtpReceiver.SetSSRCFilter(enable, allowedSSRC);
+ return rtp_receiver_.SetSSRCFilter(enable, allowed_ssrc);
}
-// Get last received remote timestamp
+// Get last received remote timestamp.
WebRtc_UWord32 ModuleRtpRtcpImpl::RemoteTimestamp() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RemoteTimestamp()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteTimestamp()");
- return _rtpReceiver.TimeStamp();
+ return rtp_receiver_.TimeStamp();
}
int64_t ModuleRtpRtcpImpl::LocalTimeOfRemoteTimeStamp() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"LocalTimeOfRemoteTimeStamp()");
- return _rtpReceiver.LastReceivedTimeMs();
+ return rtp_receiver_.LastReceivedTimeMs();
}
-// Get the current estimated remote timestamp
+// Get the current estimated remote timestamp.
WebRtc_Word32 ModuleRtpRtcpImpl::EstimatedRemoteTimeStamp(
WebRtc_UWord32& timestamp) const {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"EstimatedRemoteTimeStamp()");
- return _rtpReceiver.EstimatedRemoteTimeStamp(timestamp);
+ return rtp_receiver_.EstimatedRemoteTimeStamp(timestamp);
}
-// Get incoming SSRC
+// Get incoming SSRC.
WebRtc_UWord32 ModuleRtpRtcpImpl::RemoteSSRC() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RemoteSSRC()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteSSRC()");
- return _rtpReceiver.SSRC();
+ return rtp_receiver_.SSRC();
}
// Get remote CSRC
WebRtc_Word32 ModuleRtpRtcpImpl::RemoteCSRCs(
- WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RemoteCSRCs()");
+ WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize]) const {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteCSRCs()");
- return _rtpReceiver.CSRCs(arrOfCSRC);
+ return rtp_receiver_.CSRCs(arr_of_csrc);
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetRTXSendStatus(
- const bool enable,
- const bool setSSRC,
- const WebRtc_UWord32 SSRC) {
- _rtpSender.SetRTXStatus(enable, setSSRC, SSRC);
+ const bool enable,
+ const bool set_ssrc,
+ const WebRtc_UWord32 ssrc) {
+ rtp_sender_.SetRTXStatus(enable, set_ssrc, ssrc);
return 0;
}
WebRtc_Word32 ModuleRtpRtcpImpl::RTXSendStatus(bool* enable,
- WebRtc_UWord32* SSRC) const {
- _rtpSender.RTXStatus(enable, SSRC);
+ WebRtc_UWord32* ssrc) const {
+ rtp_sender_.RTXStatus(enable, ssrc);
return 0;
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetRTXReceiveStatus(
- const bool enable,
- const WebRtc_UWord32 SSRC) {
- _rtpReceiver.SetRTXStatus(enable, SSRC);
+ const bool enable,
+ const WebRtc_UWord32 ssrc) {
+ rtp_receiver_.SetRTXStatus(enable, ssrc);
return 0;
}
WebRtc_Word32 ModuleRtpRtcpImpl::RTXReceiveStatus(bool* enable,
- WebRtc_UWord32* SSRC) const {
- _rtpReceiver.RTXStatus(enable, SSRC);
+ WebRtc_UWord32* ssrc) const {
+ rtp_receiver_.RTXStatus(enable, ssrc);
return 0;
}
-// called by the network module when we receive a packet
+// Called by the network module when we receive a packet.
WebRtc_Word32 ModuleRtpRtcpImpl::IncomingPacket(
- const WebRtc_UWord8* incomingPacket,
- const WebRtc_UWord16 incomingPacketLength) {
+ const WebRtc_UWord8* incoming_packet,
+ const WebRtc_UWord16 incoming_packet_length) {
WEBRTC_TRACE(kTraceStream,
kTraceRtpRtcp,
- _id,
- "IncomingPacket(packetLength:%u)",
- incomingPacketLength);
- // minimum RTP is 12 bytes
- // minimum RTCP is 8 bytes (RTCP BYE)
- if (incomingPacketLength < 8 || incomingPacket == NULL) {
+ id_,
+ "IncomingPacket(packet_length:%u)",
+ incoming_packet_length);
+ // Minimum RTP is 12 bytes.
+ // Minimum RTCP is 8 bytes (RTCP BYE).
+ if (incoming_packet_length < 8 || incoming_packet == NULL) {
WEBRTC_TRACE(kTraceDebug,
kTraceRtpRtcp,
- _id,
+ id_,
"IncomingPacket invalid buffer or length");
return -1;
}
- // check RTP version
- const WebRtc_UWord8 version = incomingPacket[0] >> 6 ;
+ // Check RTP version.
+ const WebRtc_UWord8 version = incoming_packet[0] >> 6;
if (version != 2) {
WEBRTC_TRACE(kTraceDebug,
kTraceRtpRtcp,
- _id,
+ id_,
"IncomingPacket invalid RTP version");
return -1;
}
- ModuleRTPUtility::RTPHeaderParser rtpParser(incomingPacket,
- incomingPacketLength);
+ ModuleRTPUtility::RTPHeaderParser rtp_parser(incoming_packet,
+ incoming_packet_length);
- if (rtpParser.RTCP()) {
+ if (rtp_parser.RTCP()) {
// Allow receive of non-compound RTCP packets.
- RTCPUtility::RTCPParserV2 rtcpParser(incomingPacket,
- incomingPacketLength,
- true);
+ RTCPUtility::RTCPParserV2 rtcp_parser(incoming_packet,
+ incoming_packet_length,
+ true);
- const bool validRTCPHeader = rtcpParser.IsValid();
- if (!validRTCPHeader) {
+ const bool valid_rtcpheader = rtcp_parser.IsValid();
+ if (!valid_rtcpheader) {
WEBRTC_TRACE(kTraceDebug,
kTraceRtpRtcp,
- _id,
+ id_,
"IncomingPacket invalid RTCP packet");
return -1;
}
- RTCPHelp::RTCPPacketInformation rtcpPacketInformation;
- WebRtc_Word32 retVal = _rtcpReceiver.IncomingRTCPPacket(
- rtcpPacketInformation,
- &rtcpParser);
- if (retVal == 0) {
- _rtcpReceiver.TriggerCallbacksFromRTCPPacket(rtcpPacketInformation);
+ RTCPHelp::RTCPPacketInformation rtcp_packet_information;
+ WebRtc_Word32 ret_val = rtcp_receiver_.IncomingRTCPPacket(
+ rtcp_packet_information, &rtcp_parser);
+ if (ret_val == 0) {
+ rtcp_receiver_.TriggerCallbacksFromRTCPPacket(rtcp_packet_information);
}
- return retVal;
+ return ret_val;
} else {
- WebRtcRTPHeader rtpHeader;
- memset(&rtpHeader, 0, sizeof(rtpHeader));
+ WebRtcRTPHeader rtp_header;
+ memset(&rtp_header, 0, sizeof(rtp_header));
RtpHeaderExtensionMap map;
- _rtpReceiver.GetHeaderExtensionMapCopy(&map);
+ rtp_receiver_.GetHeaderExtensionMapCopy(&map);
- const bool validRTPHeader = rtpParser.Parse(rtpHeader, &map);
- if (!validRTPHeader) {
+ const bool valid_rtpheader = rtp_parser.Parse(rtp_header, &map);
+ if (!valid_rtpheader) {
WEBRTC_TRACE(kTraceDebug,
kTraceRtpRtcp,
- _id,
+ id_,
"IncomingPacket invalid RTP header");
return -1;
}
- return _rtpReceiver.IncomingRTPPacket(&rtpHeader,
- incomingPacket,
- incomingPacketLength);
+ return rtp_receiver_.IncomingRTPPacket(&rtp_header,
+ incoming_packet,
+ incoming_packet_length);
}
}
-/**
-* Sender
-*/
-
WebRtc_Word32 ModuleRtpRtcpImpl::RegisterSendPayload(
- const CodecInst& voiceCodec) {
+ const CodecInst& voice_codec) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "RegisterSendPayload(plName:%s plType:%d frequency:%u)",
- voiceCodec.plname,
- voiceCodec.pltype,
- voiceCodec.plfreq);
+ id_,
+ "RegisterSendPayload(pl_name:%s pl_type:%d frequency:%u)",
+ voice_codec.plname,
+ voice_codec.pltype,
+ voice_codec.plfreq);
- return _rtpSender.RegisterPayload(
- voiceCodec.plname,
- voiceCodec.pltype,
- voiceCodec.plfreq,
- voiceCodec.channels,
- (voiceCodec.rate < 0) ? 0 : voiceCodec.rate);
+ return rtp_sender_.RegisterPayload(
+ voice_codec.plname,
+ voice_codec.pltype,
+ voice_codec.plfreq,
+ voice_codec.channels,
+ (voice_codec.rate < 0) ? 0 : voice_codec.rate);
}
WebRtc_Word32 ModuleRtpRtcpImpl::RegisterSendPayload(
- const VideoCodec& videoCodec) {
+ const VideoCodec& video_codec) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "RegisterSendPayload(plName:%s plType:%d)",
- videoCodec.plName,
- videoCodec.plType);
+ id_,
+ "RegisterSendPayload(pl_name:%s pl_type:%d)",
+ video_codec.plName,
+ video_codec.plType);
- _sendVideoCodec = videoCodec;
- _simulcast = (videoCodec.numberOfSimulcastStreams > 1) ? true : false;
- return _rtpSender.RegisterPayload(videoCodec.plName,
- videoCodec.plType,
- 90000,
- 0,
- videoCodec.maxBitrate);
+ send_video_codec_ = video_codec;
+ simulcast_ = (video_codec.numberOfSimulcastStreams > 1) ? true : false;
+ return rtp_sender_.RegisterPayload(video_codec.plName,
+ video_codec.plType,
+ 90000,
+ 0,
+ video_codec.maxBitrate);
}
WebRtc_Word32 ModuleRtpRtcpImpl::DeRegisterSendPayload(
- const WebRtc_Word8 payloadType) {
+ const WebRtc_Word8 payload_type) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "DeRegisterSendPayload(%d)", payloadType);
+ id_,
+ "DeRegisterSendPayload(%d)", payload_type);
- return _rtpSender.DeRegisterSendPayload(payloadType);
+ return rtp_sender_.DeRegisterSendPayload(payload_type);
}
WebRtc_Word8 ModuleRtpRtcpImpl::SendPayloadType() const {
- return _rtpSender.SendPayloadType();
+ return rtp_sender_.SendPayloadType();
}
WebRtc_UWord32 ModuleRtpRtcpImpl::StartTimestamp() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "StartTimestamp()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "StartTimestamp()");
- return _rtpSender.StartTimestamp();
+ return rtp_sender_.StartTimestamp();
}
-// configure start timestamp, default is a random number
+// Configure start timestamp, default is a random number.
WebRtc_Word32 ModuleRtpRtcpImpl::SetStartTimestamp(
const WebRtc_UWord32 timestamp) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetStartTimestamp(%d)",
timestamp);
- _rtcpSender.SetStartTimestamp(timestamp);
- _rtpSender.SetStartTimestamp(timestamp, true);
+ rtcp_sender_.SetStartTimestamp(timestamp);
+ rtp_sender_.SetStartTimestamp(timestamp, true);
return 0; // TODO(pwestin): change to void.
}
WebRtc_UWord16 ModuleRtpRtcpImpl::SequenceNumber() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SequenceNumber()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SequenceNumber()");
- return _rtpSender.SequenceNumber();
+ return rtp_sender_.SequenceNumber();
}
-// Set SequenceNumber, default is a random number
+// Set SequenceNumber, default is a random number.
WebRtc_Word32 ModuleRtpRtcpImpl::SetSequenceNumber(
- const WebRtc_UWord16 seqNum) {
+ const WebRtc_UWord16 seq_num) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetSequenceNumber(%d)",
- seqNum);
+ seq_num);
- _rtpSender.SetSequenceNumber(seqNum);
+ rtp_sender_.SetSequenceNumber(seq_num);
return 0; // TODO(pwestin): change to void.
}
WebRtc_UWord32 ModuleRtpRtcpImpl::SSRC() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SSRC()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SSRC()");
- return _rtpSender.SSRC();
+ return rtp_sender_.SSRC();
}
-// configure SSRC, default is a random number
+// Configure SSRC, default is a random number.
WebRtc_Word32 ModuleRtpRtcpImpl::SetSSRC(const WebRtc_UWord32 ssrc) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SetSSRC(%d)", ssrc);
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetSSRC(%d)", ssrc);
- _rtpSender.SetSSRC(ssrc);
- _rtcpReceiver.SetSSRC(ssrc);
- _rtcpSender.SetSSRC(ssrc);
+ rtp_sender_.SetSSRC(ssrc);
+ rtcp_receiver_.SetSSRC(ssrc);
+ rtcp_sender_.SetSSRC(ssrc);
return 0; // TODO(pwestin): change to void.
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetCSRCStatus(const bool include) {
- _rtcpSender.SetCSRCStatus(include);
- _rtpSender.SetCSRCStatus(include);
+ rtcp_sender_.SetCSRCStatus(include);
+ rtp_sender_.SetCSRCStatus(include);
return 0; // TODO(pwestin): change to void.
}
WebRtc_Word32 ModuleRtpRtcpImpl::CSRCs(
- WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "CSRCs()");
+ WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize]) const {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "CSRCs()");
- return _rtpSender.CSRCs(arrOfCSRC);
+ return rtp_sender_.CSRCs(arr_of_csrc);
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetCSRCs(
- const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
- const WebRtc_UWord8 arrLength) {
+ const WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize],
+ const WebRtc_UWord8 arr_length) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "SetCSRCs(arrLength:%d)",
- arrLength);
+ id_,
+ "SetCSRCs(arr_length:%d)",
+ arr_length);
- const bool defaultInstance(_childModules.empty() ? false : true);
+ const bool default_instance(child_modules_.empty() ? false : true);
- if (defaultInstance) {
- // for default we need to update all child modules too
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
+ if (default_instance) {
+ // For default we need to update all child modules too.
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
- std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
- while (it != _childModules.end()) {
+ std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
+ while (it != child_modules_.end()) {
RtpRtcp* module = *it;
if (module) {
- module->SetCSRCs(arrOfCSRC, arrLength);
+ module->SetCSRCs(arr_of_csrc, arr_length);
}
it++;
}
} else {
- for (int i = 0; i < arrLength; i++) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "\tidx:%d CSRC:%u", i,
- arrOfCSRC[i]);
+ for (int i = 0; i < arr_length; ++i) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "\tidx:%d CSRC:%u", i,
+ arr_of_csrc[i]);
}
- _rtcpSender.SetCSRCs(arrOfCSRC, arrLength);
- _rtpSender.SetCSRCs(arrOfCSRC, arrLength);
+ rtcp_sender_.SetCSRCs(arr_of_csrc, arr_length);
+ rtp_sender_.SetCSRCs(arr_of_csrc, arr_length);
}
return 0; // TODO(pwestin): change to void.
}
WebRtc_UWord32 ModuleRtpRtcpImpl::PacketCountSent() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "PacketCountSent()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "PacketCountSent()");
- return _rtpSender.Packets();
+ return rtp_sender_.Packets();
}
WebRtc_UWord32 ModuleRtpRtcpImpl::ByteCountSent() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "ByteCountSent()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "ByteCountSent()");
- return _rtpSender.Bytes();
+ return rtp_sender_.Bytes();
}
int ModuleRtpRtcpImpl::CurrentSendFrequencyHz() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"CurrentSendFrequencyHz()");
- return _rtpSender.SendPayloadFrequency();
+ return rtp_sender_.SendPayloadFrequency();
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) {
if (sending) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"SetSendingStatus(sending)");
} else {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"SetSendingStatus(stopped)");
}
- if (_rtcpSender.Sending() != sending) {
- // sends RTCP BYE when going from true to false
- if (_rtcpSender.SetSendingStatus(sending) != 0) {
- WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id,
+ if (rtcp_sender_.Sending() != sending) {
+ // Sends RTCP BYE when going from true to false
+ if (rtcp_sender_.SetSendingStatus(sending) != 0) {
+ WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
"Failed to send RTCP BYE");
}
- _collisionDetected = false;
+ collision_detected_ = false;
- // generate a new timeStamp if true and not configured via API
- // generate a new SSRC for the next "call" if false
- _rtpSender.SetSendingStatus(sending);
+ // Generate a new time_stamp if true and not configured via API
+ // Generate a new SSRC for the next "call" if false
+ rtp_sender_.SetSendingStatus(sending);
if (sending) {
// Make sure the RTCP sender has the same timestamp offset.
- _rtcpSender.SetStartTimestamp(_rtpSender.StartTimestamp());
+ rtcp_sender_.SetStartTimestamp(rtp_sender_.StartTimestamp());
}
- // make sure that RTCP objects are aware of our SSRC (it could have changed
- // due to collision)
- WebRtc_UWord32 SSRC = _rtpSender.SSRC();
- _rtcpReceiver.SetSSRC(SSRC);
- _rtcpSender.SetSSRC(SSRC);
+ // Make sure that RTCP objects are aware of our SSRC (it could have changed
+ // Due to collision)
+ WebRtc_UWord32 SSRC = rtp_sender_.SSRC();
+ rtcp_receiver_.SetSSRC(SSRC);
+ rtcp_sender_.SetSSRC(SSRC);
return 0;
}
return 0;
}
bool ModuleRtpRtcpImpl::Sending() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "Sending()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "Sending()");
- return _rtcpSender.Sending();
+ return rtcp_sender_.Sending();
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) {
if (sending) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"SetSendingMediaStatus(sending)");
} else {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"SetSendingMediaStatus(stopped)");
}
- _rtpSender.SetSendingMediaStatus(sending);
+ rtp_sender_.SetSendingMediaStatus(sending);
return 0;
}
bool ModuleRtpRtcpImpl::SendingMedia() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "Sending()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "Sending()");
- const bool haveChildModules(_childModules.empty() ? false : true);
- if (!haveChildModules) {
- return _rtpSender.SendingMedia();
+ const bool have_child_modules(child_modules_.empty() ? false : true);
+ if (!have_child_modules) {
+ return rtp_sender_.SendingMedia();
}
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
- std::list<ModuleRtpRtcpImpl*>::const_iterator it = _childModules.begin();
- while (it != _childModules.end()) {
- RTPSender& rtpSender = (*it)->_rtpSender;
- if (rtpSender.SendingMedia()) {
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
+ std::list<ModuleRtpRtcpImpl*>::const_iterator it = child_modules_.begin();
+ while (it != child_modules_.end()) {
+ RTPSender& rtp_sender = (*it)->rtp_sender_;
+ if (rtp_sender.SendingMedia()) {
return true;
}
it++;
@@ -862,439 +857,430 @@
}
WebRtc_Word32 ModuleRtpRtcpImpl::SendOutgoingData(
- FrameType frameType,
- WebRtc_Word8 payloadType,
- WebRtc_UWord32 timeStamp,
+ FrameType frame_type,
+ WebRtc_Word8 payload_type,
+ WebRtc_UWord32 time_stamp,
int64_t capture_time_ms,
- const WebRtc_UWord8* payloadData,
- WebRtc_UWord32 payloadSize,
+ const WebRtc_UWord8* payload_data,
+ WebRtc_UWord32 payload_size,
const RTPFragmentationHeader* fragmentation,
- const RTPVideoHeader* rtpVideoHdr) {
+ const RTPVideoHeader* rtp_video_hdr) {
WEBRTC_TRACE(
- kTraceStream,
- kTraceRtpRtcp,
- _id,
- "SendOutgoingData(frameType:%d payloadType:%d timeStamp:%u size:%u)",
- frameType, payloadType, timeStamp, payloadSize);
+ kTraceStream,
+ kTraceRtpRtcp,
+ id_,
+ "SendOutgoingData(frame_type:%d payload_type:%d time_stamp:%u size:%u)",
+ frame_type, payload_type, time_stamp, payload_size);
- _rtcpSender.SetLastRtpTime(timeStamp, capture_time_ms);
+ rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms);
- const bool haveChildModules(_childModules.empty() ? false : true);
- if (!haveChildModules) {
- // Don't sent RTCP from default module
- if (_rtcpSender.TimeToSendRTCPReport(kVideoFrameKey == frameType)) {
- _rtcpSender.SendRTCP(kRtcpReport);
+ const bool have_child_modules(child_modules_.empty() ? false : true);
+ if (!have_child_modules) {
+ // Don't send RTCP from default module.
+ if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) {
+ rtcp_sender_.SendRTCP(kRtcpReport);
}
- return _rtpSender.SendOutgoingData(frameType,
- payloadType,
- timeStamp,
- capture_time_ms,
- payloadData,
- payloadSize,
- fragmentation,
- NULL,
- &(rtpVideoHdr->codecHeader));
+ return rtp_sender_.SendOutgoingData(frame_type,
+ payload_type,
+ time_stamp,
+ capture_time_ms,
+ payload_data,
+ payload_size,
+ fragmentation,
+ NULL,
+ &(rtp_video_hdr->codecHeader));
}
- WebRtc_Word32 retVal = -1;
- if (_simulcast) {
- if (rtpVideoHdr == NULL) {
+ WebRtc_Word32 ret_val = -1;
+ if (simulcast_) {
+ if (rtp_video_hdr == NULL) {
return -1;
}
int idx = 0;
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
- std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
- for (; idx < rtpVideoHdr->simulcastIdx; ++it) {
- if (it == _childModules.end()) {
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
+ std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
+ for (; idx < rtp_video_hdr->simulcastIdx; ++it) {
+ if (it == child_modules_.end()) {
return -1;
}
if ((*it)->SendingMedia()) {
++idx;
}
}
- for (; it != _childModules.end(); ++it) {
+ for (; it != child_modules_.end(); ++it) {
if ((*it)->SendingMedia()) {
break;
}
++idx;
}
- if (it == _childModules.end()) {
+ if (it == child_modules_.end()) {
return -1;
}
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SendOutgoingData(SimulcastIdx:%u size:%u, ssrc:0x%x)",
- idx, payloadSize, (*it)->_rtpSender.SSRC());
- return (*it)->SendOutgoingData(frameType,
- payloadType,
- timeStamp,
+ idx, payload_size, (*it)->rtp_sender_.SSRC());
+ return (*it)->SendOutgoingData(frame_type,
+ payload_type,
+ time_stamp,
capture_time_ms,
- payloadData,
- payloadSize,
+ payload_data,
+ payload_size,
fragmentation,
- rtpVideoHdr);
+ rtp_video_hdr);
} else {
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
- std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
- if (it != _childModules.end()) {
- retVal = (*it)->SendOutgoingData(frameType,
- payloadType,
- timeStamp,
+ std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
+ if (it != child_modules_.end()) {
+ ret_val = (*it)->SendOutgoingData(frame_type,
+ payload_type,
+ time_stamp,
capture_time_ms,
- payloadData,
- payloadSize,
+ payload_data,
+ payload_size,
fragmentation,
- rtpVideoHdr);
+ rtp_video_hdr);
it++;
}
- // send to all remaining "child" modules
- while (it != _childModules.end()) {
- retVal = (*it)->SendOutgoingData(frameType,
- payloadType,
- timeStamp,
- capture_time_ms,
- payloadData,
- payloadSize,
- fragmentation,
- rtpVideoHdr);
+ // Send to all remaining "child" modules
+ while (it != child_modules_.end()) {
+ ret_val = (*it)->SendOutgoingData(frame_type,
+ payload_type,
+ time_stamp,
+ capture_time_ms,
+ payload_data,
+ payload_size,
+ fragmentation,
+ rtp_video_hdr);
it++;
}
}
- return retVal;
+ return ret_val;
}
void ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
uint16_t sequence_number,
int64_t capture_time_ms) {
WEBRTC_TRACE(
- kTraceStream,
- kTraceRtpRtcp,
- _id,
- "TimeToSendPacket(ssrc:0x%x sequence_number:%u capture_time_ms:%ll)",
- ssrc, sequence_number, capture_time_ms);
+ kTraceStream,
+ kTraceRtpRtcp,
+ id_,
+ "TimeToSendPacket(ssrc:0x%x sequence_number:%u capture_time_ms:%ll)",
+ ssrc, sequence_number, capture_time_ms);
- if (_simulcast) {
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
- std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
- while (it != _childModules.end()) {
- if ((*it)->SendingMedia() && ssrc == (*it)->_rtpSender.SSRC()) {
- (*it)->_rtpSender.TimeToSendPacket(sequence_number, capture_time_ms);
+ if (simulcast_) {
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
+ std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
+ while (it != child_modules_.end()) {
+ if ((*it)->SendingMedia() && ssrc == (*it)->rtp_sender_.SSRC()) {
+ (*it)->rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms);
return;
}
it++;
}
} else {
- bool have_child_modules(_childModules.empty() ? false : true);
+ bool have_child_modules(child_modules_.empty() ? false : true);
if (!have_child_modules) {
// Don't send from default module.
- if (SendingMedia() && ssrc == _rtpSender.SSRC()) {
- _rtpSender.TimeToSendPacket(sequence_number, capture_time_ms);
+ if (SendingMedia() && ssrc == rtp_sender_.SSRC()) {
+ rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms);
}
}
}
}
WebRtc_UWord16 ModuleRtpRtcpImpl::MaxPayloadLength() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "MaxPayloadLength()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "MaxPayloadLength()");
- return _rtpSender.MaxPayloadLength();
+ return rtp_sender_.MaxPayloadLength();
}
WebRtc_UWord16 ModuleRtpRtcpImpl::MaxDataPayloadLength() const {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"MaxDataPayloadLength()");
- WebRtc_UWord16 minDataPayloadLength = IP_PACKET_SIZE - 28; // Assuming IP/UDP
+ // Assuming IP/UDP.
+ WebRtc_UWord16 min_data_payload_length = IP_PACKET_SIZE - 28;
- const bool defaultInstance(_childModules.empty() ? false : true);
- if (defaultInstance) {
- // for default we need to update all child modules too
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
+ const bool default_instance(child_modules_.empty() ? false : true);
+ if (default_instance) {
+ // For default we need to update all child modules too.
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
std::list<ModuleRtpRtcpImpl*>::const_iterator it =
- _childModules.begin();
- while (it != _childModules.end()) {
+ child_modules_.begin();
+ while (it != child_modules_.end()) {
RtpRtcp* module = *it;
if (module) {
- WebRtc_UWord16 dataPayloadLength =
+ WebRtc_UWord16 data_payload_length =
module->MaxDataPayloadLength();
- if (dataPayloadLength < minDataPayloadLength) {
- minDataPayloadLength = dataPayloadLength;
+ if (data_payload_length < min_data_payload_length) {
+ min_data_payload_length = data_payload_length;
}
}
it++;
}
}
- WebRtc_UWord16 dataPayloadLength = _rtpSender.MaxDataPayloadLength();
- if (dataPayloadLength < minDataPayloadLength) {
- minDataPayloadLength = dataPayloadLength;
+ WebRtc_UWord16 data_payload_length = rtp_sender_.MaxDataPayloadLength();
+ if (data_payload_length < min_data_payload_length) {
+ min_data_payload_length = data_payload_length;
}
- return minDataPayloadLength;
+ return min_data_payload_length;
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetTransportOverhead(
- const bool TCP,
- const bool IPV6,
- const WebRtc_UWord8 authenticationOverhead) {
+ const bool tcp,
+ const bool ipv6,
+ const WebRtc_UWord8 authentication_overhead) {
WEBRTC_TRACE(
kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "SetTransportOverhead(TCP:%d, IPV6:%d authenticationOverhead:%u)",
- TCP, IPV6, authenticationOverhead);
+ id_,
+ "SetTransportOverhead(TCP:%d, IPV6:%d authentication_overhead:%u)",
+ tcp, ipv6, authentication_overhead);
- WebRtc_UWord16 packetOverHead = 0;
- if (IPV6) {
- packetOverHead = 40;
+ WebRtc_UWord16 packet_overhead = 0;
+ if (ipv6) {
+ packet_overhead = 40;
} else {
- packetOverHead = 20;
+ packet_overhead = 20;
}
- if (TCP) {
- // TCP
- packetOverHead += 20;
+ if (tcp) {
+ // TCP.
+ packet_overhead += 20;
} else {
- // UDP
- packetOverHead += 8;
+ // UDP.
+ packet_overhead += 8;
}
- packetOverHead += authenticationOverhead;
+ packet_overhead += authentication_overhead;
- if (packetOverHead == _packetOverHead) {
- // ok same as before
+ if (packet_overhead == packet_overhead_) {
+ // Ok same as before.
return 0;
}
- // calc diff
- WebRtc_Word16 packetOverHeadDiff = packetOverHead - _packetOverHead;
+ // Calc diff.
+ WebRtc_Word16 packet_over_head_diff = packet_overhead - packet_overhead_;
- // store new
- _packetOverHead = packetOverHead;
+ // Store new.
+ packet_overhead_ = packet_overhead;
- WebRtc_UWord16 length = _rtpSender.MaxPayloadLength() - packetOverHeadDiff;
- return _rtpSender.SetMaxPayloadLength(length, _packetOverHead);
+ WebRtc_UWord16 length =
+ rtp_sender_.MaxPayloadLength() - packet_over_head_diff;
+ return rtp_sender_.SetMaxPayloadLength(length, packet_overhead_);
}
-WebRtc_Word32 ModuleRtpRtcpImpl::SetMaxTransferUnit(const WebRtc_UWord16 MTU) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SetMaxTransferUnit(%u)",
- MTU);
+WebRtc_Word32 ModuleRtpRtcpImpl::SetMaxTransferUnit(const WebRtc_UWord16 mtu) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetMaxTransferUnit(%u)",
+ mtu);
- if (MTU > IP_PACKET_SIZE) {
- WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id,
- "Invalid in argument to SetMaxTransferUnit(%u)", MTU);
+ if (mtu > IP_PACKET_SIZE) {
+ WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
+ "Invalid in argument to SetMaxTransferUnit(%u)", mtu);
return -1;
}
- return _rtpSender.SetMaxPayloadLength(MTU - _packetOverHead,
- _packetOverHead);
+ return rtp_sender_.SetMaxPayloadLength(mtu - packet_overhead_,
+ packet_overhead_);
}
-/*
-* RTCP
-*/
RTCPMethod ModuleRtpRtcpImpl::RTCP() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RTCP()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RTCP()");
- if (_rtcpSender.Status() != kRtcpOff) {
- return _rtcpReceiver.Status();
+ if (rtcp_sender_.Status() != kRtcpOff) {
+ return rtcp_receiver_.Status();
}
return kRtcpOff;
}
-// configure RTCP status i.e on/off
+// Configure RTCP status i.e on/off.
WebRtc_Word32 ModuleRtpRtcpImpl::SetRTCPStatus(const RTCPMethod method) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SetRTCPStatus(%d)",
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetRTCPStatus(%d)",
method);
- if (_rtcpSender.SetRTCPStatus(method) == 0) {
- return _rtcpReceiver.SetRTCPStatus(method);
+ if (rtcp_sender_.SetRTCPStatus(method) == 0) {
+ return rtcp_receiver_.SetRTCPStatus(method);
}
return -1;
}
-// only for internal test
-WebRtc_UWord32 ModuleRtpRtcpImpl::LastSendReport(WebRtc_UWord32& lastRTCPTime) {
- return _rtcpSender.LastSendReport(lastRTCPTime);
+// Only for internal test.
+WebRtc_UWord32 ModuleRtpRtcpImpl::LastSendReport(
+ WebRtc_UWord32& last_rtcptime) {
+ return rtcp_sender_.LastSendReport(last_rtcptime);
}
-WebRtc_Word32 ModuleRtpRtcpImpl::SetCNAME(const char cName[RTCP_CNAME_SIZE]) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SetCNAME(%s)", cName);
- return _rtcpSender.SetCNAME(cName);
+WebRtc_Word32 ModuleRtpRtcpImpl::SetCNAME(const char c_name[RTCP_CNAME_SIZE]) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetCNAME(%s)", c_name);
+ return rtcp_sender_.SetCNAME(c_name);
}
-WebRtc_Word32 ModuleRtpRtcpImpl::CNAME(char cName[RTCP_CNAME_SIZE]) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "CNAME()");
- return _rtcpSender.CNAME(cName);
+WebRtc_Word32 ModuleRtpRtcpImpl::CNAME(char c_name[RTCP_CNAME_SIZE]) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "CNAME()");
+ return rtcp_sender_.CNAME(c_name);
}
WebRtc_Word32 ModuleRtpRtcpImpl::AddMixedCNAME(
- const WebRtc_UWord32 SSRC,
- const char cName[RTCP_CNAME_SIZE]) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
- "AddMixedCNAME(SSRC:%u)", SSRC);
+ const WebRtc_UWord32 ssrc,
+ const char c_name[RTCP_CNAME_SIZE]) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
+ "AddMixedCNAME(SSRC:%u)", ssrc);
- return _rtcpSender.AddMixedCNAME(SSRC, cName);
+ return rtcp_sender_.AddMixedCNAME(ssrc, c_name);
}
-WebRtc_Word32 ModuleRtpRtcpImpl::RemoveMixedCNAME(const WebRtc_UWord32 SSRC) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
- "RemoveMixedCNAME(SSRC:%u)", SSRC);
- return _rtcpSender.RemoveMixedCNAME(SSRC);
+WebRtc_Word32 ModuleRtpRtcpImpl::RemoveMixedCNAME(const WebRtc_UWord32 ssrc) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
+ "RemoveMixedCNAME(SSRC:%u)", ssrc);
+ return rtcp_sender_.RemoveMixedCNAME(ssrc);
}
WebRtc_Word32 ModuleRtpRtcpImpl::RemoteCNAME(
- const WebRtc_UWord32 remoteSSRC,
- char cName[RTCP_CNAME_SIZE]) const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
- "RemoteCNAME(SSRC:%u)", remoteSSRC);
+ const WebRtc_UWord32 remote_ssrc,
+ char c_name[RTCP_CNAME_SIZE]) const {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
+ "RemoteCNAME(SSRC:%u)", remote_ssrc);
- return _rtcpReceiver.CNAME(remoteSSRC, cName);
+ return rtcp_receiver_.CNAME(remote_ssrc, c_name);
}
WebRtc_UWord16 ModuleRtpRtcpImpl::RemoteSequenceNumber() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RemoteSequenceNumber()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteSequenceNumber()");
- return _rtpReceiver.SequenceNumber();
+ return rtp_receiver_.SequenceNumber();
}
WebRtc_Word32 ModuleRtpRtcpImpl::RemoteNTP(
- WebRtc_UWord32* receivedNTPsecs,
- WebRtc_UWord32* receivedNTPfrac,
- WebRtc_UWord32* RTCPArrivalTimeSecs,
- WebRtc_UWord32* RTCPArrivalTimeFrac,
+ WebRtc_UWord32* received_ntpsecs,
+ WebRtc_UWord32* received_ntpfrac,
+ WebRtc_UWord32* rtcp_arrival_time_secs,
+ WebRtc_UWord32* rtcp_arrival_time_frac,
WebRtc_UWord32* rtcp_timestamp) const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RemoteNTP()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteNTP()");
- return _rtcpReceiver.NTP(receivedNTPsecs,
- receivedNTPfrac,
- RTCPArrivalTimeSecs,
- RTCPArrivalTimeFrac,
- rtcp_timestamp);
+ return rtcp_receiver_.NTP(received_ntpsecs,
+ received_ntpfrac,
+ rtcp_arrival_time_secs,
+ rtcp_arrival_time_frac,
+ rtcp_timestamp);
}
-// Get RoundTripTime
-WebRtc_Word32 ModuleRtpRtcpImpl::RTT(const WebRtc_UWord32 remoteSSRC,
- WebRtc_UWord16* RTT,
- WebRtc_UWord16* avgRTT,
- WebRtc_UWord16* minRTT,
- WebRtc_UWord16* maxRTT) const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RTT()");
+// Get RoundTripTime.
+WebRtc_Word32 ModuleRtpRtcpImpl::RTT(const WebRtc_UWord32 remote_ssrc,
+ WebRtc_UWord16* rtt,
+ WebRtc_UWord16* avg_rtt,
+ WebRtc_UWord16* min_rtt,
+ WebRtc_UWord16* max_rtt) const {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RTT()");
- return _rtcpReceiver.RTT(remoteSSRC, RTT, avgRTT, minRTT, maxRTT);
+ return rtcp_receiver_.RTT(remote_ssrc, rtt, avg_rtt, min_rtt, max_rtt);
}
-// Reset RoundTripTime statistics
-WebRtc_Word32
-ModuleRtpRtcpImpl::ResetRTT(const WebRtc_UWord32 remoteSSRC) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "ResetRTT(SSRC:%u)",
- remoteSSRC);
+// Reset RoundTripTime statistics.
+WebRtc_Word32 ModuleRtpRtcpImpl::ResetRTT(const WebRtc_UWord32 remote_ssrc) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "ResetRTT(SSRC:%u)",
+ remote_ssrc);
- return _rtcpReceiver.ResetRTT(remoteSSRC);
+ return rtcp_receiver_.ResetRTT(remote_ssrc);
}
void ModuleRtpRtcpImpl:: SetRtt(uint32_t rtt) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SetRtt(rtt: %u)", rtt);
- _rtcpReceiver.SetRTT(static_cast<WebRtc_UWord16>(rtt));
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetRtt(rtt: %u)", rtt);
+ rtcp_receiver_.SetRTT(static_cast<WebRtc_UWord16>(rtt));
}
-// Reset RTP statistics
-WebRtc_Word32
-ModuleRtpRtcpImpl::ResetStatisticsRTP() {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "ResetStatisticsRTP()");
+// Reset RTP statistics.
+WebRtc_Word32 ModuleRtpRtcpImpl::ResetStatisticsRTP() {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "ResetStatisticsRTP()");
- return _rtpReceiver.ResetStatistics();
+ return rtp_receiver_.ResetStatistics();
}
-// Reset RTP data counters for the receiving side
+// Reset RTP data counters for the receiving side.
WebRtc_Word32 ModuleRtpRtcpImpl::ResetReceiveDataCountersRTP() {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"ResetReceiveDataCountersRTP()");
- return _rtpReceiver.ResetDataCounters();
+ return rtp_receiver_.ResetDataCounters();
}
-// Reset RTP data counters for the sending side
+// Reset RTP data counters for the sending side.
WebRtc_Word32 ModuleRtpRtcpImpl::ResetSendDataCountersRTP() {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"ResetSendDataCountersRTP()");
- _rtpSender.ResetDataCounters();
+ rtp_sender_.ResetDataCounters();
return 0; // TODO(pwestin): change to void.
}
-// Force a send of an RTCP packet
-// normal SR and RR are triggered via the process function
-WebRtc_Word32 ModuleRtpRtcpImpl::SendRTCP(WebRtc_UWord32 rtcpPacketType) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SendRTCP(0x%x)",
- rtcpPacketType);
+// Force a send of an RTCP packet.
+// Normal SR and RR are triggered via the process function.
+WebRtc_Word32 ModuleRtpRtcpImpl::SendRTCP(WebRtc_UWord32 rtcp_packet_type) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SendRTCP(0x%x)",
+ rtcp_packet_type);
- return _rtcpSender.SendRTCP(rtcpPacketType);
+ return rtcp_sender_.SendRTCP(rtcp_packet_type);
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetRTCPApplicationSpecificData(
- const WebRtc_UWord8 subType,
+ const WebRtc_UWord8 sub_type,
const WebRtc_UWord32 name,
const WebRtc_UWord8* data,
const WebRtc_UWord16 length) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
- "SetRTCPApplicationSpecificData(subType:%d name:0x%x)", subType,
- name);
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
+ "SetRTCPApplicationSpecificData(sub_type:%d name:0x%x)",
+ sub_type, name);
- return _rtcpSender.SetApplicationSpecificData(subType, name, data, length);
+ return rtcp_sender_.SetApplicationSpecificData(sub_type, name, data, length);
}
-/*
-* (XR) VOIP metric
-*/
+// (XR) VOIP metric.
WebRtc_Word32 ModuleRtpRtcpImpl::SetRTCPVoIPMetrics(
- const RTCPVoIPMetric* VoIPMetric) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SetRTCPVoIPMetrics()");
+ const RTCPVoIPMetric* voip_metric) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetRTCPVoIPMetrics()");
- return _rtcpSender.SetRTCPVoIPMetrics(VoIPMetric);
+ return rtcp_sender_.SetRTCPVoIPMetrics(voip_metric);
}
-// our localy created statistics of the received RTP stream
+// Our locally created statistics of the received RTP stream.
WebRtc_Word32 ModuleRtpRtcpImpl::StatisticsRTP(
WebRtc_UWord8* fraction_lost,
WebRtc_UWord32* cum_lost,
WebRtc_UWord32* ext_max,
WebRtc_UWord32* jitter,
WebRtc_UWord32* max_jitter) const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "StatisticsRTP()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "StatisticsRTP()");
WebRtc_UWord32 jitter_transmission_time_offset = 0;
- WebRtc_Word32 retVal = _rtpReceiver.Statistics(
- fraction_lost,
- cum_lost,
- ext_max,
- jitter,
- max_jitter,
- &jitter_transmission_time_offset,
- (_rtcpSender.Status() == kRtcpOff));
- if (retVal == -1) {
- WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id,
- "StatisticsRTP() no statisitics availble");
+ WebRtc_Word32 ret_val = rtp_receiver_.Statistics(
+ fraction_lost, cum_lost, ext_max, jitter, max_jitter,
+ &jitter_transmission_time_offset, (rtcp_sender_.Status() == kRtcpOff));
+ if (ret_val == -1) {
+ WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
+ "StatisticsRTP() no statistics available");
}
- return retVal;
+ return ret_val;
}
WebRtc_Word32 ModuleRtpRtcpImpl::DataCountersRTP(
- WebRtc_UWord32* bytesSent,
- WebRtc_UWord32* packetsSent,
- WebRtc_UWord32* bytesReceived,
- WebRtc_UWord32* packetsReceived) const {
- WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, _id, "DataCountersRTP()");
+ WebRtc_UWord32* bytes_sent,
+ WebRtc_UWord32* packets_sent,
+ WebRtc_UWord32* bytes_received,
+ WebRtc_UWord32* packets_received) const {
+ WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_, "DataCountersRTP()");
- if (bytesSent) {
- *bytesSent = _rtpSender.Bytes();
+ if (bytes_sent) {
+ *bytes_sent = rtp_sender_.Bytes();
}
- if (packetsSent) {
- *packetsSent = _rtpSender.Packets();
+ if (packets_sent) {
+ *packets_sent = rtp_sender_.Packets();
}
- return _rtpReceiver.DataCounters(bytesReceived, packetsReceived);
+ return rtp_receiver_.DataCounters(bytes_received, packets_received);
}
WebRtc_Word32 ModuleRtpRtcpImpl::ReportBlockStatistics(
@@ -1303,178 +1289,171 @@
WebRtc_UWord32* ext_max,
WebRtc_UWord32* jitter,
WebRtc_UWord32* jitter_transmission_time_offset) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "ReportBlockStatistics()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "ReportBlockStatistics()");
WebRtc_Word32 missing = 0;
- WebRtc_Word32 ret = _rtpReceiver.Statistics(fraction_lost,
- cum_lost,
- ext_max,
- jitter,
- NULL,
- jitter_transmission_time_offset,
- &missing,
- true);
+ WebRtc_Word32 ret = rtp_receiver_.Statistics(fraction_lost,
+ cum_lost,
+ ext_max,
+ jitter,
+ NULL,
+ jitter_transmission_time_offset,
+ &missing,
+ true);
#ifdef MATLAB
- if (_plot1 == NULL) {
- _plot1 = eng.NewPlot(new MatlabPlot());
- _plot1->AddTimeLine(30, "b", "lost", _clock.GetTimeInMS());
+ if (plot1_ == NULL) {
+ plot1_ = eng.NewPlot(new MatlabPlot());
+ plot1_->AddTimeLine(30, "b", "lost", clock_.GetTimeInMS());
}
- _plot1->Append("lost", missing);
- _plot1->Plot();
+ plot1_->Append("lost", missing);
+ plot1_->Plot();
#endif
return ret;
}
-WebRtc_Word32 ModuleRtpRtcpImpl::RemoteRTCPStat(RTCPSenderInfo* senderInfo) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RemoteRTCPStat()");
+WebRtc_Word32 ModuleRtpRtcpImpl::RemoteRTCPStat(RTCPSenderInfo* sender_info) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteRTCPStat()");
- return _rtcpReceiver.SenderInfoReceived(senderInfo);
+ return rtcp_receiver_.SenderInfoReceived(sender_info);
}
-// received RTCP report
+// Received RTCP report.
WebRtc_Word32 ModuleRtpRtcpImpl::RemoteRTCPStat(
- std::vector<RTCPReportBlock>* receiveBlocks) const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RemoteRTCPStat()");
+ std::vector<RTCPReportBlock>* receive_blocks) const {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteRTCPStat()");
- return _rtcpReceiver.StatisticsReceived(receiveBlocks);
+ return rtcp_receiver_.StatisticsReceived(receive_blocks);
}
WebRtc_Word32 ModuleRtpRtcpImpl::AddRTCPReportBlock(
- const WebRtc_UWord32 SSRC,
- const RTCPReportBlock* reportBlock) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "AddRTCPReportBlock()");
+ const WebRtc_UWord32 ssrc,
+ const RTCPReportBlock* report_block) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "AddRTCPReportBlock()");
- return _rtcpSender.AddReportBlock(SSRC, reportBlock);
+ return rtcp_sender_.AddReportBlock(ssrc, report_block);
}
WebRtc_Word32 ModuleRtpRtcpImpl::RemoveRTCPReportBlock(
- const WebRtc_UWord32 SSRC) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RemoveRTCPReportBlock()");
+ const WebRtc_UWord32 ssrc) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoveRTCPReportBlock()");
- return _rtcpSender.RemoveReportBlock(SSRC);
+ return rtcp_sender_.RemoveReportBlock(ssrc);
}
-/*
- * (REMB) Receiver Estimated Max Bitrate
- */
+// (REMB) Receiver Estimated Max Bitrate.
bool ModuleRtpRtcpImpl::REMB() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "REMB()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "REMB()");
- return _rtcpSender.REMB();
+ return rtcp_sender_.REMB();
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetREMBStatus(const bool enable) {
if (enable) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetREMBStatus(enable)");
} else {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetREMBStatus(disable)");
}
- return _rtcpSender.SetREMBStatus(enable);
+ return rtcp_sender_.SetREMBStatus(enable);
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetREMBData(const WebRtc_UWord32 bitrate,
- const WebRtc_UWord8 numberOfSSRC,
- const WebRtc_UWord32* SSRC) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ const WebRtc_UWord8 number_of_ssrc,
+ const WebRtc_UWord32* ssrc) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"SetREMBData(bitrate:%d,?,?)", bitrate);
- return _rtcpSender.SetREMBData(bitrate, numberOfSSRC, SSRC);
+ return rtcp_sender_.SetREMBData(bitrate, number_of_ssrc, ssrc);
}
-/*
- * (IJ) Extended jitter report.
- */
+// (IJ) Extended jitter report.
bool ModuleRtpRtcpImpl::IJ() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "IJ()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "IJ()");
- return _rtcpSender.IJ();
+ return rtcp_sender_.IJ();
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetIJStatus(const bool enable) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetIJStatus(%s)", enable ? "true" : "false");
- return _rtcpSender.SetIJStatus(enable);
+ return rtcp_sender_.SetIJStatus(enable);
}
WebRtc_Word32 ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension(
- const RTPExtensionType type,
- const WebRtc_UWord8 id) {
- return _rtpSender.RegisterRtpHeaderExtension(type, id);
+ const RTPExtensionType type,
+ const WebRtc_UWord8 id) {
+ return rtp_sender_.RegisterRtpHeaderExtension(type, id);
}
WebRtc_Word32 ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension(
- const RTPExtensionType type) {
- return _rtpSender.DeregisterRtpHeaderExtension(type);
+ const RTPExtensionType type) {
+ return rtp_sender_.DeregisterRtpHeaderExtension(type);
}
WebRtc_Word32 ModuleRtpRtcpImpl::RegisterReceiveRtpHeaderExtension(
- const RTPExtensionType type,
- const WebRtc_UWord8 id) {
- return _rtpReceiver.RegisterRtpHeaderExtension(type, id);
+ const RTPExtensionType type,
+ const WebRtc_UWord8 id) {
+ return rtp_receiver_.RegisterRtpHeaderExtension(type, id);
}
WebRtc_Word32 ModuleRtpRtcpImpl::DeregisterReceiveRtpHeaderExtension(
const RTPExtensionType type) {
- return _rtpReceiver.DeregisterRtpHeaderExtension(type);
+ return rtp_receiver_.DeregisterRtpHeaderExtension(type);
}
-/*
-* (TMMBR) Temporary Max Media Bit Rate
-*/
+// (TMMBR) Temporary Max Media Bit Rate.
bool ModuleRtpRtcpImpl::TMMBR() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "TMMBR()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "TMMBR()");
- return _rtcpSender.TMMBR();
+ return rtcp_sender_.TMMBR();
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) {
if (enable) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"SetTMMBRStatus(enable)");
} else {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"SetTMMBRStatus(disable)");
}
- return _rtcpSender.SetTMMBRStatus(enable);
+ return rtcp_sender_.SetTMMBRStatus(enable);
}
-WebRtc_Word32 ModuleRtpRtcpImpl::SetTMMBN(const TMMBRSet* boundingSet) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SetTMMBN()");
+WebRtc_Word32 ModuleRtpRtcpImpl::SetTMMBN(const TMMBRSet* bounding_set) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetTMMBN()");
- WebRtc_UWord32 maxBitrateKbit = _rtpSender.MaxConfiguredBitrateVideo() / 1000;
- return _rtcpSender.SetTMMBN(boundingSet, maxBitrateKbit);
+ WebRtc_UWord32 max_bitrate_kbit =
+ rtp_sender_.MaxConfiguredBitrateVideo() / 1000;
+ return rtcp_sender_.SetTMMBN(bounding_set, max_bitrate_kbit);
}
-/*
-* (NACK) Negative acknowledgement
-*/
+// (NACK) Negative acknowledgment.
-// Is Negative acknowledgement requests on/off?
+// Is Negative acknowledgment requests on/off?
NACKMethod ModuleRtpRtcpImpl::NACK() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "NACK()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "NACK()");
- NACKMethod childMethod = kNackOff;
- const bool defaultInstance(_childModules.empty() ? false : true);
- if (defaultInstance) {
- // for default we need to check all child modules too
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
+ NACKMethod child_method = kNackOff;
+ const bool default_instance(child_modules_.empty() ? false : true);
+ if (default_instance) {
+ // For default we need to check all child modules too.
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
std::list<ModuleRtpRtcpImpl*>::const_iterator it =
- _childModules.begin();
- while (it != _childModules.end()) {
+ child_modules_.begin();
+ while (it != child_modules_.end()) {
RtpRtcp* module = *it;
if (module) {
NACKMethod nackMethod = module->NACK();
if (nackMethod != kNackOff) {
- childMethod = nackMethod;
+ child_method = nackMethod;
break;
}
}
@@ -1482,22 +1461,22 @@
}
}
- NACKMethod method = _nackMethod;
- if (childMethod != kNackOff) {
- method = childMethod;
+ NACKMethod method = nack_method_;
+ if (child_method != kNackOff) {
+ method = child_method;
}
return method;
}
-// Turn negative acknowledgement requests on/off
+// Turn negative acknowledgment requests on/off.
WebRtc_Word32 ModuleRtpRtcpImpl::SetNACKStatus(NACKMethod method) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetNACKStatus(%u)", method);
- _nackMethod = method;
- _rtpReceiver.SetNACKStatus(method);
+ nack_method_ = method;
+ rtp_receiver_.SetNACKStatus(method);
return 0;
}
@@ -1505,9 +1484,9 @@
int ModuleRtpRtcpImpl::SelectiveRetransmissions() const {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SelectiveRetransmissions()");
- return _rtpSender.SelectiveRetransmissions();
+ return rtp_sender_.SelectiveRetransmissions();
}
// Enable or disable a retransmission mode, which decides which packets will
@@ -1515,399 +1494,390 @@
int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetSelectiveRetransmissions(%u)",
settings);
- return _rtpSender.SetSelectiveRetransmissions(settings);
+ return rtp_sender_.SetSelectiveRetransmissions(settings);
}
-// Send a Negative acknowledgement packet
-WebRtc_Word32 ModuleRtpRtcpImpl::SendNACK(const WebRtc_UWord16* nackList,
+// Send a Negative acknowledgment packet.
+WebRtc_Word32 ModuleRtpRtcpImpl::SendNACK(const WebRtc_UWord16* nack_list,
const WebRtc_UWord16 size) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SendNACK(size:%u)", size);
if (size > NACK_PACKETS_MAX_SIZE) {
RequestKeyFrame();
return -1;
}
- WebRtc_UWord16 avgRTT = 0;
- _rtcpReceiver.RTT(_rtpReceiver.SSRC(), NULL, &avgRTT, NULL, NULL);
+ WebRtc_UWord16 avg_rtt = 0;
+ rtcp_receiver_.RTT(rtp_receiver_.SSRC(), NULL, &avg_rtt, NULL, NULL);
- WebRtc_Word64 waitTime = 5 + ((avgRTT * 3) >> 1); // 5 + RTT*1.5
- if (waitTime == 5) {
- waitTime = 100; // During startup we don't have an RTT
+ WebRtc_Word64 wait_time = 5 + ((avg_rtt * 3) >> 1); // 5 + RTT * 1.5.
+ if (wait_time == 5) {
+ wait_time = 100; // During startup we don't have an RTT.
}
- const WebRtc_Word64 now = _clock.GetTimeInMS();
- const WebRtc_Word64 timeLimit = now - waitTime;
+ const WebRtc_Word64 now = clock_.GetTimeInMS();
+ const WebRtc_Word64 time_limit = now - wait_time;
WebRtc_UWord16 nackLength = size;
- WebRtc_UWord16 startId = 0;
+ WebRtc_UWord16 start_id = 0;
- if (_nackLastTimeSent < timeLimit) {
- // send list
+ if (nack_last_time_sent_ < time_limit) {
+ // Send list.
} else {
- // only send if extended list
- if (_nackLastSeqNumberSent == nackList[size - 1]) {
- // last seq num is the same don't send list
+ // Only send if extended list.
+ if (nack_last_seq_number_sent_ == nack_list[size - 1]) {
+ // Last seq num is the same don't send list.
return 0;
} else {
- //
- // send NACK's only for new sequence numbers to avoid re-sending
- // of NACK's for sequences we have already sent
- //
- for (int i = 0; i < size; i++) {
- if (_nackLastSeqNumberSent == nackList[i]) {
- startId = i+1;
+ // Send NACKs only for new sequence numbers to avoid re-sending
+ // NACKs for sequences we have already sent.
+ for (int i = 0; i < size; ++i) {
+ if (nack_last_seq_number_sent_ == nack_list[i]) {
+ start_id = i + 1;
break;
}
}
- nackLength = size-startId;
+ nackLength = size - start_id;
}
}
- _nackLastTimeSent = now;
- _nackLastSeqNumberSent = nackList[size - 1];
+ nack_last_time_sent_ = now;
+ nack_last_seq_number_sent_ = nack_list[size - 1];
- switch (_nackMethod) {
+ switch (nack_method_) {
case kNackRtcp:
- return _rtcpSender.SendRTCP(kRtcpNack, nackLength, &nackList[startId]);
+ return rtcp_sender_.SendRTCP(kRtcpNack, nackLength, &nack_list[start_id]);
case kNackOff:
return -1;
};
return -1;
}
-// Store the sent packets, needed to answer to a Negative acknowledgement
-// requests
+// Store the sent packets, needed to answer to a Negative acknowledgment
+// requests.
WebRtc_Word32 ModuleRtpRtcpImpl::SetStorePacketsStatus(
- const bool enable,
- const WebRtc_UWord16 numberToStore) {
+ const bool enable,
+ const WebRtc_UWord16 number_to_store) {
if (enable) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
- "SetStorePacketsStatus(enable, numberToStore:%d)",
- numberToStore);
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
+ "SetStorePacketsStatus(enable, number_to_store:%d)",
+ number_to_store);
} else {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"SetStorePacketsStatus(disable)");
}
- _rtpSender.SetStorePacketsStatus(enable, numberToStore);
+ rtp_sender_.SetStorePacketsStatus(enable, number_to_store);
return 0; // TODO(pwestin): change to void.
}
-/*
-* Audio
-*/
-
-// Outband TelephoneEvent detection
+// Out-band TelephoneEvent detection.
WebRtc_Word32 ModuleRtpRtcpImpl::SetTelephoneEventStatus(
- const bool enable,
- const bool forwardToDecoder,
- const bool detectEndOfTone) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
- "SetTelephoneEventStatus(enable:%d forwardToDecoder:%d"
- " detectEndOfTone:%d)", enable, forwardToDecoder,
- detectEndOfTone);
+ const bool enable,
+ const bool forward_to_decoder,
+ const bool detect_end_of_tone) {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
+ "SetTelephoneEventStatus(enable:%d forward_to_decoder:%d"
+ " detect_end_of_tone:%d)", enable, forward_to_decoder,
+ detect_end_of_tone);
- return _rtpReceiver.GetAudioReceiver()->SetTelephoneEventStatus(
- enable, forwardToDecoder, detectEndOfTone);
+ return rtp_receiver_.GetAudioReceiver()->SetTelephoneEventStatus(
+ enable, forward_to_decoder, detect_end_of_tone);
}
-// Is outband TelephoneEvent turned on/off?
+// Is out-band TelephoneEvent turned on/off?
bool ModuleRtpRtcpImpl::TelephoneEvent() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "TelephoneEvent()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "TelephoneEvent()");
- return _rtpReceiver.GetAudioReceiver()->TelephoneEvent();
+ return rtp_receiver_.GetAudioReceiver()->TelephoneEvent();
}
-// Is forwarding of outband telephone events turned on/off?
+// Is forwarding of out-band telephone events turned on/off?
bool ModuleRtpRtcpImpl::TelephoneEventForwardToDecoder() const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"TelephoneEventForwardToDecoder()");
- return _rtpReceiver.GetAudioReceiver()->TelephoneEventForwardToDecoder();
+ return rtp_receiver_.GetAudioReceiver()->TelephoneEventForwardToDecoder();
}
-// Send a TelephoneEvent tone using RFC 2833 (4733)
+// Send a TelephoneEvent tone using RFC 2833 (4733).
WebRtc_Word32 ModuleRtpRtcpImpl::SendTelephoneEventOutband(
const WebRtc_UWord8 key,
- const WebRtc_UWord16 timeMs,
+ const WebRtc_UWord16 time_ms,
const WebRtc_UWord8 level) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
- "SendTelephoneEventOutband(key:%u, timeMs:%u, level:%u)", key,
- timeMs, level);
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
+ "SendTelephoneEventOutband(key:%u, time_ms:%u, level:%u)", key,
+ time_ms, level);
- return _rtpSender.SendTelephoneEvent(key, timeMs, level);
+ return rtp_sender_.SendTelephoneEvent(key, time_ms, level);
}
bool ModuleRtpRtcpImpl::SendTelephoneEventActive(
- WebRtc_Word8& telephoneEvent) const {
+ WebRtc_Word8& telephone_event) const {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SendTelephoneEventActive()");
- return _rtpSender.SendTelephoneEventActive(telephoneEvent);
+ return rtp_sender_.SendTelephoneEventActive(telephone_event);
}
-// 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 ModuleRtpRtcpImpl::SetAudioPacketSize(
- const WebRtc_UWord16 packetSizeSamples) {
+ const WebRtc_UWord16 packet_size_samples) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetAudioPacketSize(%u)",
- packetSizeSamples);
+ packet_size_samples);
- return _rtpSender.SetAudioPacketSize(packetSizeSamples);
+ return rtp_sender_.SetAudioPacketSize(packet_size_samples);
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetRTPAudioLevelIndicationStatus(
- const bool enable,
- const WebRtc_UWord8 ID) {
+ const bool enable,
+ const WebRtc_UWord8 id) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetRTPAudioLevelIndicationStatus(enable=%d, ID=%u)",
enable,
- ID);
+ id);
if (enable) {
- _rtpReceiver.RegisterRtpHeaderExtension(kRtpExtensionAudioLevel, ID);
+ rtp_receiver_.RegisterRtpHeaderExtension(kRtpExtensionAudioLevel, id);
} else {
- _rtpReceiver.DeregisterRtpHeaderExtension(kRtpExtensionAudioLevel);
+ rtp_receiver_.DeregisterRtpHeaderExtension(kRtpExtensionAudioLevel);
}
- return _rtpSender.SetAudioLevelIndicationStatus(enable, ID);
+ return rtp_sender_.SetAudioLevelIndicationStatus(enable, id);
}
WebRtc_Word32 ModuleRtpRtcpImpl::GetRTPAudioLevelIndicationStatus(
- bool& enable,
- WebRtc_UWord8& ID) const {
+ bool& enable,
+ WebRtc_UWord8& id) const {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"GetRTPAudioLevelIndicationStatus()");
- return _rtpSender.AudioLevelIndicationStatus(enable, ID);
+ return rtp_sender_.AudioLevelIndicationStatus(enable, id);
}
-WebRtc_Word32 ModuleRtpRtcpImpl::SetAudioLevel(const WebRtc_UWord8 level_dBov) {
+WebRtc_Word32 ModuleRtpRtcpImpl::SetAudioLevel(
+ const WebRtc_UWord8 level_d_bov) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "SetAudioLevel(level_dBov:%u)",
- level_dBov);
- return _rtpSender.SetAudioLevel(level_dBov);
+ id_,
+ "SetAudioLevel(level_d_bov:%u)",
+ level_d_bov);
+ return rtp_sender_.SetAudioLevel(level_d_bov);
}
-// Set payload type for Redundant Audio Data RFC 2198
+// Set payload type for Redundant Audio Data RFC 2198.
WebRtc_Word32 ModuleRtpRtcpImpl::SetSendREDPayloadType(
- const WebRtc_Word8 payloadType) {
+ const WebRtc_Word8 payload_type) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetSendREDPayloadType(%d)",
- payloadType);
+ payload_type);
- return _rtpSender.SetRED(payloadType);
+ return rtp_sender_.SetRED(payload_type);
}
-// Get payload type for Redundant Audio Data RFC 2198
+// Get payload type for Redundant Audio Data RFC 2198.
WebRtc_Word32 ModuleRtpRtcpImpl::SendREDPayloadType(
- WebRtc_Word8& payloadType) const {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "SendREDPayloadType()");
+ WebRtc_Word8& payload_type) const {
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SendREDPayloadType()");
- return _rtpSender.RED(payloadType);
+ return rtp_sender_.RED(payload_type);
}
-
-/*
-* Video
-*/
RtpVideoCodecTypes ModuleRtpRtcpImpl::ReceivedVideoCodec() const {
- return _rtpReceiver.VideoCodecType();
+ return rtp_receiver_.VideoCodecType();
}
RtpVideoCodecTypes ModuleRtpRtcpImpl::SendVideoCodec() const {
- return _rtpSender.VideoCodecType();
+ return rtp_sender_.VideoCodecType();
}
void ModuleRtpRtcpImpl::SetTargetSendBitrate(const uint32_t bitrate) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
"SetTargetSendBitrate: %ubit", bitrate);
- const bool haveChildModules(_childModules.empty() ? false : true);
- if (haveChildModules) {
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
- if (_simulcast) {
+ const bool have_child_modules(child_modules_.empty() ? false : true);
+ if (have_child_modules) {
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
+ if (simulcast_) {
uint32_t bitrate_remainder = bitrate;
- std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
- for (int i = 0; it != _childModules.end() &&
- i < _sendVideoCodec.numberOfSimulcastStreams; ++it) {
+ std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
+ for (int i = 0; it != child_modules_.end() &&
+ i < send_video_codec_.numberOfSimulcastStreams; ++it) {
if ((*it)->SendingMedia()) {
- RTPSender& rtpSender = (*it)->_rtpSender;
- if (_sendVideoCodec.simulcastStream[i].maxBitrate * 1000 >
+ RTPSender& rtp_sender = (*it)->rtp_sender_;
+ if (send_video_codec_.simulcastStream[i].maxBitrate * 1000 >
bitrate_remainder) {
- rtpSender.SetTargetSendBitrate(bitrate_remainder);
+ rtp_sender.SetTargetSendBitrate(bitrate_remainder);
bitrate_remainder = 0;
} else {
- rtpSender.SetTargetSendBitrate(
- _sendVideoCodec.simulcastStream[i].maxBitrate * 1000);
+ rtp_sender.SetTargetSendBitrate(
+ send_video_codec_.simulcastStream[i].maxBitrate * 1000);
bitrate_remainder -=
- _sendVideoCodec.simulcastStream[i].maxBitrate * 1000;
+ send_video_codec_.simulcastStream[i].maxBitrate * 1000;
}
++i;
}
}
} else {
- std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
- for (; it != _childModules.end(); ++it) {
- RTPSender& rtpSender = (*it)->_rtpSender;
- rtpSender.SetTargetSendBitrate(bitrate);
+ std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
+ for (; it != child_modules_.end(); ++it) {
+ RTPSender& rtp_sender = (*it)->rtp_sender_;
+ rtp_sender.SetTargetSendBitrate(bitrate);
}
}
} else {
- _rtpSender.SetTargetSendBitrate(bitrate);
+ rtp_sender_.SetTargetSendBitrate(bitrate);
}
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetKeyFrameRequestMethod(
- const KeyFrameRequestMethod method) {
+ const KeyFrameRequestMethod method) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetKeyFrameRequestMethod(method:%u)",
method);
- _keyFrameReqMethod = method;
+ key_frame_req_method_ = method;
return 0;
}
WebRtc_Word32 ModuleRtpRtcpImpl::RequestKeyFrame() {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"RequestKeyFrame");
- switch (_keyFrameReqMethod) {
+ switch (key_frame_req_method_) {
case kKeyFrameReqFirRtp:
- return _rtpSender.SendRTPIntraRequest();
+ return rtp_sender_.SendRTPIntraRequest();
case kKeyFrameReqPliRtcp:
- return _rtcpSender.SendRTCP(kRtcpPli);
+ return rtcp_sender_.SendRTCP(kRtcpPli);
case kKeyFrameReqFirRtcp:
- return _rtcpSender.SendRTCP(kRtcpFir);
+ return rtcp_sender_.SendRTCP(kRtcpFir);
}
return -1;
}
WebRtc_Word32 ModuleRtpRtcpImpl::SendRTCPSliceLossIndication(
- const WebRtc_UWord8 pictureID) {
+ const WebRtc_UWord8 picture_id) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
- "SendRTCPSliceLossIndication (pictureID:%d)",
- pictureID);
- return _rtcpSender.SendRTCP(kRtcpSli, 0, 0, false, pictureID);
+ id_,
+ "SendRTCPSliceLossIndication (picture_id:%d)",
+ picture_id);
+ return rtcp_sender_.SendRTCP(kRtcpSli, 0, 0, false, picture_id);
}
-WebRtc_Word32 ModuleRtpRtcpImpl::SetCameraDelay(const WebRtc_Word32 delayMS) {
+WebRtc_Word32 ModuleRtpRtcpImpl::SetCameraDelay(const WebRtc_Word32 delay_ms) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetCameraDelay(%d)",
- delayMS);
- const bool defaultInstance(_childModules.empty() ? false : true);
+ delay_ms);
+ const bool default_instance(child_modules_.empty() ? false : true);
- if (defaultInstance) {
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
+ if (default_instance) {
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
- std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
- while (it != _childModules.end()) {
+ std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
+ while (it != child_modules_.end()) {
RtpRtcp* module = *it;
if (module) {
- module->SetCameraDelay(delayMS);
+ module->SetCameraDelay(delay_ms);
}
it++;
}
return 0;
}
- return _rtcpSender.SetCameraDelay(delayMS);
+ return rtcp_sender_.SetCameraDelay(delay_ms);
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetGenericFECStatus(
- const bool enable,
- const WebRtc_UWord8 payloadTypeRED,
- const WebRtc_UWord8 payloadTypeFEC) {
+ const bool enable,
+ const WebRtc_UWord8 payload_type_red,
+ const WebRtc_UWord8 payload_type_fec) {
if (enable) {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetGenericFECStatus(enable, %u)",
- payloadTypeRED);
+ payload_type_red);
} else {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
- _id,
+ id_,
"SetGenericFECStatus(disable)");
}
- return _rtpSender.SetGenericFECStatus(enable,
- payloadTypeRED,
- payloadTypeFEC);
+ return rtp_sender_.SetGenericFECStatus(enable,
+ payload_type_red,
+ payload_type_fec);
}
WebRtc_Word32 ModuleRtpRtcpImpl::GenericFECStatus(
- bool& enable,
- WebRtc_UWord8& payloadTypeRED,
- WebRtc_UWord8& payloadTypeFEC) {
+ bool& enable,
+ WebRtc_UWord8& payload_type_red,
+ WebRtc_UWord8& payload_type_fec) {
- WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "GenericFECStatus()");
+ WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "GenericFECStatus()");
- bool childEnabled = false;
- const bool defaultInstance(_childModules.empty() ? false : true);
- if (defaultInstance) {
- // for default we need to check all child modules too
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
- std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
- while (it != _childModules.end()) {
+ bool child_enabled = false;
+ const bool default_instance(child_modules_.empty() ? false : true);
+ if (default_instance) {
+ // For default we need to check all child modules too.
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
+ std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
+ while (it != child_modules_.end()) {
RtpRtcp* module = *it;
if (module) {
bool enabled = false;
- WebRtc_UWord8 dummyPTypeRED = 0;
- WebRtc_UWord8 dummyPTypeFEC = 0;
+ WebRtc_UWord8 dummy_ptype_red = 0;
+ WebRtc_UWord8 dummy_ptype_fec = 0;
if (module->GenericFECStatus(enabled,
- dummyPTypeRED,
- dummyPTypeFEC) == 0 && enabled) {
- childEnabled = true;
+ dummy_ptype_red,
+ dummy_ptype_fec) == 0 && enabled) {
+ child_enabled = true;
break;
}
}
it++;
}
}
- WebRtc_Word32 retVal = _rtpSender.GenericFECStatus(enable,
- payloadTypeRED,
- payloadTypeFEC);
- if (childEnabled) {
- // returns true if enabled for any child module
- enable = childEnabled;
+ WebRtc_Word32 ret_val = rtp_sender_.GenericFECStatus(enable,
+ payload_type_red,
+ payload_type_fec);
+ if (child_enabled) {
+ // Returns true if enabled for any child module.
+ enable = child_enabled;
}
- return retVal;
+ return ret_val;
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetFecParameters(
const FecProtectionParams* delta_params,
const FecProtectionParams* key_params) {
- const bool defaultInstance(_childModules.empty() ? false : true);
- if (defaultInstance) {
- // for default we need to update all child modules too
- CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
+ const bool default_instance(child_modules_.empty() ? false : true);
+ if (default_instance) {
+ // For default we need to update all child modules too.
+ CriticalSectionScoped lock(critical_section_module_ptrs_.get());
- std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
- while (it != _childModules.end()) {
+ std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
+ while (it != child_modules_.end()) {
RtpRtcp* module = *it;
if (module) {
module->SetFecParameters(delta_params, key_params);
@@ -1916,92 +1886,90 @@
}
return 0;
}
- return _rtpSender.SetFecParameters(delta_params, key_params);
+ return rtp_sender_.SetFecParameters(delta_params, key_params);
}
-void ModuleRtpRtcpImpl::SetRemoteSSRC(const WebRtc_UWord32 SSRC) {
- // inform about the incoming SSRC
- _rtcpSender.SetRemoteSSRC(SSRC);
- _rtcpReceiver.SetRemoteSSRC(SSRC);
+void ModuleRtpRtcpImpl::SetRemoteSSRC(const WebRtc_UWord32 ssrc) {
+ // Inform about the incoming SSRC.
+ rtcp_sender_.SetRemoteSSRC(ssrc);
+ rtcp_receiver_.SetRemoteSSRC(ssrc);
- // check for a SSRC collision
- if (_rtpSender.SSRC() == SSRC && !_collisionDetected) {
- // if we detect a collision change the SSRC but only once
- _collisionDetected = true;
- WebRtc_UWord32 newSSRC = _rtpSender.GenerateNewSSRC();
- if (newSSRC == 0) {
- // configured via API ignore
+ // Check for a SSRC collision.
+ if (rtp_sender_.SSRC() == ssrc && !collision_detected_) {
+ // If we detect a collision change the SSRC but only once.
+ collision_detected_ = true;
+ WebRtc_UWord32 new_ssrc = rtp_sender_.GenerateNewSSRC();
+ if (new_ssrc == 0) {
+ // Configured via API ignore.
return;
}
- if (kRtcpOff != _rtcpSender.Status()) {
- // send RTCP bye on the current SSRC
- _rtcpSender.SendRTCP(kRtcpBye);
+ if (kRtcpOff != rtcp_sender_.Status()) {
+ // Send RTCP bye on the current SSRC.
+ rtcp_sender_.SendRTCP(kRtcpBye);
}
- // change local SSRC
-
- // inform all objects about the new SSRC
- _rtcpSender.SetSSRC(newSSRC);
- _rtcpReceiver.SetSSRC(newSSRC);
+ // Change local SSRC and inform all objects about the new SSRC.
+ rtcp_sender_.SetSSRC(new_ssrc);
+ rtcp_receiver_.SetSSRC(new_ssrc);
}
}
WebRtc_UWord32 ModuleRtpRtcpImpl::BitrateReceivedNow() const {
- return _rtpReceiver.BitrateNow();
+ return rtp_receiver_.BitrateNow();
}
-void ModuleRtpRtcpImpl::BitrateSent(WebRtc_UWord32* totalRate,
- WebRtc_UWord32* videoRate,
- WebRtc_UWord32* fecRate,
- WebRtc_UWord32* nackRate) const {
- const bool defaultInstance(_childModules.empty() ? false : true);
+void ModuleRtpRtcpImpl::BitrateSent(WebRtc_UWord32* total_rate,
+ WebRtc_UWord32* video_rate,
+ WebRtc_UWord32* fec_rate,
+ WebRtc_UWord32* nack_rate) const {
+ const bool default_instance(child_modules_.empty() ? false : true);
- if (defaultInstance) {
- // for default we need to update the send bitrate
- CriticalSectionScoped lock(_criticalSectionModulePtrsFeedback.get());
+ if (default_instance) {
+ // For default we need to update the send bitrate.
+ CriticalSectionScoped lock(critical_section_module_ptrs_feedback_.get());
- if (totalRate != NULL)
- *totalRate = 0;
- if (videoRate != NULL)
- *videoRate = 0;
- if (fecRate != NULL)
- *fecRate = 0;
- if (nackRate != NULL)
- *nackRate = 0;
+ if (total_rate != NULL)
+ *total_rate = 0;
+ if (video_rate != NULL)
+ *video_rate = 0;
+ if (fec_rate != NULL)
+ *fec_rate = 0;
+ if (nack_rate != NULL)
+ *nack_rate = 0;
std::list<ModuleRtpRtcpImpl*>::const_iterator it =
- _childModules.begin();
- while (it != _childModules.end()) {
+ child_modules_.begin();
+ while (it != child_modules_.end()) {
RtpRtcp* module = *it;
if (module) {
- WebRtc_UWord32 childTotalRate = 0;
- WebRtc_UWord32 childVideoRate = 0;
- WebRtc_UWord32 childFecRate = 0;
- WebRtc_UWord32 childNackRate = 0;
- module->BitrateSent(&childTotalRate,
- &childVideoRate,
- &childFecRate,
- &childNackRate);
- if (totalRate != NULL && childTotalRate > *totalRate)
- *totalRate = childTotalRate;
- if (videoRate != NULL && childVideoRate > *videoRate)
- *videoRate = childVideoRate;
- if (fecRate != NULL && childFecRate > *fecRate)
- *fecRate = childFecRate;
- if (nackRate != NULL && childNackRate > *nackRate)
- *nackRate = childNackRate;
+ WebRtc_UWord32 child_total_rate = 0;
+ WebRtc_UWord32 child_video_rate = 0;
+ WebRtc_UWord32 child_fec_rate = 0;
+ WebRtc_UWord32 child_nack_rate = 0;
+ module->BitrateSent(&child_total_rate,
+ &child_video_rate,
+ &child_fec_rate,
+ &child_nack_rate);
+ if (total_rate != NULL && child_total_rate > *total_rate)
+ *total_rate = child_total_rate;
+ if (video_rate != NULL && child_video_rate > *video_rate)
+ *video_rate = child_video_rate;
+ if (fec_rate != NULL && child_fec_rate > *fec_rate)
+ *fec_rate = child_fec_rate;
+ if (nack_rate != NULL && child_nack_rate > *nack_rate)
+ *nack_rate = child_nack_rate;
}
it++;
}
return;
}
- if (totalRate != NULL)
- *totalRate = _rtpSender.BitrateLast();
- if (videoRate != NULL)
- *videoRate = _rtpSender.VideoBitrateSent();
- if (fecRate != NULL)
- *fecRate = _rtpSender.FecOverheadRate();
- if (nackRate != NULL)
- *nackRate = _rtpSender.NackOverheadRate();
+ if (total_rate != NULL)
+ *total_rate = rtp_sender_.BitrateLast();
+ if (video_rate != NULL)
+ *video_rate = rtp_sender_.VideoBitrateSent();
+ if (fec_rate != NULL)
+ *fec_rate = rtp_sender_.FecOverheadRate();
+ if (nack_rate != NULL)
+ *nack_rate = rtp_sender_.NackOverheadRate();
}
int ModuleRtpRtcpImpl::EstimatedReceiveBandwidth(
@@ -2020,76 +1988,76 @@
return -1;
}
-// bad state of RTP receiver request a keyframe
+// Bad state of RTP receiver request a keyframe.
void ModuleRtpRtcpImpl::OnRequestIntraFrame() {
RequestKeyFrame();
}
void ModuleRtpRtcpImpl::OnRequestSendReport() {
- _rtcpSender.SendRTCP(kRtcpSr);
+ rtcp_sender_.SendRTCP(kRtcpSr);
}
WebRtc_Word32 ModuleRtpRtcpImpl::SendRTCPReferencePictureSelection(
- const WebRtc_UWord64 pictureID) {
- return _rtcpSender.SendRTCP(kRtcpRpsi, 0, 0, false, pictureID);
+ const WebRtc_UWord64 picture_id) {
+ return rtcp_sender_.SendRTCP(kRtcpRpsi, 0, 0, false, picture_id);
}
WebRtc_UWord32 ModuleRtpRtcpImpl::SendTimeOfSendReport(
- const WebRtc_UWord32 sendReport) {
- return _rtcpSender.SendTimeOfSendReport(sendReport);
+ const WebRtc_UWord32 send_report) {
+ return rtcp_sender_.SendTimeOfSendReport(send_report);
}
void ModuleRtpRtcpImpl::OnReceivedNACK(
- const WebRtc_UWord16 nackSequenceNumbersLength,
- const WebRtc_UWord16* nackSequenceNumbers) {
- if (!_rtpSender.StorePackets() ||
- nackSequenceNumbers == NULL ||
- nackSequenceNumbersLength == 0) {
+ const WebRtc_UWord16 nack_sequence_numbers_length,
+ const WebRtc_UWord16* nack_sequence_numbers) {
+ if (!rtp_sender_.StorePackets() ||
+ nack_sequence_numbers == NULL ||
+ nack_sequence_numbers_length == 0) {
return;
}
- WebRtc_UWord16 avgRTT = 0;
- _rtcpReceiver.RTT(_rtpReceiver.SSRC(), NULL, &avgRTT, NULL, NULL);
- _rtpSender.OnReceivedNACK(nackSequenceNumbersLength,
- nackSequenceNumbers,
- avgRTT);
+ WebRtc_UWord16 avg_rtt = 0;
+ rtcp_receiver_.RTT(rtp_receiver_.SSRC(), NULL, &avg_rtt, NULL, NULL);
+ rtp_sender_.OnReceivedNACK(nack_sequence_numbers_length,
+ nack_sequence_numbers,
+ avg_rtt);
}
WebRtc_Word32 ModuleRtpRtcpImpl::LastReceivedNTP(
- WebRtc_UWord32& RTCPArrivalTimeSecs, // when we received the last report
- WebRtc_UWord32& RTCPArrivalTimeFrac,
- WebRtc_UWord32& remoteSR) {
- // remote SR: NTP inside the last received (mid 16 bits from sec and frac)
- WebRtc_UWord32 NTPsecs = 0;
- WebRtc_UWord32 NTPfrac = 0;
+ WebRtc_UWord32& rtcp_arrival_time_secs, // When we got the last report.
+ WebRtc_UWord32& rtcp_arrival_time_frac,
+ WebRtc_UWord32& remote_sr) {
+ // Remote SR: NTP inside the last received (mid 16 bits from sec and frac).
+ WebRtc_UWord32 ntp_secs = 0;
+ WebRtc_UWord32 ntp_frac = 0;
- if (-1 == _rtcpReceiver.NTP(&NTPsecs,
- &NTPfrac,
- &RTCPArrivalTimeSecs,
- &RTCPArrivalTimeFrac,
- NULL)) {
+ if (-1 == rtcp_receiver_.NTP(&ntp_secs,
+ &ntp_frac,
+ &rtcp_arrival_time_secs,
+ &rtcp_arrival_time_frac,
+ NULL)) {
return -1;
}
- remoteSR = ((NTPsecs & 0x0000ffff) << 16) + ((NTPfrac & 0xffff0000) >> 16);
+ remote_sr = ((ntp_secs & 0x0000ffff) << 16) + ((ntp_frac & 0xffff0000) >> 16);
return 0;
}
bool ModuleRtpRtcpImpl::UpdateRTCPReceiveInformationTimers() {
- // if this returns true this channel has timed out
- // periodically check if this is true and if so call UpdateTMMBR
- return _rtcpReceiver.UpdateRTCPReceiveInformationTimers();
+ // If this returns true this channel has timed out.
+ // Periodically check if this is true and if so call UpdateTMMBR.
+ return rtcp_receiver_.UpdateRTCPReceiveInformationTimers();
}
-// called from RTCPsender
-WebRtc_Word32 ModuleRtpRtcpImpl::BoundingSet(bool& tmmbrOwner,
- TMMBRSet*& boundingSet) {
- return _rtcpReceiver.BoundingSet(tmmbrOwner, boundingSet);
+// Called from RTCPsender.
+WebRtc_Word32 ModuleRtpRtcpImpl::BoundingSet(bool& tmmbr_owner,
+ TMMBRSet*& bounding_set) {
+ return rtcp_receiver_.BoundingSet(tmmbr_owner, bounding_set);
}
int64_t ModuleRtpRtcpImpl::RtcpReportInterval() {
- if (_audio)
+ if (audio_)
return RTCP_INTERVAL_AUDIO_MS;
else
return RTCP_INTERVAL_VIDEO_MS;
}
-} // namespace webrtc
+} // Namespace webrtc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index c02ef51..c8f36a4 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -12,13 +12,14 @@
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_
#include <list>
+#include <vector>
-#include "modules/rtp_rtcp/interface/rtp_rtcp.h"
-#include "modules/rtp_rtcp/source/rtcp_receiver.h"
-#include "modules/rtp_rtcp/source/rtcp_sender.h"
-#include "modules/rtp_rtcp/source/rtp_receiver.h"
-#include "modules/rtp_rtcp/source/rtp_sender.h"
-#include "system_wrappers/interface/scoped_ptr.h"
+#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
+#include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
+#include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
+#include "webrtc/modules/rtp_rtcp/source/rtp_receiver.h"
+#include "webrtc/modules/rtp_rtcp/source/rtp_sender.h"
+#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#ifdef MATLAB
class MatlabPlot;
@@ -28,496 +29,501 @@
class ModuleRtpRtcpImpl : public RtpRtcp {
public:
- explicit ModuleRtpRtcpImpl(const RtpRtcp::Configuration& configuration);
+ explicit ModuleRtpRtcpImpl(const RtpRtcp::Configuration& configuration);
- virtual ~ModuleRtpRtcpImpl();
+ virtual ~ModuleRtpRtcpImpl();
- // returns the number of milliseconds until the module want a worker thread to call Process
- virtual WebRtc_Word32 TimeUntilNextProcess();
+ // Returns the number of milliseconds until the module want a worker thread to
+ // call Process.
+ virtual WebRtc_Word32 TimeUntilNextProcess();
- // Process any pending tasks such as timeouts
- virtual WebRtc_Word32 Process();
+ // Process any pending tasks such as timeouts.
+ virtual WebRtc_Word32 Process();
- /**
- * Receiver
- */
- // configure a timeout value
- virtual WebRtc_Word32 SetPacketTimeout(const WebRtc_UWord32 RTPtimeoutMS,
- const WebRtc_UWord32 RTCPtimeoutMS);
+ // Receiver part.
- // Set periodic dead or alive notification
- virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
- const bool enable,
- const WebRtc_UWord8 sampleTimeSeconds);
+ // Configure a timeout value.
+ virtual WebRtc_Word32 SetPacketTimeout(const WebRtc_UWord32 rtp_timeout_ms,
+ const WebRtc_UWord32 rtcp_timeout_ms);
- // Get periodic dead or alive notification status
- virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(
- bool &enable,
- WebRtc_UWord8 &sampleTimeSeconds);
+ // Set periodic dead or alive notification.
+ virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
+ const bool enable,
+ const WebRtc_UWord8 sample_time_seconds);
- virtual WebRtc_Word32 RegisterReceivePayload(const CodecInst& voiceCodec);
+ // Get periodic dead or alive notification status.
+ virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(
+ bool& enable,
+ WebRtc_UWord8& sample_time_seconds);
- virtual WebRtc_Word32 RegisterReceivePayload(const VideoCodec& videoCodec);
+ virtual WebRtc_Word32 RegisterReceivePayload(const CodecInst& voice_codec);
- virtual WebRtc_Word32 ReceivePayloadType(const CodecInst& voiceCodec,
- WebRtc_Word8* plType);
+ virtual WebRtc_Word32 RegisterReceivePayload(const VideoCodec& video_codec);
- virtual WebRtc_Word32 ReceivePayloadType(const VideoCodec& videoCodec,
- WebRtc_Word8* plType);
+ virtual WebRtc_Word32 ReceivePayloadType(const CodecInst& voice_codec,
+ WebRtc_Word8* pl_type);
- virtual WebRtc_Word32 DeRegisterReceivePayload(
- const WebRtc_Word8 payloadType);
+ virtual WebRtc_Word32 ReceivePayloadType(const VideoCodec& video_codec,
+ WebRtc_Word8* pl_type);
- // register RTP header extension
- virtual WebRtc_Word32 RegisterReceiveRtpHeaderExtension(
- const RTPExtensionType type,
- const WebRtc_UWord8 id);
+ virtual WebRtc_Word32 DeRegisterReceivePayload(
+ const WebRtc_Word8 payload_type);
- virtual WebRtc_Word32 DeregisterReceiveRtpHeaderExtension(
- const RTPExtensionType type);
+ // Register RTP header extension.
+ virtual WebRtc_Word32 RegisterReceiveRtpHeaderExtension(
+ const RTPExtensionType type,
+ const WebRtc_UWord8 id);
- // get the currently configured SSRC filter
- virtual WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowedSSRC) const;
+ virtual WebRtc_Word32 DeregisterReceiveRtpHeaderExtension(
+ const RTPExtensionType type);
- // set a SSRC to be used as a filter for incoming RTP streams
- virtual WebRtc_Word32 SetSSRCFilter(const bool enable, const WebRtc_UWord32 allowedSSRC);
+ // Get the currently configured SSRC filter.
+ virtual WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowed_ssrc) const;
- // Get last received remote timestamp
- virtual WebRtc_UWord32 RemoteTimestamp() const;
+ // Set a SSRC to be used as a filter for incoming RTP streams.
+ virtual WebRtc_Word32 SetSSRCFilter(const bool enable,
+ const WebRtc_UWord32 allowed_ssrc);
- // Get the local time of the last received remote timestamp.
- virtual int64_t LocalTimeOfRemoteTimeStamp() const;
+ // Get last received remote timestamp.
+ virtual WebRtc_UWord32 RemoteTimestamp() const;
- // Get the current estimated remote timestamp
- virtual WebRtc_Word32 EstimatedRemoteTimeStamp(WebRtc_UWord32& timestamp) const;
+ // Get the local time of the last received remote timestamp.
+ virtual int64_t LocalTimeOfRemoteTimeStamp() const;
- virtual WebRtc_UWord32 RemoteSSRC() const;
+ // Get the current estimated remote timestamp.
+ virtual WebRtc_Word32 EstimatedRemoteTimeStamp(
+ WebRtc_UWord32& timestamp) const;
- virtual WebRtc_Word32 RemoteCSRCs( WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const ;
+ virtual WebRtc_UWord32 RemoteSSRC() const;
- virtual WebRtc_Word32 SetRTXReceiveStatus(const bool enable,
- const WebRtc_UWord32 SSRC);
+ virtual WebRtc_Word32 RemoteCSRCs(
+ WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize]) const;
- virtual WebRtc_Word32 RTXReceiveStatus(bool* enable,
- WebRtc_UWord32* SSRC) const;
+ virtual WebRtc_Word32 SetRTXReceiveStatus(const bool enable,
+ const WebRtc_UWord32 ssrc);
- // called by the network module when we receive a packet
- virtual WebRtc_Word32 IncomingPacket( const WebRtc_UWord8* incomingPacket,
- const WebRtc_UWord16 packetLength);
+ virtual WebRtc_Word32 RTXReceiveStatus(bool* enable,
+ WebRtc_UWord32* ssrc) const;
- /**
- * Sender
- */
- virtual WebRtc_Word32 RegisterSendPayload(const CodecInst& voiceCodec);
+ // Called by the network module when we receive a packet.
+ virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incoming_packet,
+ const WebRtc_UWord16 packet_length);
- virtual WebRtc_Word32 RegisterSendPayload(const VideoCodec& videoCodec);
+ // Sender part.
- virtual WebRtc_Word32 DeRegisterSendPayload(const WebRtc_Word8 payloadType);
+ virtual WebRtc_Word32 RegisterSendPayload(const CodecInst& voice_codec);
- virtual WebRtc_Word8 SendPayloadType() const;
+ virtual WebRtc_Word32 RegisterSendPayload(const VideoCodec& video_codec);
- // register RTP header extension
- virtual WebRtc_Word32 RegisterSendRtpHeaderExtension(
- const RTPExtensionType type,
- const WebRtc_UWord8 id);
+ virtual WebRtc_Word32 DeRegisterSendPayload(const WebRtc_Word8 payload_type);
- virtual WebRtc_Word32 DeregisterSendRtpHeaderExtension(
- const RTPExtensionType type);
+ virtual WebRtc_Word8 SendPayloadType() const;
- // get start timestamp
- virtual WebRtc_UWord32 StartTimestamp() const;
+ // Register RTP header extension.
+ virtual WebRtc_Word32 RegisterSendRtpHeaderExtension(
+ const RTPExtensionType type,
+ const WebRtc_UWord8 id);
- // configure start timestamp, default is a random number
- virtual WebRtc_Word32 SetStartTimestamp(const WebRtc_UWord32 timestamp);
+ virtual WebRtc_Word32 DeregisterSendRtpHeaderExtension(
+ const RTPExtensionType type);
- virtual WebRtc_UWord16 SequenceNumber() const;
+ // Get start timestamp.
+ virtual WebRtc_UWord32 StartTimestamp() const;
- // Set SequenceNumber, default is a random number
- virtual WebRtc_Word32 SetSequenceNumber(const WebRtc_UWord16 seq);
+ // Configure start timestamp, default is a random number.
+ virtual WebRtc_Word32 SetStartTimestamp(const WebRtc_UWord32 timestamp);
- virtual WebRtc_UWord32 SSRC() const;
+ virtual WebRtc_UWord16 SequenceNumber() const;
- // configure SSRC, default is a random number
- virtual WebRtc_Word32 SetSSRC(const WebRtc_UWord32 ssrc);
+ // Set SequenceNumber, default is a random number.
+ virtual WebRtc_Word32 SetSequenceNumber(const WebRtc_UWord16 seq);
- virtual WebRtc_Word32 CSRCs( WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const ;
+ virtual WebRtc_UWord32 SSRC() const;
- virtual WebRtc_Word32 SetCSRCs( const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
- const WebRtc_UWord8 arrLength);
+ // Configure SSRC, default is a random number.
+ virtual WebRtc_Word32 SetSSRC(const WebRtc_UWord32 ssrc);
- virtual WebRtc_Word32 SetCSRCStatus(const bool include);
+ virtual WebRtc_Word32 CSRCs(WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize]) const;
- virtual WebRtc_UWord32 PacketCountSent() const;
+ virtual WebRtc_Word32 SetCSRCs(const WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize],
+ const WebRtc_UWord8 arr_length);
- virtual int CurrentSendFrequencyHz() const;
+ virtual WebRtc_Word32 SetCSRCStatus(const bool include);
- virtual WebRtc_UWord32 ByteCountSent() const;
+ virtual WebRtc_UWord32 PacketCountSent() const;
- virtual WebRtc_Word32 SetRTXSendStatus(const bool enable,
- const bool setSSRC,
- const WebRtc_UWord32 SSRC);
+ virtual int CurrentSendFrequencyHz() const;
- virtual WebRtc_Word32 RTXSendStatus(bool* enable,
- WebRtc_UWord32* SSRC) const;
+ virtual WebRtc_UWord32 ByteCountSent() const;
- // sends kRtcpByeCode when going from true to false
- virtual WebRtc_Word32 SetSendingStatus(const bool sending);
+ virtual WebRtc_Word32 SetRTXSendStatus(const bool enable,
+ const bool set_ssrc,
+ const WebRtc_UWord32 ssrc);
- virtual bool Sending() const;
+ virtual WebRtc_Word32 RTXSendStatus(bool* enable,
+ WebRtc_UWord32* ssrc) const;
- // Drops or relays media packets
- virtual WebRtc_Word32 SetSendingMediaStatus(const bool sending);
+ // Sends kRtcpByeCode when going from true to false.
+ virtual WebRtc_Word32 SetSendingStatus(const bool sending);
- virtual bool SendingMedia() const;
+ virtual bool Sending() const;
- // Used by the codec module to deliver a video or audio frame for packetization
- virtual 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 = NULL,
- const RTPVideoHeader* rtpVideoHdr = NULL);
+ // Drops or relays media packets.
+ virtual WebRtc_Word32 SetSendingMediaStatus(const bool sending);
- virtual void TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number,
- int64_t capture_time_ms);
- /*
- * RTCP
- */
+ virtual bool SendingMedia() const;
- // Get RTCP status
- virtual RTCPMethod RTCP() const;
+ // Used by the codec module to deliver a video or audio frame for
+ // packetization.
+ virtual WebRtc_Word32 SendOutgoingData(
+ const FrameType frame_type,
+ const WebRtc_Word8 payload_type,
+ const WebRtc_UWord32 time_stamp,
+ int64_t capture_time_ms,
+ const WebRtc_UWord8* payload_data,
+ const WebRtc_UWord32 payload_size,
+ const RTPFragmentationHeader* fragmentation = NULL,
+ const RTPVideoHeader* rtp_video_hdr = NULL);
- // configure RTCP status i.e on/off
- virtual WebRtc_Word32 SetRTCPStatus(const RTCPMethod method);
+ virtual void TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number,
+ int64_t capture_time_ms);
+ // RTCP part.
- // Set RTCP CName
- virtual WebRtc_Word32 SetCNAME(const char cName[RTCP_CNAME_SIZE]);
+ // Get RTCP status.
+ virtual RTCPMethod RTCP() const;
- // Get RTCP CName
- virtual WebRtc_Word32 CNAME(char cName[RTCP_CNAME_SIZE]);
+ // Configure RTCP status i.e on/off.
+ virtual WebRtc_Word32 SetRTCPStatus(const RTCPMethod method);
+
+ // Set RTCP CName.
+ virtual WebRtc_Word32 SetCNAME(const char c_name[RTCP_CNAME_SIZE]);
+
+ // Get RTCP CName.
+ virtual WebRtc_Word32 CNAME(char c_name[RTCP_CNAME_SIZE]);
+
+ // Get remote CName.
+ virtual WebRtc_Word32 RemoteCNAME(const WebRtc_UWord32 remote_ssrc,
+ char c_name[RTCP_CNAME_SIZE]) const;
- // Get remote CName
- virtual WebRtc_Word32 RemoteCNAME(const WebRtc_UWord32 remoteSSRC,
- char cName[RTCP_CNAME_SIZE]) const;
+ // Get remote NTP.
+ virtual WebRtc_Word32 RemoteNTP(WebRtc_UWord32* received_ntp_secs,
+ WebRtc_UWord32* received_ntp_frac,
+ WebRtc_UWord32* rtcp_arrival_time_secs,
+ WebRtc_UWord32* rtcp_arrival_time_frac,
+ WebRtc_UWord32* rtcp_timestamp) const;
- // Get remote NTP
- virtual WebRtc_Word32 RemoteNTP(WebRtc_UWord32 *ReceivedNTPsecs,
- WebRtc_UWord32 *ReceivedNTPfrac,
- WebRtc_UWord32 *RTCPArrivalTimeSecs,
- WebRtc_UWord32 *RTCPArrivalTimeFrac,
- WebRtc_UWord32 *rtcp_timestamp) const;
+ virtual WebRtc_Word32 AddMixedCNAME(const WebRtc_UWord32 ssrc,
+ const char c_name[RTCP_CNAME_SIZE]);
- virtual WebRtc_Word32 AddMixedCNAME(const WebRtc_UWord32 SSRC,
- const char cName[RTCP_CNAME_SIZE]);
+ virtual WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 ssrc);
- virtual WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 SSRC);
+ // Get RoundTripTime.
+ virtual WebRtc_Word32 RTT(const WebRtc_UWord32 remote_ssrc,
+ WebRtc_UWord16* rtt,
+ WebRtc_UWord16* avg_rtt,
+ WebRtc_UWord16* min_rtt,
+ WebRtc_UWord16* max_rtt) const;
- // Get RoundTripTime
- virtual WebRtc_Word32 RTT(const WebRtc_UWord32 remoteSSRC,
- WebRtc_UWord16* RTT,
- WebRtc_UWord16* avgRTT,
- WebRtc_UWord16* minRTT,
- WebRtc_UWord16* maxRTT) const;
+ // Reset RoundTripTime statistics.
+ virtual WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remote_ssrc);
- // Reset RoundTripTime statistics
- virtual WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC);
+ virtual void SetRtt(uint32_t rtt);
- virtual void SetRtt(uint32_t rtt);
+ // Force a send of an RTCP packet.
+ // Normal SR and RR are triggered via the process function.
+ virtual WebRtc_Word32 SendRTCP(WebRtc_UWord32 rtcp_packet_type = kRtcpReport);
- // Force a send of an RTCP packet
- // normal SR and RR are triggered via the process function
- virtual WebRtc_Word32 SendRTCP(WebRtc_UWord32 rtcpPacketType = kRtcpReport);
+ // Statistics of our locally created statistics of the received RTP stream.
+ virtual WebRtc_Word32 StatisticsRTP(WebRtc_UWord8* fraction_lost,
+ WebRtc_UWord32* cum_lost,
+ WebRtc_UWord32* ext_max,
+ WebRtc_UWord32* jitter,
+ WebRtc_UWord32* max_jitter = NULL) const;
- // statistics of our localy created statistics of the received RTP stream
- virtual WebRtc_Word32 StatisticsRTP(WebRtc_UWord8 *fraction_lost,
- WebRtc_UWord32 *cum_lost,
- WebRtc_UWord32 *ext_max,
- WebRtc_UWord32 *jitter,
- WebRtc_UWord32 *max_jitter = NULL) const;
+ // Reset RTP statistics.
+ virtual WebRtc_Word32 ResetStatisticsRTP();
- // Reset RTP statistics
- virtual WebRtc_Word32 ResetStatisticsRTP();
+ virtual WebRtc_Word32 ResetReceiveDataCountersRTP();
- virtual WebRtc_Word32 ResetReceiveDataCountersRTP();
+ virtual WebRtc_Word32 ResetSendDataCountersRTP();
- virtual WebRtc_Word32 ResetSendDataCountersRTP();
+ // Statistics of the amount of data sent and received.
+ virtual WebRtc_Word32 DataCountersRTP(WebRtc_UWord32* bytes_sent,
+ WebRtc_UWord32* packets_sent,
+ WebRtc_UWord32* bytes_received,
+ WebRtc_UWord32* packets_received) const;
- // statistics of the amount of data sent and received
- virtual WebRtc_Word32 DataCountersRTP(WebRtc_UWord32 *bytesSent,
- WebRtc_UWord32 *packetsSent,
- WebRtc_UWord32 *bytesReceived,
- WebRtc_UWord32 *packetsReceived) const;
+ virtual WebRtc_Word32 ReportBlockStatistics(
+ WebRtc_UWord8* fraction_lost,
+ WebRtc_UWord32* cum_lost,
+ WebRtc_UWord32* ext_max,
+ WebRtc_UWord32* jitter,
+ WebRtc_UWord32* jitter_transmission_time_offset);
- virtual WebRtc_Word32 ReportBlockStatistics(
- WebRtc_UWord8 *fraction_lost,
- WebRtc_UWord32 *cum_lost,
- WebRtc_UWord32 *ext_max,
- WebRtc_UWord32 *jitter,
- WebRtc_UWord32 *jitter_transmission_time_offset);
+ // Get received RTCP report, sender info.
+ virtual WebRtc_Word32 RemoteRTCPStat(RTCPSenderInfo* sender_info);
- // Get received RTCP report, sender info
- virtual WebRtc_Word32 RemoteRTCPStat( RTCPSenderInfo* senderInfo);
+ // Get received RTCP report, report block.
+ virtual WebRtc_Word32 RemoteRTCPStat(
+ std::vector<RTCPReportBlock>* receive_blocks) const;
- // Get received RTCP report, report block
- virtual WebRtc_Word32 RemoteRTCPStat(
- std::vector<RTCPReportBlock>* receiveBlocks) const;
+ // Set received RTCP report block.
+ virtual WebRtc_Word32 AddRTCPReportBlock(
+ const WebRtc_UWord32 ssrc, const RTCPReportBlock* receive_block);
- // Set received RTCP report block
- virtual WebRtc_Word32 AddRTCPReportBlock(const WebRtc_UWord32 SSRC,
- const RTCPReportBlock* receiveBlock);
+ virtual WebRtc_Word32 RemoveRTCPReportBlock(const WebRtc_UWord32 ssrc);
- virtual WebRtc_Word32 RemoveRTCPReportBlock(const WebRtc_UWord32 SSRC);
+ // (REMB) Receiver Estimated Max Bitrate.
+ virtual bool REMB() const;
- /*
- * (REMB) Receiver Estimated Max Bitrate
- */
- virtual bool REMB() const;
+ virtual WebRtc_Word32 SetREMBStatus(const bool enable);
- virtual WebRtc_Word32 SetREMBStatus(const bool enable);
+ virtual WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
+ const WebRtc_UWord8 number_of_ssrc,
+ const WebRtc_UWord32* ssrc);
- virtual WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
- const WebRtc_UWord8 numberOfSSRC,
- const WebRtc_UWord32* SSRC);
+ // (IJ) Extended jitter report.
+ virtual bool IJ() const;
- /*
- * (IJ) Extended jitter report.
- */
- virtual bool IJ() const;
+ virtual WebRtc_Word32 SetIJStatus(const bool enable);
- virtual WebRtc_Word32 SetIJStatus(const bool enable);
+ // (TMMBR) Temporary Max Media Bit Rate.
+ virtual bool TMMBR() const;
- /*
- * (TMMBR) Temporary Max Media Bit Rate
- */
- virtual bool TMMBR() const ;
+ virtual WebRtc_Word32 SetTMMBRStatus(const bool enable);
- virtual WebRtc_Word32 SetTMMBRStatus(const bool enable);
+ WebRtc_Word32 SetTMMBN(const TMMBRSet* bounding_set);
- WebRtc_Word32 SetTMMBN(const TMMBRSet* boundingSet);
+ virtual WebRtc_UWord16 MaxPayloadLength() const;
- virtual WebRtc_UWord16 MaxPayloadLength() const;
+ virtual WebRtc_UWord16 MaxDataPayloadLength() const;
- virtual WebRtc_UWord16 MaxDataPayloadLength() const;
+ virtual WebRtc_Word32 SetMaxTransferUnit(const WebRtc_UWord16 size);
- virtual WebRtc_Word32 SetMaxTransferUnit(const WebRtc_UWord16 size);
+ virtual WebRtc_Word32 SetTransportOverhead(
+ const bool tcp,
+ const bool ipv6,
+ const WebRtc_UWord8 authentication_overhead = 0);
- virtual WebRtc_Word32 SetTransportOverhead(const bool TCP,
- const bool IPV6,
- const WebRtc_UWord8 authenticationOverhead = 0);
+ // (NACK) Negative acknowledgment part.
- /*
- * (NACK) Negative acknowledgement
- */
+ // Is Negative acknowledgment requests on/off?
+ virtual NACKMethod NACK() const;
- // Is Negative acknowledgement requests on/off?
- virtual NACKMethod NACK() const ;
+ // Turn negative acknowledgment requests on/off.
+ virtual WebRtc_Word32 SetNACKStatus(const NACKMethod method);
- // Turn negative acknowledgement requests on/off
- virtual WebRtc_Word32 SetNACKStatus(const NACKMethod method);
+ virtual int SelectiveRetransmissions() const;
- virtual int SelectiveRetransmissions() const;
+ virtual int SetSelectiveRetransmissions(uint8_t settings);
- virtual int SetSelectiveRetransmissions(uint8_t settings);
+ // Send a Negative acknowledgment packet.
+ virtual WebRtc_Word32 SendNACK(const WebRtc_UWord16* nack_list,
+ const WebRtc_UWord16 size);
- // Send a Negative acknowledgement packet
- virtual WebRtc_Word32 SendNACK(const WebRtc_UWord16* nackList,
- const WebRtc_UWord16 size);
+ // Store the sent packets, needed to answer to a negative acknowledgment
+ // requests.
+ virtual WebRtc_Word32 SetStorePacketsStatus(
+ const bool enable, const WebRtc_UWord16 number_to_store = 200);
- // Store the sent packets, needed to answer to a Negative acknowledgement requests
- virtual WebRtc_Word32 SetStorePacketsStatus(const bool enable, const WebRtc_UWord16 numberToStore = 200);
+ // (APP) Application specific data.
+ virtual WebRtc_Word32 SetRTCPApplicationSpecificData(
+ const WebRtc_UWord8 sub_type,
+ const WebRtc_UWord32 name,
+ const WebRtc_UWord8* data,
+ const WebRtc_UWord16 length);
- /*
- * (APP) Application specific data
- */
- virtual WebRtc_Word32 SetRTCPApplicationSpecificData(const WebRtc_UWord8 subType,
- const WebRtc_UWord32 name,
- const WebRtc_UWord8* data,
- const WebRtc_UWord16 length);
- /*
- * (XR) VOIP metric
- */
- virtual WebRtc_Word32 SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric);
+ // (XR) VOIP metric.
+ virtual WebRtc_Word32 SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric);
- /*
- * Audio
- */
+ // Audio part.
- // set audio packet size, used to determine when it's time to send a DTMF packet in silence (CNG)
- virtual 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).
+ virtual WebRtc_Word32 SetAudioPacketSize(
+ const WebRtc_UWord16 packet_size_samples);
- // Outband DTMF detection
- virtual WebRtc_Word32 SetTelephoneEventStatus(const bool enable,
- const bool forwardToDecoder,
- const bool detectEndOfTone = false);
+ // Outband DTMF detection.
+ virtual WebRtc_Word32 SetTelephoneEventStatus(
+ const bool enable,
+ const bool forward_to_decoder,
+ const bool detect_end_of_tone = false);
- // Is outband DTMF turned on/off?
- virtual bool TelephoneEvent() const;
+ // Is outband DTMF turned on/off?
+ virtual bool TelephoneEvent() const;
- // Is forwarding of outband telephone events turned on/off?
- virtual bool TelephoneEventForwardToDecoder() const;
+ // Is forwarding of outband telephone events turned on/off?
+ virtual bool TelephoneEventForwardToDecoder() const;
- virtual bool SendTelephoneEventActive(WebRtc_Word8& telephoneEvent) const;
+ virtual bool SendTelephoneEventActive(WebRtc_Word8& telephone_event) const;
- // Send a TelephoneEvent tone using RFC 2833 (4733)
- virtual WebRtc_Word32 SendTelephoneEventOutband(const WebRtc_UWord8 key,
+ // Send a TelephoneEvent tone using RFC 2833 (4733).
+ virtual WebRtc_Word32 SendTelephoneEventOutband(const WebRtc_UWord8 key,
const WebRtc_UWord16 time_ms,
const WebRtc_UWord8 level);
- // Set payload type for Redundant Audio Data RFC 2198
- virtual WebRtc_Word32 SetSendREDPayloadType(const WebRtc_Word8 payloadType);
+ // Set payload type for Redundant Audio Data RFC 2198.
+ virtual WebRtc_Word32 SetSendREDPayloadType(const WebRtc_Word8 payload_type);
- // Get payload type for Redundant Audio Data RFC 2198
- virtual WebRtc_Word32 SendREDPayloadType(WebRtc_Word8& payloadType) const;
+ // Get payload type for Redundant Audio Data RFC 2198.
+ virtual WebRtc_Word32 SendREDPayloadType(WebRtc_Word8& payload_type) const;
- // Set status and ID for header-extension-for-audio-level-indication.
- virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(const bool enable,
- const WebRtc_UWord8 ID);
+ // Set status and id for header-extension-for-audio-level-indication.
+ virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(
+ const bool enable, const WebRtc_UWord8 id);
- // Get status and ID for header-extension-for-audio-level-indication.
- virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(bool& enable,
- WebRtc_UWord8& ID) const;
+ // Get status and id for header-extension-for-audio-level-indication.
+ virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(
+ bool& enable, WebRtc_UWord8& id) const;
- // Store the audio level in dBov for header-extension-for-audio-level-indication.
- virtual WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov);
+ // Store the audio level in d_bov for header-extension-for-audio-level-
+ // indication.
+ virtual WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_d_bov);
- /*
- * Video
- */
- virtual RtpVideoCodecTypes ReceivedVideoCodec() const;
+ // Video part.
- virtual RtpVideoCodecTypes SendVideoCodec() const;
+ virtual RtpVideoCodecTypes ReceivedVideoCodec() const;
- virtual WebRtc_Word32 SendRTCPSliceLossIndication(const WebRtc_UWord8 pictureID);
+ virtual RtpVideoCodecTypes SendVideoCodec() const;
- // Set method for requestion a new key frame
- virtual WebRtc_Word32 SetKeyFrameRequestMethod(const KeyFrameRequestMethod method);
+ virtual WebRtc_Word32 SendRTCPSliceLossIndication(
+ const WebRtc_UWord8 picture_id);
- // send a request for a keyframe
- virtual WebRtc_Word32 RequestKeyFrame();
+ // Set method for requestion a new key frame.
+ virtual WebRtc_Word32 SetKeyFrameRequestMethod(
+ const KeyFrameRequestMethod method);
- virtual WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delayMS);
+ // Send a request for a keyframe.
+ virtual WebRtc_Word32 RequestKeyFrame();
- virtual void SetTargetSendBitrate(const WebRtc_UWord32 bitrate);
+ virtual WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delay_ms);
- virtual WebRtc_Word32 SetGenericFECStatus(const bool enable,
- const WebRtc_UWord8 payloadTypeRED,
- const WebRtc_UWord8 payloadTypeFEC);
+ virtual void SetTargetSendBitrate(const WebRtc_UWord32 bitrate);
- virtual WebRtc_Word32 GenericFECStatus(bool& enable,
- WebRtc_UWord8& payloadTypeRED,
- WebRtc_UWord8& payloadTypeFEC);
+ virtual WebRtc_Word32 SetGenericFECStatus(
+ const bool enable,
+ const WebRtc_UWord8 payload_type_red,
+ const WebRtc_UWord8 payload_type_fec);
- virtual WebRtc_Word32 SetFecParameters(
- const FecProtectionParams* delta_params,
- const FecProtectionParams* key_params);
+ virtual WebRtc_Word32 GenericFECStatus(
+ bool& enable,
+ WebRtc_UWord8& payload_type_red,
+ WebRtc_UWord8& payload_type_fec);
- virtual WebRtc_Word32 LastReceivedNTP(WebRtc_UWord32& NTPsecs,
- WebRtc_UWord32& NTPfrac,
- WebRtc_UWord32& remoteSR);
+ virtual WebRtc_Word32 SetFecParameters(
+ const FecProtectionParams* delta_params,
+ const FecProtectionParams* key_params);
- virtual WebRtc_Word32 BoundingSet(bool &tmmbrOwner,
- TMMBRSet*& boundingSetRec);
+ virtual WebRtc_Word32 LastReceivedNTP(WebRtc_UWord32& NTPsecs,
+ WebRtc_UWord32& NTPfrac,
+ WebRtc_UWord32& remote_sr);
- virtual void BitrateSent(WebRtc_UWord32* totalRate,
- WebRtc_UWord32* videoRate,
- WebRtc_UWord32* fecRate,
- WebRtc_UWord32* nackRate) const;
+ virtual WebRtc_Word32 BoundingSet(bool& tmmbr_owner,
+ TMMBRSet*& bounding_set_rec);
- virtual int EstimatedReceiveBandwidth(
- WebRtc_UWord32* available_bandwidth) const;
+ virtual void BitrateSent(WebRtc_UWord32* total_rate,
+ WebRtc_UWord32* video_rate,
+ WebRtc_UWord32* fec_rate,
+ WebRtc_UWord32* nackRate) const;
- virtual void SetRemoteSSRC(const WebRtc_UWord32 SSRC);
+ virtual int EstimatedReceiveBandwidth(
+ WebRtc_UWord32* available_bandwidth) const;
- virtual WebRtc_UWord32 SendTimeOfSendReport(const WebRtc_UWord32 sendReport);
+ virtual void SetRemoteSSRC(const WebRtc_UWord32 ssrc);
- // good state of RTP receiver inform sender
- virtual WebRtc_Word32 SendRTCPReferencePictureSelection(const WebRtc_UWord64 pictureID);
+ virtual WebRtc_UWord32 SendTimeOfSendReport(const WebRtc_UWord32 send_report);
- void OnReceivedTMMBR();
+ // Good state of RTP receiver inform sender.
+ virtual WebRtc_Word32 SendRTCPReferencePictureSelection(
+ const WebRtc_UWord64 picture_id);
- // bad state of RTP receiver request a keyframe
- void OnRequestIntraFrame();
+ void OnReceivedTMMBR();
- // received a request for a new SLI
- void OnReceivedSliceLossIndication(const WebRtc_UWord8 pictureID);
+ // Bad state of RTP receiver request a keyframe.
+ void OnRequestIntraFrame();
- // received a new refereence frame
- void OnReceivedReferencePictureSelectionIndication(
- const WebRtc_UWord64 pitureID);
+ // Received a request for a new SLI.
+ void OnReceivedSliceLossIndication(const WebRtc_UWord8 picture_id);
- void OnReceivedNACK(const WebRtc_UWord16 nackSequenceNumbersLength,
- const WebRtc_UWord16* nackSequenceNumbers);
+ // Received a new reference frame.
+ void OnReceivedReferencePictureSelectionIndication(
+ const WebRtc_UWord64 picture_id);
- void OnRequestSendReport();
+ void OnReceivedNACK(const WebRtc_UWord16 nack_sequence_numbers_length,
+ const WebRtc_UWord16* nack_sequence_numbers);
- // Following function is only called when constructing the object so no
- // need to worry about data race.
- void OwnsClock() { _owns_clock = true; }
+ void OnRequestSendReport();
-protected:
- void RegisterChildModule(RtpRtcp* module);
+ // Following function is only called when constructing the object so no
+ // need to worry about data race.
+ void OwnsClock() {
+ owns_clock_ = true;
+ }
- void DeRegisterChildModule(RtpRtcp* module);
+ protected:
+ void RegisterChildModule(RtpRtcp* module);
- bool UpdateRTCPReceiveInformationTimers();
+ void DeRegisterChildModule(RtpRtcp* module);
- void ProcessDeadOrAliveTimer();
+ bool UpdateRTCPReceiveInformationTimers();
- WebRtc_UWord32 BitrateReceivedNow() const;
+ void ProcessDeadOrAliveTimer();
- // Get remote SequenceNumber
- WebRtc_UWord16 RemoteSequenceNumber() const;
+ WebRtc_UWord32 BitrateReceivedNow() const;
- // only for internal testing
- WebRtc_UWord32 LastSendReport(WebRtc_UWord32& lastRTCPTime);
+ // Get remote SequenceNumber.
+ WebRtc_UWord16 RemoteSequenceNumber() const;
- RTPSender _rtpSender;
- RTPReceiver _rtpReceiver;
+ // Only for internal testing.
+ WebRtc_UWord32 LastSendReport(WebRtc_UWord32& last_rtcptime);
- RTCPSender _rtcpSender;
- RTCPReceiver _rtcpReceiver;
+ RTPSender rtp_sender_;
+ RTPReceiver rtp_receiver_;
- bool _owns_clock;
- RtpRtcpClock& _clock;
-private:
- int64_t RtcpReportInterval();
+ RTCPSender rtcp_sender_;
+ RTCPReceiver rtcp_receiver_;
- WebRtc_Word32 _id;
- const bool _audio;
- bool _collisionDetected;
- WebRtc_Word64 _lastProcessTime;
- WebRtc_Word64 _lastBitrateProcessTime;
- WebRtc_Word64 _lastPacketTimeoutProcessTime;
- WebRtc_UWord16 _packetOverHead;
+ bool owns_clock_;
+ RtpRtcpClock& clock_;
- scoped_ptr<CriticalSectionWrapper> _criticalSectionModulePtrs;
- scoped_ptr<CriticalSectionWrapper> _criticalSectionModulePtrsFeedback;
- ModuleRtpRtcpImpl* _defaultModule;
- std::list<ModuleRtpRtcpImpl*> _childModules;
+ private:
+ int64_t RtcpReportInterval();
- // Dead or alive
- bool _deadOrAliveActive;
- WebRtc_UWord32 _deadOrAliveTimeoutMS;
- WebRtc_Word64 _deadOrAliveLastTimer;
- // send side
- NACKMethod _nackMethod;
- WebRtc_UWord32 _nackLastTimeSent;
- WebRtc_UWord16 _nackLastSeqNumberSent;
+ WebRtc_Word32 id_;
+ const bool audio_;
+ bool collision_detected_;
+ WebRtc_Word64 last_process_time_;
+ WebRtc_Word64 last_bitrate_process_time_;
+ WebRtc_Word64 last_packet_timeout_process_time_;
+ WebRtc_UWord16 packet_overhead_;
- bool _simulcast;
- VideoCodec _sendVideoCodec;
- KeyFrameRequestMethod _keyFrameReqMethod;
+ scoped_ptr<CriticalSectionWrapper> critical_section_module_ptrs_;
+ scoped_ptr<CriticalSectionWrapper> critical_section_module_ptrs_feedback_;
+ ModuleRtpRtcpImpl* default_module_;
+ std::list<ModuleRtpRtcpImpl*> child_modules_;
- RemoteBitrateEstimator* remote_bitrate_;
+ // Dead or alive.
+ bool dead_or_alive_active_;
+ WebRtc_UWord32 dead_or_alive_timeout_ms_;
+ WebRtc_Word64 dead_or_alive_last_timer_;
+ // Send side
+ NACKMethod nack_method_;
+ WebRtc_UWord32 nack_last_time_sent_;
+ WebRtc_UWord16 nack_last_seq_number_sent_;
- RtcpRttObserver* rtt_observer_;
+ bool simulcast_;
+ VideoCodec send_video_codec_;
+ KeyFrameRequestMethod key_frame_req_method_;
+
+ RemoteBitrateEstimator* remote_bitrate_;
+
+ RtcpRttObserver* rtt_observer_;
#ifdef MATLAB
- MatlabPlot* _plot1;
+ MatlabPlot* plot1_;
#endif
};
-} // namespace webrtc
-#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_
+
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_