mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1339906 - pt 1 - Add bytesSent and bytesReceived to RTCIceCandidatePairStats. r=drno,qdot
MozReview-Commit-ID: BQGPTUzRCB3 --HG-- extra : rebase_source : cd2abb970a07479c8425a13d12fc0fbaa487b00e
This commit is contained in:
parent
55d8a7bd34
commit
69f85fff44
@ -211,6 +211,8 @@ struct ParamTraits<mozilla::dom::RTCIceCandidatePairStats>
|
||||
WriteParam(aMsg, aParam.mRemoteCandidateId);
|
||||
WriteParam(aMsg, aParam.mSelected);
|
||||
WriteParam(aMsg, aParam.mState);
|
||||
WriteParam(aMsg, aParam.mBytesSent);
|
||||
WriteParam(aMsg, aParam.mBytesReceived);
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
@ -224,6 +226,8 @@ struct ParamTraits<mozilla::dom::RTCIceCandidatePairStats>
|
||||
!ReadParam(aMsg, aIter, &(aResult->mRemoteCandidateId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mSelected)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mState)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
|
||||
!ReadRTCStats(aMsg, aIter, aResult)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -131,6 +131,8 @@ dictionary RTCIceCandidatePairStats : RTCStats {
|
||||
unsigned long long priority;
|
||||
boolean readable;
|
||||
boolean nominated;
|
||||
unsigned long long bytesSent;
|
||||
unsigned long long bytesReceived;
|
||||
boolean selected;
|
||||
};
|
||||
|
||||
|
@ -405,6 +405,8 @@ nsresult NrIceMediaStream::GetCandidatePairs(std::vector<NrIceCandidatePair>*
|
||||
pair.selected = p1->remote->component &&
|
||||
p1->remote->component->active == p1;
|
||||
pair.codeword = p1->codeword;
|
||||
pair.bytes_sent = p1->bytes_sent;
|
||||
pair.bytes_recvd = p1->bytes_recvd;
|
||||
|
||||
if (!ToNrIceCandidate(*(p1->local), &pair.local) ||
|
||||
!ToNrIceCandidate(*(p1->remote), &pair.remote)) {
|
||||
|
@ -122,6 +122,10 @@ struct NrIceCandidatePair {
|
||||
NrIceCandidate remote;
|
||||
// TODO(bcampen@mozilla.com): Is it important to put the foundation in here?
|
||||
std::string codeword;
|
||||
|
||||
// for RTCIceCandidatePairStats
|
||||
uint64_t bytes_sent;
|
||||
uint64_t bytes_recvd;
|
||||
};
|
||||
|
||||
class NrIceMediaStream {
|
||||
|
@ -63,6 +63,10 @@ struct nr_ice_cand_pair_ {
|
||||
nr_ice_candidate *remote; /* The remote candidate */
|
||||
char *foundation; /* The combined foundations */
|
||||
|
||||
// for RTCIceCandidatePairStats
|
||||
UINT8 bytes_sent;
|
||||
UINT8 bytes_recvd;
|
||||
|
||||
nr_stun_client_ctx *stun_client; /* STUN context when acting as a client */
|
||||
void *stun_client_handle;
|
||||
|
||||
|
@ -827,6 +827,9 @@ int nr_ice_media_stream_send(nr_ice_peer_ctx *pctx, nr_ice_media_stream *str, in
|
||||
ABORT(r);
|
||||
}
|
||||
|
||||
// accumulate the sent bytes for the active candidate pair
|
||||
comp->active->bytes_sent += len;
|
||||
|
||||
_status=0;
|
||||
abort:
|
||||
return(_status);
|
||||
|
@ -823,6 +823,11 @@ int nr_ice_peer_ctx_deliver_packet_maybe(nr_ice_peer_ctx *pctx, nr_ice_component
|
||||
if(!cand)
|
||||
ABORT(R_REJECTED);
|
||||
|
||||
// accumulate the received bytes for the active candidate pair
|
||||
if (peer_comp->active) {
|
||||
peer_comp->active->bytes_recvd += len;
|
||||
}
|
||||
|
||||
/* OK, there's a match. Call the handler */
|
||||
|
||||
if (pctx->handler) {
|
||||
|
@ -3595,6 +3595,8 @@ static void RecordIceStats_s(
|
||||
s.mNominated.Construct(candPair.nominated);
|
||||
s.mPriority.Construct(candPair.priority);
|
||||
s.mSelected.Construct(candPair.selected);
|
||||
s.mBytesSent.Construct(candPair.bytes_sent);
|
||||
s.mBytesReceived.Construct(candPair.bytes_recvd);
|
||||
s.mState.Construct(RTCStatsIceCandidatePairState(candPair.state));
|
||||
report->mIceCandidatePairStats.Value().AppendElement(s, fallible);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user