Bug 1271669 - Don't rely on streams for getStats(). r=jib, r=bwc

MozReview-Commit-ID: 8I6YowAAGcW

--HG--
extra : rebase_source : 185c4dc7dffcd927b0c5c1ad5d34fcaacb857feb
extra : histedit_source : 9b796fbbf72103eab3eba13381ab6244b424751f
This commit is contained in:
Andreas Pehrson 2016-05-18 15:00:21 +02:00
Родитель 299b4666bb
Коммит 02e322e6f2
1 изменённых файлов: 7 добавлений и 26 удалений

Просмотреть файл

@ -3338,35 +3338,16 @@ PeerConnectionImpl::BuildStatsQuery_m(
}
for (int i = 0, len = mMedia->LocalStreamsLength(); i < len; i++) {
auto& pipelines = mMedia->GetLocalStreamByIndex(i)->GetPipelines();
if (aSelector) {
if (mMedia->GetLocalStreamByIndex(i)->GetMediaStream()->
HasTrack(*aSelector)) {
auto it = pipelines.find(trackId);
if (it != pipelines.end()) {
query->pipelines.AppendElement(it->second);
}
}
} else {
for (auto it = pipelines.begin(); it != pipelines.end(); ++it) {
query->pipelines.AppendElement(it->second);
for (auto pipeline : mMedia->GetLocalStreamByIndex(i)->GetPipelines()) {
if (!aSelector || pipeline.second->trackid() == trackId) {
query->pipelines.AppendElement(pipeline.second);
}
}
}
for (size_t i = 0, len = mMedia->RemoteStreamsLength(); i < len; i++) {
auto& pipelines = mMedia->GetRemoteStreamByIndex(i)->GetPipelines();
if (aSelector) {
if (mMedia->GetRemoteStreamByIndex(i)->
GetMediaStream()->HasTrack(*aSelector)) {
auto it = pipelines.find(trackId);
if (it != pipelines.end()) {
query->pipelines.AppendElement(it->second);
}
}
} else {
for (auto it = pipelines.begin(); it != pipelines.end(); ++it) {
query->pipelines.AppendElement(it->second);
for (int i = 0, len = mMedia->RemoteStreamsLength(); i < len; i++) {
for (auto pipeline : mMedia->GetRemoteStreamByIndex(i)->GetPipelines()) {
if (!aSelector || pipeline.second->trackid() == trackId) {
query->pipelines.AppendElement(pipeline.second);
}
}
}