Make ID of datachannel stats not depend on dc.id
The ID of stats was based on the datachannel's "id" attribute, but that could change - it was -1 before ID allocation, and a number afterwards. This CL changes the stats ID to depend on a monotonically increasing counter for allocated datachannels. Bug: webrtc:10842 Change-Id: I3e0c5dc07df8a7a502396de06bbedc9f676994a0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147642 Reviewed-by: Henrik Boström <hbos@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28720}
This commit is contained in:

committed by
Commit Bot

parent
97e015fa8e
commit
928e7a3e79
@ -942,7 +942,20 @@ TEST_F(RTCStatsCollectorTest, CollectRTCCertificateStatsChain) {
|
||||
ExpectReportContainsCertificateInfo(report, *remote_certinfo);
|
||||
}
|
||||
|
||||
TEST_F(RTCStatsCollectorTest, CollectTwoRTCDataChannelStatsWithPendingId) {
|
||||
pc_->AddSctpDataChannel(
|
||||
new MockDataChannel(/*id=*/-1, DataChannelInterface::kConnecting));
|
||||
pc_->AddSctpDataChannel(
|
||||
new MockDataChannel(/*id=*/-1, DataChannelInterface::kConnecting));
|
||||
|
||||
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
|
||||
}
|
||||
|
||||
TEST_F(RTCStatsCollectorTest, CollectRTCDataChannelStats) {
|
||||
// Note: The test assumes data channel IDs are predictable.
|
||||
// This is not a safe assumption, but in order to make it work for
|
||||
// the test, we reset the ID allocator at test start.
|
||||
DataChannel::ResetInternalIdAllocatorForTesting(-1);
|
||||
pc_->AddSctpDataChannel(new MockDataChannel(0, "MockDataChannel0",
|
||||
DataChannelInterface::kConnecting,
|
||||
"udp", 1, 2, 3, 4));
|
||||
|
Reference in New Issue
Block a user