OLD | NEW |
---|---|
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> m_receiver; | 39 std::unique_ptr<WebRTCRtpReceiver> m_receiver; |
32 Member<MediaStreamTrack> m_track; | 40 Member<MediaStreamTrack> m_track; |
41 | |
42 // All contributing sources that has ever been returned by | |
Guido Urdaneta
2017/04/06 12:54:56
s/has/have
hbos_chromium
2017/04/06 14:49:38
Done.
| |
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 m_contributingSourcesBySourceId; | |
52 // The current contributing sources (|getContributingSources|). | |
53 HeapVector<Member<RTCRtpContributingSource>> m_contributingSources; | |
54 bool m_contributingSourcesNeedsUpdating = true; | |
33 }; | 55 }; |
34 | 56 |
35 } // namespace blink | 57 } // namespace blink |
36 | 58 |
37 #endif // RTCRtpReceiver_h | 59 #endif // RTCRtpReceiver_h |
OLD | NEW |