mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1339906 - pt 4 - add last sent and received timestamps to RTCIceCandidatePairStats. r=drno,qdot
MozReview-Commit-ID: GE23lS7qs9n --HG-- extra : rebase_source : 5b39e4232258eca1807d3c962a2ed40c2724822b
This commit is contained in:
parent
eb58727687
commit
1b76f106fd
@ -213,6 +213,8 @@ struct ParamTraits<mozilla::dom::RTCIceCandidatePairStats>
|
||||
WriteParam(aMsg, aParam.mState);
|
||||
WriteParam(aMsg, aParam.mBytesSent);
|
||||
WriteParam(aMsg, aParam.mBytesReceived);
|
||||
WriteParam(aMsg, aParam.mLastPacketSentTimestamp);
|
||||
WriteParam(aMsg, aParam.mLastPacketReceivedTimestamp);
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
@ -228,6 +230,8 @@ struct ParamTraits<mozilla::dom::RTCIceCandidatePairStats>
|
||||
!ReadParam(aMsg, aIter, &(aResult->mState)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mLastPacketSentTimestamp)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mLastPacketReceivedTimestamp)) ||
|
||||
!ReadRTCStats(aMsg, aIter, aResult)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -133,6 +133,8 @@ dictionary RTCIceCandidatePairStats : RTCStats {
|
||||
boolean nominated;
|
||||
unsigned long long bytesSent;
|
||||
unsigned long long bytesReceived;
|
||||
DOMHighResTimeStamp lastPacketSentTimestamp;
|
||||
DOMHighResTimeStamp lastPacketReceivedTimestamp;
|
||||
boolean selected;
|
||||
};
|
||||
|
||||
|
@ -407,6 +407,10 @@ nsresult NrIceMediaStream::GetCandidatePairs(std::vector<NrIceCandidatePair>*
|
||||
pair.codeword = p1->codeword;
|
||||
pair.bytes_sent = p1->bytes_sent;
|
||||
pair.bytes_recvd = p1->bytes_recvd;
|
||||
pair.ms_since_last_send = p1->last_sent.tv_sec*1000
|
||||
+ p1->last_sent.tv_usec/1000;
|
||||
pair.ms_since_last_recv = p1->last_recvd.tv_sec*1000
|
||||
+ p1->last_recvd.tv_usec/1000;
|
||||
|
||||
if (!ToNrIceCandidate(*(p1->local), &pair.local) ||
|
||||
!ToNrIceCandidate(*(p1->remote), &pair.remote)) {
|
||||
|
@ -126,6 +126,8 @@ struct NrIceCandidatePair {
|
||||
// for RTCIceCandidatePairStats
|
||||
uint64_t bytes_sent;
|
||||
uint64_t bytes_recvd;
|
||||
uint64_t ms_since_last_send;
|
||||
uint64_t ms_since_last_recv;
|
||||
};
|
||||
|
||||
class NrIceMediaStream {
|
||||
|
@ -66,6 +66,8 @@ struct nr_ice_cand_pair_ {
|
||||
// for RTCIceCandidatePairStats
|
||||
UINT8 bytes_sent;
|
||||
UINT8 bytes_recvd;
|
||||
struct timeval last_sent;
|
||||
struct timeval last_recvd;
|
||||
|
||||
nr_stun_client_ctx *stun_client; /* STUN context when acting as a client */
|
||||
void *stun_client_handle;
|
||||
|
@ -829,6 +829,7 @@ int nr_ice_media_stream_send(nr_ice_peer_ctx *pctx, nr_ice_media_stream *str, in
|
||||
|
||||
// accumulate the sent bytes for the active candidate pair
|
||||
comp->active->bytes_sent += len;
|
||||
gettimeofday(&comp->active->last_sent, 0);
|
||||
|
||||
_status=0;
|
||||
abort:
|
||||
|
@ -826,6 +826,7 @@ int nr_ice_peer_ctx_deliver_packet_maybe(nr_ice_peer_ctx *pctx, nr_ice_component
|
||||
// accumulate the received bytes for the active candidate pair
|
||||
if (peer_comp->active) {
|
||||
peer_comp->active->bytes_recvd += len;
|
||||
gettimeofday(&peer_comp->active->last_recvd, 0);
|
||||
}
|
||||
|
||||
/* OK, there's a match. Call the handler */
|
||||
|
@ -3597,6 +3597,8 @@ static void RecordIceStats_s(
|
||||
s.mSelected.Construct(candPair.selected);
|
||||
s.mBytesSent.Construct(candPair.bytes_sent);
|
||||
s.mBytesReceived.Construct(candPair.bytes_recvd);
|
||||
s.mLastPacketSentTimestamp.Construct(candPair.ms_since_last_send);
|
||||
s.mLastPacketReceivedTimestamp.Construct(candPair.ms_since_last_recv);
|
||||
s.mState.Construct(RTCStatsIceCandidatePairState(candPair.state));
|
||||
report->mIceCandidatePairStats.Value().AppendElement(s, fallible);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user