Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: webrtc/call/rtp_rtcp_demuxer_helper.h

Issue 2993053002: Reland of SSRC and RSID may only refer to one sink each in RtpDemuxer (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/call/rtp_demuxer_unittest.cc ('k') | webrtc/call/rtp_stream_receiver_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 @@
[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 @@
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 @@
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);
« no previous file with comments | « webrtc/call/rtp_demuxer_unittest.cc ('k') | webrtc/call/rtp_stream_receiver_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698