Merge r4374 from stable to trunk.

r4374 was mistakenly committed to stable, so this is to re-merge back to trunk.

Store the sequence number in StopSend() and resume it in StartSend().

When restarting the microphone device, we call StopSend() first, then
StartSend() later. Since we reset sequence number in StopSend(), it sometimes
causes libSRTP to complain about packets being replayed. Libjingle work around
it by caching the sequence number in WebRtcVoiceEngine.cc, and call
SetInitSequenceNumber() to resume the sequence number before StartSend().Store the sequence number in StopSend() and resume it in StartSend().

When restarting the microphone device, we call StopSend() first, then
StartSend() later. Since we reset sequence number in StopSend(), it sometimes
causes libSRTP to complain about packets being replayed. Libjingle work around
it by caching the sequence number in WebRtcVoiceEngine.cc, and call
SetInitSequenceNumber() to resume the sequence number before StartSend().

This patch fixes this problem by storing the sequence number in StopSend(), and
resume it in StartSend(). So that we can remove the workaround in libjingle.

BUG=2102
R=tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1922004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4451 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
xians@webrtc.org 2013-07-31 16:30:19 +00:00
parent 8fff1f065e
commit 09e8c47ee5
2 changed files with 15 additions and 0 deletions

View File

@ -915,6 +915,7 @@ Channel::Channel(int32_t channelId,
playout_timestamp_rtp_(0),
playout_timestamp_rtcp_(0),
_numberOfDiscardedPackets(0),
send_sequence_number_(0),
_engineStatisticsPtr(NULL),
_outputMixerPtr(NULL),
_transmitMixerPtr(NULL),
@ -1400,6 +1401,11 @@ Channel::StartSend()
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::StartSend()");
// Resume the previous sequence number which was reset by StopSend().
// This needs to be done before |_sending| is set to true.
if (send_sequence_number_)
SetInitSequenceNumber(send_sequence_number_);
{
// A lock is needed because |_sending| can be accessed or modified by
// another thread at the same time.
@ -1442,6 +1448,14 @@ Channel::StopSend()
_sending = false;
}
// Store the sequence number to be able to pick up the same sequence for
// the next StartSend(). This is needed for restarting device, otherwise
// it might cause libSRTP to complain about packets being replayed.
// TODO(xians): Remove this workaround after RtpRtcpModule's refactoring
// CL is landed. See issue
// https://code.google.com/p/webrtc/issues/detail?id=2111 .
send_sequence_number_ = _rtpRtcpModule->SequenceNumber();
// Reset sending SSRC and sequence number and triggers direct transmission
// of RTCP BYE
if (_rtpRtcpModule->SetSendingStatus(false) == -1 ||

View File

@ -490,6 +490,7 @@ private:
uint32_t playout_timestamp_rtcp_;
uint32_t playout_delay_ms_;
uint32_t _numberOfDiscardedPackets;
uint16_t send_sequence_number_;
private:
// uses