@@ -9,10 +9,11 @@ using namespace flutter;
9
9
10
10
class FlutterPeerConnectionObserver : public RTCPeerConnectionObserver {
11
11
public:
12
- FlutterPeerConnectionObserver (FlutterWebRTCBase * base,
12
+ FlutterPeerConnectionObserver (FlutterWebRTCBase* base,
<
F438
/tr>13
13
scoped_refptr<RTCPeerConnection> peerconnection,
14
- BinaryMessenger *messenger,
15
- const std::string &channel_name);
14
+ BinaryMessenger* messenger,
15
+ const std::string& channel_name,
16
+ std::string& peerConnectionId);
16
17
17
18
virtual void OnSignalingState (RTCSignalingState state) override ;
18
19
virtual void OnIceGatheringState (RTCIceGatheringState state) override ;
@@ -21,68 +22,182 @@ class FlutterPeerConnectionObserver : public RTCPeerConnectionObserver {
21
22
scoped_refptr<RTCIceCandidate> candidate) override ;
22
23
virtual void OnAddStream (scoped_refptr<RTCMediaStream> stream) override ;
23
24
virtual void OnRemoveStream (scoped_refptr<RTCMediaStream> stream) override ;
24
- virtual void OnAddTrack (scoped_refptr<RTCMediaStream> stream,
25
- scoped_refptr<RTCMediaTrack> track) override ;
26
- virtual void OnRemoveTrack (scoped_refptr<RTCMediaStream> stream,
27
- scoped_refptr<RTCMediaTrack> track) override ;
25
+
26
+ virtual void OnTrack (scoped_refptr<RTCRtpTransceiver> transceiver) override ;
27
+ virtual void OnAddTrack (vector<scoped_refptr<RTCMediaStream>> streams,
28
+ scoped_refptr<RTCRtpReceiver> receiver) override ;
29
+ virtual void OnRemoveTrack (scoped_refptr<RTCRtpReceiver> receiver) override ;
28
30
virtual void OnDataChannel (
29
31
scoped_refptr<RTCDataChannel> data_channel) override ;
30
32
virtual void OnRenegotiationNeeded () override ;
31
33
32
- scoped_refptr<RTCMediaStream> MediaStreamForId (
33
- const std::string &id) {
34
- auto it = remote_streams_.find (id);
35
- if (it != remote_streams_.end ()) return (*it).second ;
36
- return nullptr ;
37
- }
34
+ scoped_refptr<RTCMediaStream> MediaStreamForId (const std::string& id);
38
35
39
- void RemoveStreamForId (const std::string &id) {
40
- auto it = remote_streams_.find (id);
41
- if (it != remote_streams_.end ()) remote_streams_.erase (it);
42
- }
36
+ void RemoveStreamForId (const std::string& id);
43
37
44
38
private:
45
39
std::unique_ptr<EventChannel<EncodableValue>> event_channel_;
46
40
std::unique_ptr<EventSink<EncodableValue>> event_sink_;
47
41
scoped_refptr<RTCPeerConnection> peerconnection_;
48
42
std::map<std::string, scoped_refptr<RTCMediaStream>> remote_streams_;
49
- FlutterWebRTCBase *base_;
43
+ FlutterWebRTCBase* base_;
44
+ std::string id_;
50
45
};
51
46
52
47
class FlutterPeerConnection {
53
48
public:
54
- FlutterPeerConnection (FlutterWebRTCBase * base) : base_(base) {}
49
+ FlutterPeerConnection (FlutterWebRTCBase* base) : base_(base) {}
55
50
56
51
void CreateRTCPeerConnection (
57
- const EncodableMap &configuration, const EncodableMap &constraints,
52
+ const EncodableMap& configuration,
53
+ const EncodableMap& constraints,
58
54
std::unique_ptr<MethodResult<EncodableValue>> result);
59
55
60
56
void RTCPeerConnectionClose (
61
- RTCPeerConnection *pc, const std::string &uuid,
57
+ RTCPeerConnection* pc,
58
+ const std::string& uuid,
59
+ std::unique_ptr<MethodResult<EncodableValue>> result);
60
+
61
+ void RTCPeerConnectionDispose (
62
+ RTCPeerConnection* pc,
63
+ const std::string& uuid,
62
64
std::unique_ptr<MethodResult<EncodableValue>> result);
63
65
64
- void CreateOffer (const EncodableMap &constraints, RTCPeerConnection *pc,
66
+ void CreateOffer (const EncodableMap& constraints,
67
+ RTCPeerConnection* pc,
65
68
std::unique_ptr<MethodResult<EncodableValue>> result);
66
69
67
- void CreateAnswer (const EncodableMap &constraints, RTCPeerConnection *pc,
70
+ void CreateAnswer (const EncodableMap& constraints,
71
+ RTCPeerConnection* pc,
68
72
std::unique_ptr<MethodResult<EncodableValue>> result);
69
73
70
74
void SetLocalDescription (
71
- RTCSessionDescription *sdp, RTCPeerConnection *pc,
75
+ RTCSessionDescription* sdp,
76
+ RTCPeerConnection* pc,
72
77
std::unique_ptr<MethodResult<EncodableValue>> result);
73
78
74
79
void SetRemoteDescription (
75
- RTCSessionDescription *sdp, RTCPeerConnection *pc,
80
+ RTCSessionDescription* sdp,
81
+ RTCPeerConnection* pc,
82
+ std::unique_ptr<MethodResult<EncodableValue>> result);
83
+
84
+ void GetLocalDescription (
85
+ RTCPeerConnection* pc,
76
86
std::unique_ptr<MethodResult<EncodableValue>> result);
77
87
78
- void AddIceCandidate (RTCIceCandidate *candidate, RTCPeerConnection *pc,
88
+ void GetRemoteDescription (
89
+ RTCPeerConnection* pc,
90
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
91
+
92
+ scoped_refptr<RTCRtpTransceiverInit> mapToRtpTransceiverInit (
93
+ const EncodableMap& transceiverInit);
94
+
95
+ RTCRtpTransceiverDirection stringToTransceiverDirection (
96
+ std::string direction);
97
+
98
+ libwebrtc::scoped_refptr<libwebrtc::RTCRtpEncodingParameters> mapToEncoding (
99
+ const EncodableMap& parameters);
100
+
101
+ void AddTransceiver (RTCPeerConnection* pc,
102
+ const std::string& trackId,
103
+ const std::string& mediaType,
104
+ const EncodableMap& transceiverInit,
105
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
106
+
107
+ void GetTransceivers (RTCPeerConnection* pc,
108
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
109
+
110
+ void GetReceivers (RTCPeerConnection* pc,
111
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
112
+
113
+ void RtpSenderDispose (RTCPeerConnection* pc,
114
+ std::string rtpSenderId,
115
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
116
+
117
+ void RtpSenderSetTrack (RTCPeerConnection* pc,
118
+ RTCMediaTrack* track,
119
+ std::string rtpSenderId,
120
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
121
+
122
+ void
1CF5
RtpSenderReplaceTrack (
123
+ RTCPeerConnection* pc,
124
+ RTCMediaTrack* track,
125
+ std::string rtpSenderId,
126
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
127
+
128
+ scoped_refptr<RTCRtpParameters> updateRtpParameters (
129
+ EncodableMap newParameters,
130
+ scoped_refptr<RTCRtpParameters> parameters);
131
+
132
+ void RtpSenderSetParameters (
133
+ RTCPeerConnection* pc,
134
+ std::string rtpSenderId,
135
+ const EncodableMap& parameters,
136
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
137
+
138
+ void RtpTransceiverStop (
139
+ RTCPeerConnection* pc,
140
+ std::string rtpTransceiverId,
141
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
142
+
143
+ void RtpTransceiverGetCurrentDirection (
144
+ RTCPeerConnection* pc,
145
+ std::string rtpTransceiverId,
146
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
147
+
148
+ void SetConfiguration (RTCPeerConnection* pc,
149
+ const EncodableMap& configuration,
150
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
151
+
152
+ void CaptureFrame (RTCVideoTrack* track,
153
+ std::string path,
154
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
155
+
156
+ scoped_refptr<RTCRtpTransceiver> getRtpTransceiverById (RTCPeerConnection* pc,
157
+ std::string id);
158
+
159
+ void RtpTransceiverSetDirection (
160
+ RTCPeerConnection* pc,
161
+ std::string rtpTransceiverId,
162
+ std::string direction,
163
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
164
+
165
+ void GetSenders (RTCPeerConnection* pc,
166
+ std::unique_ptr<MethodResult<EncodableValue>> resulte);
167
+
168
+ void AddIceCandidate (RTCIceCandidate* candidate,
169
+ RTCPeerConnection* pc,
79
170
std::unique_ptr<MethodResult<EncodableValue>> result);
80
171
81
- void GetStats (const std::string &track_id, RTCPeerConnection *pc,
172
+ void GetStats (const std::string& track_id,
173
+ RTCPeerConnection* pc,
174
+ std::unique_ptr<MethodResult<EncodableValue>> result);
175
+
176
+ void MediaStreamAddTrack (
177
+ scoped_refptr<RTCMediaStream> stream,
178
+ scoped_refptr<RTCMediaTrack> track,
179
+ std::unique_ptr<MethodResult<EncodableValue>> result);
180
+
181
+ void MediaStreamRemoveTrack (
182
+ scoped_refptr<RTCMediaStream> stream,
183
+ scoped_refptr<RTCMediaTrack> track,
184
+ std::unique_ptr<MethodResult<EncodableValue>> result);
185
+
186
+ void AddTrack (RTCPeerConnection* pc,
187
+ scoped_refptr<RTCMediaTrack> track,
188
+ std::list<std::string> streamIds,
82
189
std::unique_ptr<MethodResult<EncodableValue>> result);
83
190
191
+ libwebrtc::scoped_refptr<libwebrtc::RTCRtpSender> GetRtpSenderById (
192
+ RTCPeerConnection* pc,
193
+ std::string id);
194
+
195
+ void RemoveTrack (RTCPeerConnection* pc,
196
+ std::string senderId,
197
+ std::unique_ptr<MethodResult<EncodableValue>> result);
198
+
84
199
private:
85
- FlutterWebRTCBase * base_;
200
+ FlutterWebRTCBase* base_;
86
201
};
87
202
} // namespace flutter_webrtc_plugin
88
203
0 commit comments