Revert "Remove 'trackId' dependency in stats selector algorithm."
This reverts commit 81aab488781c1a736c9d85ff1532631be2989523. Reason for revert: external/wpt/webrtc/simulcast/setParameters-active.https.html is failing with this change Original change's description: > Remove 'trackId' dependency in stats selector algorithm. > > In preparation for the deletion of deprecated 'track' stats, the > stats selector algorithm needs to be rewritten not to use 'trackId'. > > This is achieved by finding RTP stats by their SSRC, as obtained via > getParameters(). This unfortunately adds a block-invoke (in the sender > case the block-invoke happens inside GetParametersInternal and in the > receiver case the block-invoke is explicit at the calling place), but > it can't be helped and it's just once per getStats() call and only if > the selector argument is used. > > Bug: webrtc:14175 > Change-Id: If0e14cdbdc76d141e0042e43757970893bf32119 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/289101 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#38981} Bug: webrtc:14175 Change-Id: Id1cbe892250fe88bd6db0b47269bcefa346709b4 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290502 Commit-Queue: Christoffer Jansson <jansson@google.com> Auto-Submit: Henrik Boström <hbos@webrtc.org> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Christoffer Jansson <jansson@google.com> Cr-Commit-Position: refs/heads/main@{#38993}
This commit is contained in:
parent
bd297a6c93
commit
07d64b4072
@ -1249,10 +1249,7 @@ void ProduceReceiverMediaTrackStats(
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
rtc::scoped_refptr<RTCStatsReport>
|
||||
RTCStatsCollector::CreateReportFilteredBySelector(
|
||||
rtc::scoped_refptr<RTCStatsReport> CreateReportFilteredBySelector(
|
||||
bool filter_by_sender_selector,
|
||||
rtc::scoped_refptr<const RTCStatsReport> report,
|
||||
rtc::scoped_refptr<RtpSenderInternal> sender_selector,
|
||||
@ -1261,40 +1258,40 @@ RTCStatsCollector::CreateReportFilteredBySelector(
|
||||
if (filter_by_sender_selector) {
|
||||
// Filter mode: RTCStatsCollector::RequestInfo::kSenderSelector
|
||||
if (sender_selector) {
|
||||
// Find outbound-rtp(s) of the sender using ssrc lookup.
|
||||
auto encodings = sender_selector->GetParametersInternal().encodings;
|
||||
for (const auto* outbound_rtp :
|
||||
report->GetStatsOfType<RTCOutboundRTPStreamStats>()) {
|
||||
RTC_DCHECK(outbound_rtp->ssrc.is_defined());
|
||||
auto it = std::find_if(
|
||||
encodings.begin(), encodings.end(),
|
||||
[ssrc =
|
||||
*outbound_rtp->ssrc](const RtpEncodingParameters& encoding) {
|
||||
return encoding.ssrc.has_value() && encoding.ssrc.value() == ssrc;
|
||||
});
|
||||
if (it != encodings.end()) {
|
||||
rtpstream_ids.push_back(outbound_rtp->id());
|
||||
// Find outbound-rtp(s) of the sender, i.e. the outbound-rtp(s) that
|
||||
// reference the sender stats.
|
||||
// Because we do not implement sender stats, we look at outbound-rtp(s)
|
||||
// that reference the track attachment stats for the sender instead.
|
||||
std::string track_id =
|
||||
DEPRECATED_RTCMediaStreamTrackStatsIDFromDirectionAndAttachment(
|
||||
kDirectionOutbound, sender_selector->AttachmentId());
|
||||
for (const auto& stats : *report) {
|
||||
if (stats.type() != RTCOutboundRTPStreamStats::kType)
|
||||
continue;
|
||||
const auto& outbound_rtp = stats.cast_to<RTCOutboundRTPStreamStats>();
|
||||
if (outbound_rtp.track_id.is_defined() &&
|
||||
*outbound_rtp.track_id == track_id) {
|
||||
rtpstream_ids.push_back(outbound_rtp.id());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Filter mode: RTCStatsCollector::RequestInfo::kReceiverSelector
|
||||
if (receiver_selector) {
|
||||
// Find the inbound-rtp of the receiver using ssrc lookup.
|
||||
absl::optional<uint32_t> ssrc;
|
||||
worker_thread_->BlockingCall([&] {
|
||||
auto encodings = receiver_selector->GetParameters().encodings;
|
||||
if (!encodings.empty()) {
|
||||
ssrc = encodings[0].ssrc;
|
||||
}
|
||||
});
|
||||
if (ssrc.has_value()) {
|
||||
for (const auto* inbound_rtp :
|
||||
report->GetStatsOfType<RTCInboundRTPStreamStats>()) {
|
||||
RTC_DCHECK(inbound_rtp->ssrc.is_defined());
|
||||
if (*inbound_rtp->ssrc == *ssrc) {
|
||||
rtpstream_ids.push_back(inbound_rtp->id());
|
||||
}
|
||||
// Find inbound-rtp(s) of the receiver, i.e. the inbound-rtp(s) that
|
||||
// reference the receiver stats.
|
||||
// Because we do not implement receiver stats, we look at inbound-rtp(s)
|
||||
// that reference the track attachment stats for the receiver instead.
|
||||
std::string track_id =
|
||||
DEPRECATED_RTCMediaStreamTrackStatsIDFromDirectionAndAttachment(
|
||||
kDirectionInbound, receiver_selector->AttachmentId());
|
||||
for (const auto& stats : *report) {
|
||||
if (stats.type() != RTCInboundRTPStreamStats::kType)
|
||||
continue;
|
||||
const auto& inbound_rtp = stats.cast_to<RTCInboundRTPStreamStats>();
|
||||
if (inbound_rtp.track_id.is_defined() &&
|
||||
*inbound_rtp.track_id == track_id) {
|
||||
rtpstream_ids.push_back(inbound_rtp.id());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1304,6 +1301,8 @@ RTCStatsCollector::CreateReportFilteredBySelector(
|
||||
return TakeReferencedStats(report->Copy(), rtpstream_ids);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RTCStatsCollector::CertificateStatsPair
|
||||
RTCStatsCollector::CertificateStatsPair::Copy() const {
|
||||
CertificateStatsPair copy;
|
||||
|
||||
@ -244,12 +244,6 @@ class RTCStatsCollector : public rtc::RefCountInterface,
|
||||
// This is a NO-OP if `network_report_` is null.
|
||||
void MergeNetworkReport_s();
|
||||
|
||||
rtc::scoped_refptr<RTCStatsReport> CreateReportFilteredBySelector(
|
||||
bool filter_by_sender_selector,
|
||||
rtc::scoped_refptr<const RTCStatsReport> report,
|
||||
rtc::scoped_refptr<RtpSenderInternal> sender_selector,
|
||||
rtc::scoped_refptr<RtpReceiverInternal> receiver_selector);
|
||||
|
||||
// Slots for signals (sigslot) that are wired up to `pc_`.
|
||||
void OnSctpDataChannelCreated(SctpDataChannel* channel);
|
||||
// Slots for signals (sigslot) that are wired up to `channel`.
|
||||
|
||||
@ -388,10 +388,7 @@ rtc::scoped_refptr<MockRtpSenderInternal> CreateMockSender(
|
||||
EXPECT_CALL(*sender, track()).WillRepeatedly(Return(track));
|
||||
EXPECT_CALL(*sender, ssrc()).WillRepeatedly(Return(ssrc));
|
||||
EXPECT_CALL(*sender, media_type()).WillRepeatedly(Return(media_type));
|
||||
EXPECT_CALL(*sender, GetParameters())
|
||||
.WillRepeatedly(
|
||||
Invoke([s = sender.get()]() { return s->GetParametersInternal(); }));
|
||||
EXPECT_CALL(*sender, GetParametersInternal()).WillRepeatedly(Invoke([ssrc]() {
|
||||
EXPECT_CALL(*sender, GetParameters()).WillRepeatedly(Invoke([ssrc]() {
|
||||
RtpParameters params;
|
||||
params.encodings.push_back(RtpEncodingParameters());
|
||||
params.encodings[0].ssrc = ssrc;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user