Bug 947665 - jitter stat. r=abr

This commit is contained in:
Jan-Ivar Bruaroey 2014-01-15 17:29:43 -05:00
parent df1ddddb3a
commit 1cbc8cb5b9
6 changed files with 27 additions and 0 deletions

View File

@ -145,6 +145,13 @@ bool WebrtcAudioConduit::GetRemoteSSRC(unsigned int* ssrc) {
return !mPtrRTP->GetRemoteSSRC(mChannel, *ssrc); return !mPtrRTP->GetRemoteSSRC(mChannel, *ssrc);
} }
bool WebrtcAudioConduit::GetReceivedJitter(unsigned int* jitterMs) {
unsigned int maxJitterMs;
unsigned int discardedPackets;
return !mPtrRTP->GetRTPStatistics(mChannel, *jitterMs, maxJitterMs,
discardedPackets);
}
/* /*
* WebRTCAudioConduit Implementation * WebRTCAudioConduit Implementation
*/ */

View File

@ -172,6 +172,7 @@ public:
webrtc::VoiceEngine* GetVoiceEngine() { return mVoiceEngine; } webrtc::VoiceEngine* GetVoiceEngine() { return mVoiceEngine; }
bool GetLocalSSRC(unsigned int* ssrc); bool GetLocalSSRC(unsigned int* ssrc);
bool GetRemoteSSRC(unsigned int* ssrc); bool GetRemoteSSRC(unsigned int* ssrc);
bool GetReceivedJitter(unsigned int* jitterMs);
private: private:
WebrtcAudioConduit(const WebrtcAudioConduit& other) MOZ_DELETE; WebrtcAudioConduit(const WebrtcAudioConduit& other) MOZ_DELETE;

View File

@ -138,6 +138,7 @@ public:
virtual bool GetLocalSSRC(unsigned int* ssrc) = 0; virtual bool GetLocalSSRC(unsigned int* ssrc) = 0;
virtual bool GetRemoteSSRC(unsigned int* ssrc) = 0; virtual bool GetRemoteSSRC(unsigned int* ssrc) = 0;
virtual bool GetReceivedJitter(unsigned int* jitterMs) = 0;
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaSessionConduit) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaSessionConduit)

View File

@ -145,6 +145,19 @@ bool WebrtcVideoConduit::GetRemoteSSRC(unsigned int* ssrc) {
return !mPtrRTP->GetRemoteSSRC(mChannel, *ssrc); return !mPtrRTP->GetRemoteSSRC(mChannel, *ssrc);
} }
bool WebrtcVideoConduit::GetReceivedJitter(unsigned int* jitterMs) {
unsigned short fractionLost;
unsigned int cumulativeLost;
unsigned extendedMax;
int rttMs;
return !mPtrRTP->GetReceivedRTCPStatistics(mChannel,
fractionLost,
cumulativeLost,
extendedMax,
*jitterMs,
rttMs);
}
/** /**
* Peforms intialization of the MANDATORY components of the Video Engine * Peforms intialization of the MANDATORY components of the Video Engine
*/ */

View File

@ -210,6 +210,7 @@ public:
webrtc::VideoEngine* GetVideoEngine() { return mVideoEngine; } webrtc::VideoEngine* GetVideoEngine() { return mVideoEngine; }
bool GetLocalSSRC(unsigned int* ssrc); bool GetLocalSSRC(unsigned int* ssrc);
bool GetRemoteSSRC(unsigned int* ssrc); bool GetRemoteSSRC(unsigned int* ssrc);
bool GetReceivedJitter(unsigned int* jitterMs);
private: private:

View File

@ -2004,6 +2004,10 @@ PeerConnectionImpl::GetStatsImpl_s(
str.AppendInt(ssrc); str.AppendInt(ssrc);
s.mSsrc.Construct(str); s.mSsrc.Construct(str);
} }
unsigned int jitterMs;
if (mp.Conduit()->GetReceivedJitter(&jitterMs)) {
s.mJitter.Construct(double(jitterMs)/1000);
}
s.mPacketsReceived.Construct(mp.rtp_packets_received()); s.mPacketsReceived.Construct(mp.rtp_packets_received());
s.mBytesReceived.Construct(mp.rtp_bytes_received()); s.mBytesReceived.Construct(mp.rtp_bytes_received());
report->mInboundRTPStreamStats.Value().AppendElement(s); report->mInboundRTPStreamStats.Value().AppendElement(s);