RTP Receiver is now only deals with a receiver strategy. Cleaned up dependencies.
BUG= TESTED=vie/voe_auto_test, rtp_rtcp_unittests Review URL: https://webrtc-codereview.appspot.com/1058004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3397 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -17,7 +17,7 @@ namespace webrtc {
|
||||
|
||||
class MockRTPReceiverVideo : public RTPReceiverVideo {
|
||||
public:
|
||||
MockRTPReceiverVideo() : RTPReceiverVideo(0, NULL, NULL, NULL) {}
|
||||
MockRTPReceiverVideo() : RTPReceiverVideo(0, NULL, NULL) {}
|
||||
MOCK_METHOD1(ChangeUniqueId,
|
||||
void(const WebRtc_Word32 id));
|
||||
MOCK_METHOD3(ReceiveRecoveredPacketCallback,
|
||||
|
@@ -32,22 +32,16 @@ using ModuleRTPUtility::StringCompare;
|
||||
using ModuleRTPUtility::VideoPayload;
|
||||
|
||||
RTPReceiver::RTPReceiver(const WebRtc_Word32 id,
|
||||
const bool audio,
|
||||
Clock* clock,
|
||||
ModuleRtpRtcpImpl* owner,
|
||||
RtpAudioFeedback* incoming_audio_messages_callback,
|
||||
RtpData* incoming_payload_callback,
|
||||
RtpFeedback* incoming_messages_callback)
|
||||
RtpFeedback* incoming_messages_callback,
|
||||
RTPReceiverStrategy* rtp_media_receiver,
|
||||
RTPPayloadRegistry* rtp_payload_registry)
|
||||
: Bitrate(clock),
|
||||
rtp_payload_registry_(id),
|
||||
// TODO(phoglund): Remove hacks requiring direct access to the
|
||||
// audio receiver and only instantiate one of these directly into the
|
||||
// rtp_media_receiver_ field. Right now an audio receiver carries around a
|
||||
// video handler and vice versa, which doesn't make sense.
|
||||
rtp_receiver_audio_(new RTPReceiverAudio(
|
||||
id, incoming_payload_callback, incoming_audio_messages_callback)),
|
||||
rtp_receiver_video_(new RTPReceiverVideo(
|
||||
id, &rtp_payload_registry_, incoming_payload_callback, owner)),
|
||||
rtp_payload_registry_(rtp_payload_registry),
|
||||
rtp_media_receiver_(rtp_media_receiver),
|
||||
id_(id),
|
||||
rtp_rtcp_(*owner),
|
||||
cb_rtp_feedback_(incoming_messages_callback),
|
||||
@@ -103,15 +97,6 @@ RTPReceiver::RTPReceiver(const WebRtc_Word32 id,
|
||||
incoming_messages_callback &&
|
||||
incoming_payload_callback);
|
||||
|
||||
if (audio) {
|
||||
rtp_media_receiver_ = rtp_receiver_audio_.get();
|
||||
} else {
|
||||
rtp_media_receiver_ = rtp_receiver_video_.get();
|
||||
}
|
||||
// TODO(phoglund): Get rid of this silly circular dependency between the
|
||||
// payload manager and the video RTP receiver.
|
||||
rtp_payload_registry_.set_rtp_media_receiver(rtp_media_receiver_);
|
||||
|
||||
memset(current_remote_csrc_, 0, sizeof(current_remote_csrc_));
|
||||
memset(current_remote_energy_, 0, sizeof(current_remote_energy_));
|
||||
|
||||
@@ -140,11 +125,11 @@ WebRtc_UWord32 RTPReceiver::MaxConfiguredBitrate() const {
|
||||
}
|
||||
|
||||
bool RTPReceiver::REDPayloadType(const WebRtc_Word8 payload_type) const {
|
||||
return rtp_payload_registry_.red_payload_type() == payload_type;
|
||||
return rtp_payload_registry_->red_payload_type() == payload_type;
|
||||
}
|
||||
|
||||
WebRtc_Word8 RTPReceiver::REDPayloadType() const {
|
||||
return rtp_payload_registry_.red_payload_type();
|
||||
return rtp_payload_registry_->red_payload_type();
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPReceiver::SetPacketTimeout(const WebRtc_UWord32 timeout_ms) {
|
||||
@@ -176,7 +161,7 @@ void RTPReceiver::PacketTimeout() {
|
||||
if (now - last_receive_time_ > packet_timeout_ms_) {
|
||||
packet_time_out = true;
|
||||
last_receive_time_ = 0; // Only one callback.
|
||||
rtp_payload_registry_.ResetLastReceivedPayloadTypes();
|
||||
rtp_payload_registry_->ResetLastReceivedPayloadTypes();
|
||||
}
|
||||
}
|
||||
if (packet_time_out) {
|
||||
@@ -226,14 +211,14 @@ WebRtc_Word32 RTPReceiver::RegisterReceivePayload(
|
||||
const WebRtc_UWord8 channels,
|
||||
const WebRtc_UWord32 rate) {
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_);
|
||||
return rtp_payload_registry_.RegisterReceivePayload(
|
||||
return rtp_payload_registry_->RegisterReceivePayload(
|
||||
payload_name, payload_type, frequency, channels, rate);
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPReceiver::DeRegisterReceivePayload(
|
||||
const WebRtc_Word8 payload_type) {
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_);
|
||||
return rtp_payload_registry_.DeRegisterReceivePayload(payload_type);
|
||||
return rtp_payload_registry_->DeRegisterReceivePayload(payload_type);
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPReceiver::ReceivePayloadType(
|
||||
@@ -243,7 +228,7 @@ WebRtc_Word32 RTPReceiver::ReceivePayloadType(
|
||||
const WebRtc_UWord32 rate,
|
||||
WebRtc_Word8* payload_type) const {
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_);
|
||||
return rtp_payload_registry_.ReceivePayloadType(
|
||||
return rtp_payload_registry_->ReceivePayloadType(
|
||||
payload_name, frequency, channels, rate, payload_type);
|
||||
}
|
||||
|
||||
@@ -254,7 +239,7 @@ WebRtc_Word32 RTPReceiver::ReceivePayload(
|
||||
WebRtc_UWord8* channels,
|
||||
WebRtc_UWord32* rate) const {
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_);
|
||||
return rtp_payload_registry_.ReceivePayload(
|
||||
return rtp_payload_registry_->ReceivePayload(
|
||||
payload_type, payload_name, frequency, channels, rate);
|
||||
}
|
||||
|
||||
@@ -627,7 +612,7 @@ WebRtc_UWord32 RTPReceiver::PayloadTypeToPayload(
|
||||
const WebRtc_UWord8 payload_type,
|
||||
Payload*& payload) const {
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_);
|
||||
return rtp_payload_registry_.PayloadTypeToPayload(payload_type, payload);
|
||||
return rtp_payload_registry_->PayloadTypeToPayload(payload_type, payload);
|
||||
}
|
||||
|
||||
// Compute time stamp of the last incoming packet that is the first packet of
|
||||
@@ -689,7 +674,7 @@ void RTPReceiver::CheckSSRCChanged(const WebRtcRTPHeader* rtp_header) {
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_);
|
||||
|
||||
WebRtc_Word8 last_received_payload_type =
|
||||
rtp_payload_registry_.last_received_payload_type();
|
||||
rtp_payload_registry_->last_received_payload_type();
|
||||
if (ssrc_ != rtp_header->header.ssrc ||
|
||||
(last_received_payload_type == -1 && ssrc_ == 0)) {
|
||||
// We need the payload_type_ to make the call if the remote SSRC is 0.
|
||||
@@ -709,7 +694,7 @@ void RTPReceiver::CheckSSRCChanged(const WebRtcRTPHeader* rtp_header) {
|
||||
re_initialize_decoder = true;
|
||||
|
||||
Payload* payload;
|
||||
if (rtp_payload_registry_.PayloadTypeToPayload(
|
||||
if (rtp_payload_registry_->PayloadTypeToPayload(
|
||||
rtp_header->header.payloadType, payload) != 0) {
|
||||
return;
|
||||
}
|
||||
@@ -767,7 +752,7 @@ WebRtc_Word32 RTPReceiver::CheckPayloadChanged(
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_);
|
||||
|
||||
WebRtc_Word8 last_received_payload_type =
|
||||
rtp_payload_registry_.last_received_payload_type();
|
||||
rtp_payload_registry_->last_received_payload_type();
|
||||
if (payload_type != last_received_payload_type) {
|
||||
if (REDPayloadType(payload_type)) {
|
||||
// Get the real codec payload type.
|
||||
@@ -803,7 +788,7 @@ WebRtc_Word32 RTPReceiver::CheckPayloadChanged(
|
||||
}
|
||||
|
||||
Payload* payload;
|
||||
if (rtp_payload_registry_.PayloadTypeToPayload(payload_type,
|
||||
if (rtp_payload_registry_->PayloadTypeToPayload(payload_type,
|
||||
payload) != 0) {
|
||||
// Not a registered payload type.
|
||||
return -1;
|
||||
@@ -812,7 +797,7 @@ WebRtc_Word32 RTPReceiver::CheckPayloadChanged(
|
||||
payload_name[RTP_PAYLOAD_NAME_SIZE - 1] = 0;
|
||||
strncpy(payload_name, payload->name, RTP_PAYLOAD_NAME_SIZE - 1);
|
||||
|
||||
rtp_payload_registry_.set_last_received_payload_type(payload_type);
|
||||
rtp_payload_registry_->set_last_received_payload_type(payload_type);
|
||||
|
||||
re_initialize_decoder = true;
|
||||
|
||||
@@ -825,7 +810,7 @@ WebRtc_Word32 RTPReceiver::CheckPayloadChanged(
|
||||
re_initialize_decoder = false;
|
||||
} else {
|
||||
bool media_type_unchanged =
|
||||
rtp_payload_registry_.ReportMediaPayloadType(payload_type);
|
||||
rtp_payload_registry_->ReportMediaPayloadType(payload_type);
|
||||
if (media_type_unchanged) {
|
||||
// Only reset the decoder if the media codec type has changed.
|
||||
re_initialize_decoder = false;
|
||||
@@ -860,9 +845,8 @@ void RTPReceiver::CheckCSRC(const WebRtcRTPHeader* rtp_header) {
|
||||
{
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_);
|
||||
|
||||
if (rtp_receiver_audio_->TelephoneEventPayloadType(
|
||||
if (!rtp_media_receiver_->ShouldReportCsrcChanges(
|
||||
rtp_header->header.payloadType)) {
|
||||
// Don't do this for DTMF packets.
|
||||
return;
|
||||
}
|
||||
num_energy_ = rtp_header->type.Audio.numEnergy;
|
||||
|
@@ -34,15 +34,17 @@ class RTPReceiverStrategy;
|
||||
|
||||
class RTPReceiver : public Bitrate {
|
||||
public:
|
||||
// Callbacks passed in here may not be NULL (use Null object callbacks if you
|
||||
// want callbacks to do nothing).
|
||||
// Callbacks passed in here may not be NULL (use Null Object callbacks if you
|
||||
// want callbacks to do nothing). This class takes ownership of the media
|
||||
// receiver but nothing else.
|
||||
RTPReceiver(const WebRtc_Word32 id,
|
||||
const bool audio,
|
||||
Clock* clock,
|
||||
ModuleRtpRtcpImpl* owner,
|
||||
RtpAudioFeedback* incoming_audio_messages_callback,
|
||||
RtpData* incoming_payload_callback,
|
||||
RtpFeedback* incoming_messages_callback);
|
||||
RtpFeedback* incoming_messages_callback,
|
||||
RTPReceiverStrategy* rtp_media_receiver,
|
||||
RTPPayloadRegistry* rtp_payload_registry);
|
||||
|
||||
virtual ~RTPReceiver();
|
||||
|
||||
@@ -154,10 +156,6 @@ class RTPReceiver : public Bitrate {
|
||||
|
||||
void RTXStatus(bool* enable, WebRtc_UWord32* ssrc) const;
|
||||
|
||||
RTPReceiverAudio* GetAudioReceiver() const {
|
||||
return rtp_receiver_audio_.get();
|
||||
}
|
||||
|
||||
virtual WebRtc_Word8 REDPayloadType() const;
|
||||
|
||||
bool HaveNotReceivedPackets() const;
|
||||
@@ -187,10 +185,8 @@ class RTPReceiver : public Bitrate {
|
||||
bool ProcessNACKBitRate(WebRtc_UWord32 now);
|
||||
|
||||
private:
|
||||
RTPPayloadRegistry rtp_payload_registry_;
|
||||
scoped_ptr<RTPReceiverAudio> rtp_receiver_audio_;
|
||||
scoped_ptr<RTPReceiverVideo> rtp_receiver_video_;
|
||||
RTPReceiverStrategy* rtp_media_receiver_;
|
||||
RTPPayloadRegistry* rtp_payload_registry_;
|
||||
scoped_ptr<RTPReceiverStrategy> rtp_media_receiver_;
|
||||
|
||||
WebRtc_Word32 id_;
|
||||
ModuleRtpRtcpImpl& rtp_rtcp_;
|
||||
|
@@ -148,6 +148,12 @@ RTPReceiverAudio::CNGPayloadType(const WebRtc_Word8 payloadType,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RTPReceiverAudio::ShouldReportCsrcChanges(
|
||||
WebRtc_UWord8 payload_type) const {
|
||||
// Don't do this for DTMF packets, otherwise it's fine.
|
||||
return !TelephoneEventPayloadType(payload_type);
|
||||
}
|
||||
|
||||
/*
|
||||
Sample based or frame based codecs based on RFC 3551
|
||||
|
||||
@@ -182,7 +188,6 @@ RTPReceiverAudio::CNGPayloadType(const WebRtc_Word8 payloadType,
|
||||
|
||||
G7221 frame N/A
|
||||
*/
|
||||
|
||||
ModuleRTPUtility::Payload* RTPReceiverAudio::CreatePayloadType(
|
||||
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
||||
const WebRtc_Word8 payloadType,
|
||||
|
@@ -76,6 +76,8 @@ public:
|
||||
ModuleRTPUtility::Payload* payload,
|
||||
const WebRtc_UWord32 rate) const;
|
||||
|
||||
bool ShouldReportCsrcChanges(WebRtc_UWord8 payload_type) const;
|
||||
|
||||
ModuleRTPUtility::Payload* CreatePayloadType(
|
||||
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
||||
const WebRtc_Word8 payloadType,
|
||||
|
@@ -68,6 +68,10 @@ class RTPReceiverStrategy {
|
||||
ModuleRTPUtility::Payload* payload,
|
||||
const WebRtc_UWord32 rate) const = 0;
|
||||
|
||||
// Returns true if we should report CSRC changes for this payload type.
|
||||
// TODO(phoglund): should move out of here along with other payload stuff.
|
||||
virtual bool ShouldReportCsrcChanges(WebRtc_UWord8 payload_type) const = 0;
|
||||
|
||||
// Creates a media-specific payload instance from the provided parameters.
|
||||
virtual ModuleRTPUtility::Payload* CreatePayloadType(
|
||||
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
|
||||
|
@@ -30,8 +30,7 @@ WebRtc_UWord32 BitRateBPS(WebRtc_UWord16 x )
|
||||
RTPReceiverVideo::RTPReceiverVideo(
|
||||
const WebRtc_Word32 id,
|
||||
const RTPPayloadRegistry* rtpRtpPayloadRegistry,
|
||||
RtpData* data_callback,
|
||||
ModuleRtpRtcpImpl* owner)
|
||||
RtpData* data_callback)
|
||||
: RTPReceiverStrategy(data_callback),
|
||||
_id(id),
|
||||
_rtpRtpPayloadRegistry(rtpRtpPayloadRegistry),
|
||||
@@ -46,6 +45,12 @@ RTPReceiverVideo::~RTPReceiverVideo() {
|
||||
delete _receiveFEC;
|
||||
}
|
||||
|
||||
bool RTPReceiverVideo::ShouldReportCsrcChanges(
|
||||
WebRtc_UWord8 payload_type) const {
|
||||
// Always do this for video packets.
|
||||
return true;
|
||||
}
|
||||
|
||||
ModuleRTPUtility::Payload* RTPReceiverVideo::CreatePayloadType(
|
||||
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
||||
const WebRtc_Word8 payloadType,
|
||||
|
@@ -29,8 +29,7 @@ class RTPReceiverVideo : public RTPReceiverStrategy {
|
||||
public:
|
||||
RTPReceiverVideo(const WebRtc_Word32 id,
|
||||
const RTPPayloadRegistry* rtp_payload_registry,
|
||||
RtpData* data_callback,
|
||||
ModuleRtpRtcpImpl* owner);
|
||||
RtpData* data_callback);
|
||||
|
||||
virtual ~RTPReceiverVideo();
|
||||
|
||||
@@ -57,6 +56,8 @@ class RTPReceiverVideo : public RTPReceiverStrategy {
|
||||
ModuleRTPUtility::Payload* payload,
|
||||
const WebRtc_UWord32 rate) const;
|
||||
|
||||
bool ShouldReportCsrcChanges(WebRtc_UWord8 payload_type) const;
|
||||
|
||||
ModuleRTPUtility::Payload* CreatePayloadType(
|
||||
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
||||
const WebRtc_Word8 payloadType,
|
||||
|
@@ -88,20 +88,18 @@ RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) {
|
||||
}
|
||||
|
||||
ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
|
||||
: rtp_sender_(configuration.id,
|
||||
: rtp_payload_registry_(configuration.id),
|
||||
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),
|
||||
clock_(configuration.clock),
|
||||
rtp_telephone_event_handler_(NULL),
|
||||
id_(configuration.id),
|
||||
audio_(configuration.audio),
|
||||
collision_detected_(false),
|
||||
@@ -130,6 +128,30 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
|
||||
, plot1_(NULL)
|
||||
#endif
|
||||
{
|
||||
RTPReceiverStrategy* rtp_receiver_strategy;
|
||||
if (configuration.audio) {
|
||||
// If audio, we need to be able to handle telephone events too, so stash
|
||||
// away the audio receiver for those situations.
|
||||
rtp_telephone_event_handler_ =
|
||||
new RTPReceiverAudio(configuration.id, configuration.incoming_data,
|
||||
configuration.audio_messages);
|
||||
rtp_receiver_strategy = rtp_telephone_event_handler_;
|
||||
} else {
|
||||
rtp_receiver_strategy =
|
||||
new RTPReceiverVideo(configuration.id, &rtp_payload_registry_,
|
||||
configuration.incoming_data);
|
||||
}
|
||||
// TODO(phoglund): Get rid of this silly circular dependency between the
|
||||
// payload manager and the video RTP receiver.
|
||||
rtp_payload_registry_.set_rtp_media_receiver(rtp_receiver_strategy);
|
||||
|
||||
rtp_receiver_.reset(new RTPReceiver(
|
||||
configuration.id, configuration.clock, this,
|
||||
configuration.audio_messages, configuration.incoming_data,
|
||||
configuration.incoming_messages, rtp_receiver_strategy,
|
||||
&rtp_payload_registry_));
|
||||
|
||||
|
||||
send_video_codec_.codecType = kVideoCodecUnknown;
|
||||
|
||||
if (default_module_) {
|
||||
@@ -223,14 +245,14 @@ WebRtc_Word32 ModuleRtpRtcpImpl::Process() {
|
||||
|
||||
if (now >=
|
||||
last_packet_timeout_process_time_ + kRtpRtcpPacketTimeoutProcessTimeMs) {
|
||||
rtp_receiver_.PacketTimeout();
|
||||
rtp_receiver_->PacketTimeout();
|
||||
rtcp_receiver_.PacketTimeout();
|
||||
last_packet_timeout_process_time_ = now;
|
||||
}
|
||||
|
||||
if (now >= last_bitrate_process_time_ + kRtpRtcpBitrateProcessTimeMs) {
|
||||
rtp_sender_.ProcessBitrate();
|
||||
rtp_receiver_.ProcessBitrate();
|
||||
rtp_receiver_->ProcessBitrate();
|
||||
last_bitrate_process_time_ = now;
|
||||
}
|
||||
|
||||
@@ -276,7 +298,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::Process() {
|
||||
if (remote_bitrate_) {
|
||||
// TODO(mflodman) Remove this and let this be propagated by CallStats.
|
||||
remote_bitrate_->SetRtt(max_rtt);
|
||||
remote_bitrate_->UpdateEstimate(rtp_receiver_.SSRC(), now);
|
||||
remote_bitrate_->UpdateEstimate(rtp_receiver_->SSRC(), now);
|
||||
if (TMMBR()) {
|
||||
unsigned int target_bitrate = 0;
|
||||
std::vector<unsigned int> ssrcs;
|
||||
@@ -309,7 +331,7 @@ void ModuleRtpRtcpImpl::ProcessDeadOrAliveTimer() {
|
||||
if (rtcp_receiver_.LastReceived() + 12000 > now) {
|
||||
RTCPalive = true;
|
||||
}
|
||||
rtp_receiver_.ProcessDeadOrAlive(RTCPalive, now);
|
||||
rtp_receiver_->ProcessDeadOrAlive(RTCPalive, now);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -363,7 +385,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetPacketTimeout(
|
||||
rtp_timeout_ms,
|
||||
rtcp_timeout_ms);
|
||||
|
||||
if (rtp_receiver_.SetPacketTimeout(rtp_timeout_ms) == 0) {
|
||||
if (rtp_receiver_->SetPacketTimeout(rtp_timeout_ms) == 0) {
|
||||
return rtcp_receiver_.SetPacketTimeout(rtcp_timeout_ms);
|
||||
}
|
||||
return -1;
|
||||
@@ -376,7 +398,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::RegisterReceivePayload(
|
||||
id_,
|
||||
"RegisterReceivePayload(voice_codec)");
|
||||
|
||||
return rtp_receiver_.RegisterReceivePayload(
|
||||
return rtp_receiver_->RegisterReceivePayload(
|
||||
voice_codec.plname,
|
||||
voice_codec.pltype,
|
||||
voice_codec.plfreq,
|
||||
@@ -391,7 +413,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::RegisterReceivePayload(
|
||||
id_,
|
||||
"RegisterReceivePayload(video_codec)");
|
||||
|
||||
return rtp_receiver_.RegisterReceivePayload(video_codec.plName,
|
||||
return rtp_receiver_->RegisterReceivePayload(video_codec.plName,
|
||||
video_codec.plType,
|
||||
90000,
|
||||
0,
|
||||
@@ -406,7 +428,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::ReceivePayloadType(
|
||||
id_,
|
||||
"ReceivePayloadType(voice_codec)");
|
||||
|
||||
return rtp_receiver_.ReceivePayloadType(
|
||||
return rtp_receiver_->ReceivePayloadType(
|
||||
voice_codec.plname,
|
||||
voice_codec.plfreq,
|
||||
voice_codec.channels,
|
||||
@@ -422,7 +444,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::ReceivePayloadType(
|
||||
id_,
|
||||
"ReceivePayloadType(video_codec)");
|
||||
|
||||
return rtp_receiver_.ReceivePayloadType(video_codec.plName,
|
||||
return rtp_receiver_->ReceivePayloadType(video_codec.plName,
|
||||
90000,
|
||||
0,
|
||||
video_codec.maxBitrate,
|
||||
@@ -437,7 +459,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::DeRegisterReceivePayload(
|
||||
"DeRegisterReceivePayload(%d)",
|
||||
payload_type);
|
||||
|
||||
return rtp_receiver_.DeRegisterReceivePayload(payload_type);
|
||||
return rtp_receiver_->DeRegisterReceivePayload(payload_type);
|
||||
}
|
||||
|
||||
// Get the currently configured SSRC filter.
|
||||
@@ -445,7 +467,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SSRCFilter(
|
||||
WebRtc_UWord32& allowed_ssrc) const {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SSRCFilter()");
|
||||
|
||||
return rtp_receiver_.SSRCFilter(allowed_ssrc);
|
||||
return rtp_receiver_->SSRCFilter(allowed_ssrc);
|
||||
}
|
||||
|
||||
// Set a SSRC to be used as a filter for incoming RTP streams.
|
||||
@@ -465,21 +487,21 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetSSRCFilter(
|
||||
"SetSSRCFilter(disable)");
|
||||
}
|
||||
|
||||
return rtp_receiver_.SetSSRCFilter(enable, allowed_ssrc);
|
||||
return rtp_receiver_->SetSSRCFilter(enable, allowed_ssrc);
|
||||
}
|
||||
|
||||
// Get last received remote timestamp.
|
||||
WebRtc_UWord32 ModuleRtpRtcpImpl::RemoteTimestamp() const {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteTimestamp()");
|
||||
|
||||
return rtp_receiver_.TimeStamp();
|
||||
return rtp_receiver_->TimeStamp();
|
||||
}
|
||||
|
||||
int64_t ModuleRtpRtcpImpl::LocalTimeOfRemoteTimeStamp() const {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
||||
"LocalTimeOfRemoteTimeStamp()");
|
||||
|
||||
return rtp_receiver_.LastReceivedTimeMs();
|
||||
return rtp_receiver_->LastReceivedTimeMs();
|
||||
}
|
||||
|
||||
// Get the current estimated remote timestamp.
|
||||
@@ -490,14 +512,14 @@ WebRtc_Word32 ModuleRtpRtcpImpl::EstimatedRemoteTimeStamp(
|
||||
id_,
|
||||
"EstimatedRemoteTimeStamp()");
|
||||
|
||||
return rtp_receiver_.EstimatedRemoteTimeStamp(timestamp);
|
||||
return rtp_receiver_->EstimatedRemoteTimeStamp(timestamp);
|
||||
}
|
||||
|
||||
// Get incoming SSRC.
|
||||
WebRtc_UWord32 ModuleRtpRtcpImpl::RemoteSSRC() const {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteSSRC()");
|
||||
|
||||
return rtp_receiver_.SSRC();
|
||||
return rtp_receiver_->SSRC();
|
||||
}
|
||||
|
||||
// Get remote CSRC
|
||||
@@ -505,7 +527,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::RemoteCSRCs(
|
||||
WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize]) const {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteCSRCs()");
|
||||
|
||||
return rtp_receiver_.CSRCs(arr_of_csrc);
|
||||
return rtp_receiver_->CSRCs(arr_of_csrc);
|
||||
}
|
||||
|
||||
WebRtc_Word32 ModuleRtpRtcpImpl::SetRTXSendStatus(
|
||||
@@ -525,13 +547,13 @@ WebRtc_Word32 ModuleRtpRtcpImpl::RTXSendStatus(bool* enable,
|
||||
WebRtc_Word32 ModuleRtpRtcpImpl::SetRTXReceiveStatus(
|
||||
const bool enable,
|
||||
const WebRtc_UWord32 ssrc) {
|
||||
rtp_receiver_.SetRTXStatus(enable, ssrc);
|
||||
rtp_receiver_->SetRTXStatus(enable, ssrc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 ModuleRtpRtcpImpl::RTXReceiveStatus(bool* enable,
|
||||
WebRtc_UWord32* ssrc) const {
|
||||
rtp_receiver_.RTXStatus(enable, ssrc);
|
||||
rtp_receiver_->RTXStatus(enable, ssrc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -593,7 +615,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::IncomingPacket(
|
||||
memset(&rtp_header, 0, sizeof(rtp_header));
|
||||
|
||||
RtpHeaderExtensionMap map;
|
||||
rtp_receiver_.GetHeaderExtensionMapCopy(&map);
|
||||
rtp_receiver_->GetHeaderExtensionMapCopy(&map);
|
||||
|
||||
const bool valid_rtpheader = rtp_parser.Parse(rtp_header, &map);
|
||||
if (!valid_rtpheader) {
|
||||
@@ -603,7 +625,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::IncomingPacket(
|
||||
"IncomingPacket invalid RTP header");
|
||||
return -1;
|
||||
}
|
||||
return rtp_receiver_.IncomingRTPPacket(&rtp_header,
|
||||
return rtp_receiver_->IncomingRTPPacket(&rtp_header,
|
||||
incoming_packet,
|
||||
incoming_packet_length);
|
||||
}
|
||||
@@ -1147,7 +1169,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::RemoteCNAME(
|
||||
WebRtc_UWord16 ModuleRtpRtcpImpl::RemoteSequenceNumber() const {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteSequenceNumber()");
|
||||
|
||||
return rtp_receiver_.SequenceNumber();
|
||||
return rtp_receiver_->SequenceNumber();
|
||||
}
|
||||
|
||||
WebRtc_Word32 ModuleRtpRtcpImpl::RemoteNTP(
|
||||
@@ -1193,7 +1215,7 @@ void ModuleRtpRtcpImpl:: SetRtt(uint32_t rtt) {
|
||||
WebRtc_Word32 ModuleRtpRtcpImpl::ResetStatisticsRTP() {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "ResetStatisticsRTP()");
|
||||
|
||||
return rtp_receiver_.ResetStatistics();
|
||||
return rtp_receiver_->ResetStatistics();
|
||||
}
|
||||
|
||||
// Reset RTP data counters for the receiving side.
|
||||
@@ -1201,7 +1223,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::ResetReceiveDataCountersRTP() {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
||||
"ResetReceiveDataCountersRTP()");
|
||||
|
||||
return rtp_receiver_.ResetDataCounters();
|
||||
return rtp_receiver_->ResetDataCounters();
|
||||
}
|
||||
|
||||
// Reset RTP data counters for the sending side.
|
||||
@@ -1253,7 +1275,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::StatisticsRTP(
|
||||
|
||||
WebRtc_UWord32 jitter_transmission_time_offset = 0;
|
||||
|
||||
WebRtc_Word32 ret_val = rtp_receiver_.Statistics(
|
||||
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) {
|
||||
@@ -1276,7 +1298,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::DataCountersRTP(
|
||||
if (packets_sent) {
|
||||
*packets_sent = rtp_sender_.Packets();
|
||||
}
|
||||
return rtp_receiver_.DataCounters(bytes_received, packets_received);
|
||||
return rtp_receiver_->DataCounters(bytes_received, packets_received);
|
||||
}
|
||||
|
||||
WebRtc_Word32 ModuleRtpRtcpImpl::ReportBlockStatistics(
|
||||
@@ -1287,7 +1309,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::ReportBlockStatistics(
|
||||
WebRtc_UWord32* jitter_transmission_time_offset) {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "ReportBlockStatistics()");
|
||||
WebRtc_Word32 missing = 0;
|
||||
WebRtc_Word32 ret = rtp_receiver_.Statistics(fraction_lost,
|
||||
WebRtc_Word32 ret = rtp_receiver_->Statistics(fraction_lost,
|
||||
cum_lost,
|
||||
ext_max,
|
||||
jitter,
|
||||
@@ -1397,12 +1419,12 @@ WebRtc_Word32 ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension(
|
||||
WebRtc_Word32 ModuleRtpRtcpImpl::RegisterReceiveRtpHeaderExtension(
|
||||
const RTPExtensionType type,
|
||||
const WebRtc_UWord8 id) {
|
||||
return rtp_receiver_.RegisterRtpHeaderExtension(type, id);
|
||||
return rtp_receiver_->RegisterRtpHeaderExtension(type, id);
|
||||
}
|
||||
|
||||
WebRtc_Word32 ModuleRtpRtcpImpl::DeregisterReceiveRtpHeaderExtension(
|
||||
const RTPExtensionType type) {
|
||||
return rtp_receiver_.DeregisterRtpHeaderExtension(type);
|
||||
return rtp_receiver_->DeregisterRtpHeaderExtension(type);
|
||||
}
|
||||
|
||||
// (TMMBR) Temporary Max Media Bit Rate.
|
||||
@@ -1472,7 +1494,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetNACKStatus(NACKMethod method) {
|
||||
"SetNACKStatus(%u)", method);
|
||||
|
||||
nack_method_ = method;
|
||||
rtp_receiver_.SetNACKStatus(method);
|
||||
rtp_receiver_->SetNACKStatus(method);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1509,7 +1531,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SendNACK(const WebRtc_UWord16* nack_list,
|
||||
return -1;
|
||||
}
|
||||
WebRtc_UWord16 avg_rtt = 0;
|
||||
rtcp_receiver_.RTT(rtp_receiver_.SSRC(), NULL, &avg_rtt, NULL, NULL);
|
||||
rtcp_receiver_.RTT(rtp_receiver_->SSRC(), NULL, &avg_rtt, NULL, NULL);
|
||||
|
||||
WebRtc_Word64 wait_time = 5 + ((avg_rtt * 3) >> 1); // 5 + RTT * 1.5.
|
||||
if (wait_time == 5) {
|
||||
@@ -1578,7 +1600,9 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetTelephoneEventStatus(
|
||||
" detect_end_of_tone:%d)", enable, forward_to_decoder,
|
||||
detect_end_of_tone);
|
||||
|
||||
return rtp_receiver_.GetAudioReceiver()->SetTelephoneEventStatus(
|
||||
assert(audio_);
|
||||
assert(rtp_telephone_event_handler_);
|
||||
return rtp_telephone_event_handler_->SetTelephoneEventStatus(
|
||||
enable, forward_to_decoder, detect_end_of_tone);
|
||||
}
|
||||
|
||||
@@ -1586,7 +1610,9 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetTelephoneEventStatus(
|
||||
bool ModuleRtpRtcpImpl::TelephoneEvent() const {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "TelephoneEvent()");
|
||||
|
||||
return rtp_receiver_.GetAudioReceiver()->TelephoneEvent();
|
||||
assert(audio_);
|
||||
assert(rtp_telephone_event_handler_);
|
||||
return rtp_telephone_event_handler_->TelephoneEvent();
|
||||
}
|
||||
|
||||
// Is forwarding of out-band telephone events turned on/off?
|
||||
@@ -1594,7 +1620,9 @@ bool ModuleRtpRtcpImpl::TelephoneEventForwardToDecoder() const {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
||||
"TelephoneEventForwardToDecoder()");
|
||||
|
||||
return rtp_receiver_.GetAudioReceiver()->TelephoneEventForwardToDecoder();
|
||||
assert(audio_);
|
||||
assert(rtp_telephone_event_handler_);
|
||||
return rtp_telephone_event_handler_->TelephoneEventForwardToDecoder();
|
||||
}
|
||||
|
||||
// Send a TelephoneEvent tone using RFC 2833 (4733).
|
||||
@@ -1646,9 +1674,9 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetRTPAudioLevelIndicationStatus(
|
||||
id);
|
||||
|
||||
if (enable) {
|
||||
rtp_receiver_.RegisterRtpHeaderExtension(kRtpExtensionAudioLevel, id);
|
||||
rtp_receiver_->RegisterRtpHeaderExtension(kRtpExtensionAudioLevel, id);
|
||||
} else {
|
||||
rtp_receiver_.DeregisterRtpHeaderExtension(kRtpExtensionAudioLevel);
|
||||
rtp_receiver_->DeregisterRtpHeaderExtension(kRtpExtensionAudioLevel);
|
||||
}
|
||||
return rtp_sender_.SetAudioLevelIndicationStatus(enable, id);
|
||||
}
|
||||
@@ -1695,7 +1723,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SendREDPayloadType(
|
||||
}
|
||||
|
||||
RtpVideoCodecTypes ModuleRtpRtcpImpl::ReceivedVideoCodec() const {
|
||||
return rtp_receiver_.VideoCodecType();
|
||||
return rtp_receiver_->VideoCodecType();
|
||||
}
|
||||
|
||||
RtpVideoCodecTypes ModuleRtpRtcpImpl::SendVideoCodec() const {
|
||||
@@ -1910,7 +1938,7 @@ void ModuleRtpRtcpImpl::SetRemoteSSRC(const WebRtc_UWord32 ssrc) {
|
||||
}
|
||||
|
||||
WebRtc_UWord32 ModuleRtpRtcpImpl::BitrateReceivedNow() const {
|
||||
return rtp_receiver_.BitrateNow();
|
||||
return rtp_receiver_->BitrateNow();
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::BitrateSent(WebRtc_UWord32* total_rate,
|
||||
@@ -2012,7 +2040,7 @@ void ModuleRtpRtcpImpl::OnReceivedNACK(
|
||||
return;
|
||||
}
|
||||
WebRtc_UWord16 avg_rtt = 0;
|
||||
rtcp_receiver_.RTT(rtp_receiver_.SSRC(), NULL, &avg_rtt, NULL, NULL);
|
||||
rtcp_receiver_.RTT(rtp_receiver_->SSRC(), NULL, &avg_rtt, NULL, NULL);
|
||||
rtp_sender_.OnReceivedNACK(nack_sequence_numbers_length,
|
||||
nack_sequence_numbers,
|
||||
avg_rtt);
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#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_payload_registry.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"
|
||||
@@ -471,8 +472,10 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
// Only for internal testing.
|
||||
WebRtc_UWord32 LastSendReport(WebRtc_UWord32& last_rtcptime);
|
||||
|
||||
RTPPayloadRegistry rtp_payload_registry_;
|
||||
|
||||
RTPSender rtp_sender_;
|
||||
RTPReceiver rtp_receiver_;
|
||||
scoped_ptr<RTPReceiver> rtp_receiver_;
|
||||
|
||||
RTCPSender rtcp_sender_;
|
||||
RTCPReceiver rtcp_receiver_;
|
||||
@@ -482,6 +485,8 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
private:
|
||||
int64_t RtcpReportInterval();
|
||||
|
||||
RTPReceiverAudio* rtp_telephone_event_handler_;
|
||||
|
||||
WebRtc_Word32 id_;
|
||||
const bool audio_;
|
||||
bool collision_detected_;
|
||||
|
Reference in New Issue
Block a user