| Index: webrtc/call/rtp_rtcp_demuxer_helper.h
|
| diff --git a/webrtc/call/rtp_rtcp_demuxer_helper.h b/webrtc/call/rtp_rtcp_demuxer_helper.h
|
| index 4791e55ca39e153fd2c2c701544f1b38848098b9..85204365fb5b14b1704b3d212aafde588939f6f7 100644
|
| --- a/webrtc/call/rtp_rtcp_demuxer_helper.h
|
| +++ b/webrtc/call/rtp_rtcp_demuxer_helper.h
|
| @@ -21,6 +21,7 @@
|
|
|
| namespace webrtc {
|
|
|
| +// TODO(eladalon): Remove this in the next CL.
|
| template <typename Container>
|
| bool MultimapAssociationExists(const Container& multimap,
|
| const typename Container::key_type& key,
|
| @@ -31,6 +32,7 @@ bool MultimapAssociationExists(const Container& multimap,
|
| [val](Reference elem) { return elem.second == val; });
|
| }
|
|
|
| +// TODO(eladalon): Remove this in the next CL.
|
| template <typename Container, typename Value>
|
| size_t RemoveFromMultimapByValue(Container* multimap, const Value& value) {
|
| size_t count = 0;
|
| @@ -45,11 +47,26 @@ size_t RemoveFromMultimapByValue(Container* multimap, const Value& value) {
|
| return count;
|
| }
|
|
|
| +template <typename Map, typename Value>
|
| +size_t RemoveFromMapByValue(Map* map, const Value& value) {
|
| + size_t count = 0;
|
| + for (auto it = map->begin(); it != map->end();) {
|
| + if (it->second == value) {
|
| + it = map->erase(it);
|
| + ++count;
|
| + } else {
|
| + ++it;
|
| + }
|
| + }
|
| + return count;
|
| +}
|
| +
|
| template <typename Container, typename Key>
|
| bool ContainerHasKey(const Container& c, const Key& k) {
|
| return std::find(c.cbegin(), c.cend(), k) != c.cend();
|
| }
|
|
|
| +// TODO(eladalon): Remove this in the next CL.
|
| template <typename Container>
|
| bool MultimapHasValue(const Container& c,
|
| const typename Container::mapped_type& v) {
|
| @@ -59,6 +76,14 @@ bool MultimapHasValue(const Container& c,
|
| return std::any_of(c.cbegin(), c.cend(), predicate);
|
| }
|
|
|
| +template <typename Map>
|
| +bool MapHasValue(const Map& map, const typename Map::mapped_type& value) {
|
| + auto predicate = [value](const typename Map::value_type& it) {
|
| + return it.second == value;
|
| + };
|
| + return std::any_of(map.cbegin(), map.cend(), predicate);
|
| +}
|
| +
|
| rtc::Optional<uint32_t> ParseRtcpPacketSenderSsrc(
|
| rtc::ArrayView<const uint8_t> packet);
|
|
|
|
|