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

Side by Side Diff: third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h

Issue 2808113002: Reland of TCRtpReceiver.getContributingSources() added. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef RTCRtpReceiver_h 5 #ifndef RTCRtpReceiver_h
6 #define RTCRtpReceiver_h 6 #define RTCRtpReceiver_h
7 7
8 #include <map>
9
8 #include "bindings/core/v8/ScriptWrappable.h" 10 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "modules/mediastream/MediaStreamTrack.h" 11 #include "modules/mediastream/MediaStreamTrack.h"
12 #include "modules/peerconnection/RTCRtpContributingSource.h"
10 #include "platform/heap/GarbageCollected.h" 13 #include "platform/heap/GarbageCollected.h"
11 #include "platform/heap/Member.h" 14 #include "platform/heap/Member.h"
12 #include "platform/heap/Visitor.h" 15 #include "platform/heap/Visitor.h"
13 #include "public/platform/WebRTCRtpReceiver.h" 16 #include "public/platform/WebRTCRtpReceiver.h"
14 17
15 namespace blink { 18 namespace blink {
16 19
17 // https://w3c.github.io/webrtc-pc/#rtcrtpreceiver-interface 20 // https://w3c.github.io/webrtc-pc/#rtcrtpreceiver-interface
18 class RTCRtpReceiver final : public GarbageCollectedFinalized<RTCRtpReceiver>, 21 class RTCRtpReceiver final : public GarbageCollectedFinalized<RTCRtpReceiver>,
19 public ScriptWrappable { 22 public ScriptWrappable {
20 DEFINE_WRAPPERTYPEINFO(); 23 DEFINE_WRAPPERTYPEINFO();
21 24
22 public: 25 public:
23 // Takes ownership of the receiver. 26 // Takes ownership of the receiver.
24 RTCRtpReceiver(std::unique_ptr<WebRTCRtpReceiver>, MediaStreamTrack*); 27 RTCRtpReceiver(std::unique_ptr<WebRTCRtpReceiver>, MediaStreamTrack*);
25 28
26 MediaStreamTrack* track() const; 29 MediaStreamTrack* track() const;
30 const HeapVector<Member<RTCRtpContributingSource>>& getContributingSources();
31
32 void UpdateSourcesIfNeeded();
27 33
28 DECLARE_VIRTUAL_TRACE(); 34 DECLARE_VIRTUAL_TRACE();
29 35
30 private: 36 private:
37 void SetContributingSourcesNeedsUpdating();
38
31 std::unique_ptr<WebRTCRtpReceiver> receiver_; 39 std::unique_ptr<WebRTCRtpReceiver> receiver_;
32 Member<MediaStreamTrack> track_; 40 Member<MediaStreamTrack> track_;
41
42 // All contributing sources that have ever been returned by
43 // |getContributingSources| that are still alive. If |UpdateSourcesIfNeeded|
44 // encounters a source that already has an associate
45 // |RTCRtpContributingSource| it will be kept up-to-date. Garbage collected
46 // sources are automatically removed from the map.
47 HeapHashMap<uint32_t,
48 WeakMember<RTCRtpContributingSource>,
49 typename DefaultHash<uint32_t>::Hash,
50 WTF::UnsignedWithZeroKeyHashTraits<uint32_t>>
51 contributing_sources_by_source_id_;
52 // The current contributing sources (|getContributingSources|).
53 HeapVector<Member<RTCRtpContributingSource>> contributing_sources_;
54 bool contributing_sources_needs_updating_ = true;
33 }; 55 };
34 56
35 } // namespace blink 57 } // namespace blink
36 58
37 #endif // RTCRtpReceiver_h 59 #endif // RTCRtpReceiver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698