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

Unified Diff: third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h

Issue 2803693002: RTCRtpReceiver.getContributingSources() added. (Closed)
Patch Set: Addressed guidou's comments Created 3 years, 8 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
Index: third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h b/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h
index bc47664985182b0c321569c3e5a413e6bd039a1a..ba22835f7eb291296645f9244ffaff793d099b35 100644
--- a/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h
+++ b/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h
@@ -5,8 +5,11 @@
#ifndef RTCRtpReceiver_h
#define RTCRtpReceiver_h
+#include <map>
+
#include "bindings/core/v8/ScriptWrappable.h"
#include "modules/mediastream/MediaStreamTrack.h"
+#include "modules/peerconnection/RTCRtpContributingSource.h"
#include "platform/heap/GarbageCollected.h"
#include "platform/heap/Member.h"
#include "platform/heap/Visitor.h"
@@ -24,12 +27,31 @@ class RTCRtpReceiver final : public GarbageCollectedFinalized<RTCRtpReceiver>,
RTCRtpReceiver(std::unique_ptr<WebRTCRtpReceiver>, MediaStreamTrack*);
MediaStreamTrack* track() const;
+ const HeapVector<Member<RTCRtpContributingSource>>& getContributingSources();
+
+ void updateSourcesIfNeeded();
DECLARE_VIRTUAL_TRACE();
private:
+ void setContributingSourcesNeedsUpdating();
+
std::unique_ptr<WebRTCRtpReceiver> m_receiver;
Member<MediaStreamTrack> m_track;
+
+ // All contributing sources that have ever been returned by
+ // |getContributingSources| that are still alive. If |updateSourcesIfNeeded|
+ // encounters a source that already has an associate
+ // |RTCRtpContributingSource| it will be kept up-to-date. Garbage collected
+ // sources are automatically removed from the map.
+ HeapHashMap<uint32_t,
+ WeakMember<RTCRtpContributingSource>,
+ typename DefaultHash<uint32_t>::Hash,
+ WTF::UnsignedWithZeroKeyHashTraits<uint32_t>>
+ m_contributingSourcesBySourceId;
+ // The current contributing sources (|getContributingSources|).
+ HeapVector<Member<RTCRtpContributingSource>> m_contributingSources;
+ bool m_contributingSourcesNeedsUpdating = true;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698