From db249956807d916729aacfaf3382923e8239d533 Mon Sep 17 00:00:00 2001 From: "pwestin@webrtc.org" Date: Wed, 5 Jun 2013 15:33:20 +0000 Subject: [PATCH] Wire up Nack for Voe R=henrika@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1614004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4184 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/voice_engine/channel.cc | 13 +++++++++++++ webrtc/voice_engine/channel.h | 2 ++ webrtc/voice_engine/voe_rtp_rtcp_impl.cc | 11 ++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index 5508b975bd..46b95ed948 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -4230,6 +4230,19 @@ Channel::GetFECStatus(bool& enabled, int& redPayloadtype) return 0; } +void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) { + // None of these functions can fail. + _rtpRtcpModule->SetStorePacketsStatus(enable, maxNumberOfPackets); + _rtpRtcpModule->SetNACKStatus(enable ? kNackRtcp : kNackOff, + maxNumberOfPackets); +} + +// Called by the ACM when it's missing one or more packets. +int Channel::ResendPackets(const uint16_t* sequence_numbers, + int length) { + return _rtpRtcpModule->SendNACK(sequence_numbers, length); +} + int Channel::StartRTPDump(const char fileNameUTF8[1024], RTPDirections direction) diff --git a/webrtc/voice_engine/channel.h b/webrtc/voice_engine/channel.h index f4307644fe..6473876da8 100644 --- a/webrtc/voice_engine/channel.h +++ b/webrtc/voice_engine/channel.h @@ -278,6 +278,8 @@ public: int GetRTPStatistics(CallStatistics& stats); int SetFECStatus(bool enable, int redPayloadtype); int GetFECStatus(bool& enabled, int& redPayloadtype); + void SetNACKStatus(bool enable, int maxNumberOfPackets); + int ResendPackets(const uint16_t* sequence_numbers, int length); int StartRTPDump(const char fileNameUTF8[1024], RTPDirections direction); int StopRTPDump(RTPDirections direction); bool RTPDumpIsActive(RTPDirections direction); diff --git a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc index b49ea41c82..f4554db2d4 100644 --- a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc +++ b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc @@ -576,7 +576,16 @@ int VoERTP_RTCPImpl::SetNACKStatus(int channel, WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)", channel, enable, maxNoPackets); - // Dummy for now + + voe::ScopedChannel sc(_shared->channel_manager(), channel); + voe::Channel* channelPtr = sc.ChannelPtr(); + if (channelPtr == NULL) + { + _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, + "SetNACKStatus() failed to locate channel"); + return -1; + } + channelPtr->SetNACKStatus(enable, maxNoPackets); return 0; }