RTCDataChannel: Ignore "id" when "negotiated" is false

This updates behavior to be aligned with the WebRTC spec.

Bug: chromium:948055
Change-Id: Id3bbf05b3df084c9b7f7d12598c09187679d60fc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130493
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27394}
This commit is contained in:
Harald Alvestrand
2019-04-01 12:58:15 +02:00
committed by Commit Bot
parent 4124dab7f3
commit 5c4d2ee615
3 changed files with 11 additions and 2 deletions

View File

@ -2141,6 +2141,7 @@ TEST_P(PeerConnectionInterfaceTest,
rtc::scoped_refptr<DataChannelInterface> channel;
config.id = 1;
config.negotiated = true;
channel = pc_->CreateDataChannel("1", &config);
EXPECT_TRUE(channel != NULL);
EXPECT_EQ(1, channel->id());
@ -2149,11 +2150,13 @@ TEST_P(PeerConnectionInterfaceTest,
EXPECT_TRUE(channel == NULL);
config.id = cricket::kMaxSctpSid;
config.negotiated = true;
channel = pc_->CreateDataChannel("max", &config);
EXPECT_TRUE(channel != NULL);
EXPECT_EQ(config.id, channel->id());
config.id = cricket::kMaxSctpSid + 1;
config.negotiated = true;
channel = pc_->CreateDataChannel("x", &config);
EXPECT_TRUE(channel == NULL);
}