Fix handling of empty BUNDLE groups.

This CL fixes issues when applying a description with an empty BUNDLE
group (previously it would fail, after recent refactoring it started
crashing).

This CL also will cause an empty BUNDLE group to be generated when it
should be. Namely, when responding to an offer that had a BUNDLE group,
rejecting everything in it.

Bug: chromium:831996
Change-Id: I4e705a328daef4e81f8f1ace6aa73ddfa13c0107
Reviewed-on: https://webrtc-review.googlesource.com/69720
Reviewed-by: Zhi Huang <zhihuang@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22844}
This commit is contained in:
Taylor Brandstetter
2018-04-12 10:30:48 -07:00
committed by Commit Bot
parent 4ab6c9d62c
commit 0ab56511f1
4 changed files with 52 additions and 7 deletions

View File

@ -1494,10 +1494,17 @@ SessionDescription* MediaSessionDescriptionFactory::CreateAnswer(
}
}
// Only put BUNDLE group in answer if nonempty.
if (answer_bundle.FirstContentName()) {
// If a BUNDLE group was offered, put a BUNDLE group in the answer even if
// it's empty. RFC5888 says:
//
// A SIP entity that receives an offer that contains an "a=group" line
// with semantics that are understood MUST return an answer that
// contains an "a=group" line with the same semantics.
if (offer_bundle) {
answer->AddGroup(answer_bundle);
}
if (answer_bundle.FirstContentName()) {
// Share the same ICE credentials and crypto params across all contents,
// as BUNDLE requires.
if (!UpdateTransportInfoForBundle(answer_bundle, answer.get())) {