mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1147857: be careful about WebRTC stats query creation r=jib
This commit is contained in:
parent
3b75ea9aff
commit
d8c68a04b7
@ -289,14 +289,20 @@ PeerConnectionCtx::EverySecondTelemetryCallback_m(nsITimer* timer, void *closure
|
||||
p != ctx->mPeerConnections.end(); ++p) {
|
||||
if (p->second->HasMedia()) {
|
||||
queries->append(nsAutoPtr<RTCStatsQuery>(new RTCStatsQuery(true)));
|
||||
p->second->BuildStatsQuery_m(nullptr, // all tracks
|
||||
queries->back());
|
||||
if (NS_WARN_IF(NS_FAILED(p->second->BuildStatsQuery_m(nullptr, // all tracks
|
||||
queries->back())))) {
|
||||
queries->popBack();
|
||||
} else {
|
||||
MOZ_ASSERT(queries->back()->report);
|
||||
}
|
||||
}
|
||||
}
|
||||
rv = RUN_ON_THREAD(stsThread,
|
||||
WrapRunnableNM(&EverySecondTelemetryCallback_s, queries),
|
||||
NS_DISPATCH_NORMAL);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (!queries->empty()) {
|
||||
rv = RUN_ON_THREAD(stsThread,
|
||||
WrapRunnableNM(&EverySecondTelemetryCallback_s, queries),
|
||||
NS_DISPATCH_NORMAL);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2807,17 +2807,22 @@ PeerConnectionImpl::BuildStatsQuery_m(
|
||||
RTCStatsQuery *query) {
|
||||
|
||||
if (!HasMedia()) {
|
||||
return NS_OK;
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (!mMedia->ice_ctx() || !mThread) {
|
||||
CSFLogError(logTag, "Could not build stats query, critical components of "
|
||||
"PeerConnectionImpl not set.");
|
||||
// Note: mMedia->ice_ctx() is deleted on STS thread; so make sure we grab and hold
|
||||
// a ref instead of making multiple calls. NrIceCtx uses threadsafe refcounting.
|
||||
query->iceCtx = mMedia->ice_ctx();
|
||||
if (!query->iceCtx) {
|
||||
CSFLogError(logTag, "Could not build stats query, no ice_ctx");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (!mThread) {
|
||||
CSFLogError(logTag, "Could not build stats query, no MainThread");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsresult rv = GetTimeSinceEpoch(&(query->now));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
CSFLogError(logTag, "Could not build stats query, could not get timestamp");
|
||||
return rv;
|
||||
@ -2884,8 +2889,6 @@ PeerConnectionImpl::BuildStatsQuery_m(
|
||||
}
|
||||
}
|
||||
|
||||
query->iceCtx = mMedia->ice_ctx();
|
||||
|
||||
// From the list of MediaPipelines, determine the set of NrIceMediaStreams
|
||||
// we are interested in.
|
||||
std::set<size_t> levelsToGrab;
|
||||
|
Loading…
Reference in New Issue
Block a user