forked from JumpingYang001/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move group-modifying functions into BundleManager
Bug: webrtc:12837 Change-Id: I886ec89427207e1dc291c9959f1b6113c97cbca3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221616 Reviewed-by: Henrik Boström <[email protected]> Commit-Queue: Harald Alvestrand <[email protected]> Cr-Commit-Position: refs/heads/master@{#34246}
- Loading branch information
Harald Alvestrand
authored and
WebRTC LUCI CQ
committed
Jun 8, 2021
1 parent
9f9bf38
commit 2aa24f1
Showing
4 changed files
with
63 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2021 The WebRTC Project Authors. All rights reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. An additional intellectual property rights grant can be found | ||
* in the file PATENTS. All contributing project authors may | ||
* be found in the AUTHORS file in the root of the source tree. | ||
*/ | ||
|
||
#include "pc/bundle_manager.h" | ||
|
||
namespace webrtc { | ||
|
||
void BundleManager::Update(const cricket::SessionDescription* description) { | ||
bundle_groups_.clear(); | ||
for (const cricket::ContentGroup* new_bundle_group : | ||
description->GetGroupsByName(cricket::GROUP_TYPE_BUNDLE)) { | ||
bundle_groups_.push_back( | ||
std::make_unique<cricket::ContentGroup>(*new_bundle_group)); | ||
} | ||
} | ||
|
||
void BundleManager::DeleteMid(const cricket::ContentGroup* bundle_group, | ||
const std::string& mid) { | ||
// Remove the rejected content from the |bundle_group|. | ||
// The const pointer arg is used to identify the group, we verify | ||
// it before we use it to make a modification. | ||
auto bundle_group_it = std::find_if( | ||
bundle_groups_.begin(), bundle_groups_.end(), | ||
[bundle_group](std::unique_ptr<cricket::ContentGroup>& group) { | ||
return bundle_group == group.get(); | ||
}); | ||
RTC_DCHECK(bundle_group_it != bundle_groups_.end()); | ||
(*bundle_group_it)->RemoveContentName(mid); | ||
} | ||
|
||
void BundleManager::DeleteGroup(const cricket::ContentGroup* bundle_group) { | ||
// Delete the BUNDLE group. | ||
auto bundle_group_it = std::find_if( | ||
bundle_groups_.begin(), bundle_groups_.end(), | ||
[bundle_group](std::unique_ptr<cricket::ContentGroup>& group) { | ||
return bundle_group == group.get(); | ||
}); | ||
RTC_DCHECK(bundle_group_it != bundle_groups_.end()); | ||
bundle_groups_.erase(bundle_group_it); | ||
} | ||
|
||
} // namespace webrtc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters