2
2
3
3
#include " base/scoped_ref_ptr.h"
4
4
#include " flutter_data_channel.h"
5
+ #include " flutter_frame_capturer.h"
5
6
#include " rtc_dtmf_sender.h"
6
7
#include " rtc_rtp_parameters.h"
7
8
@@ -107,21 +108,26 @@ EncodableMap rtpParametersToMap(
107
108
}
108
109
info[EncodableValue (" codecs" )] = EncodableValue (codecs_info);
109
110
110
- switch (rtpParameters->GetDegradationPreference ()) {
111
+ switch (rtpParameters->GetDegradationPreference ()) {
111
112
case libwebrtc::RTCDegradationPreference::MAINTAIN_FRAMERATE:
112
- info[EncodableValue (" degradationPreference" )] = EncodableValue (" maintain-framerate" );
113
+ info[EncodableValue (" degradationPreference" )] =
114
+ EncodableValue (" maintain-framerate" );
113
115
break ;
114
116
case libwebrtc::RTCDegradationPreference::MAINTAIN_RESOLUTION:
115
- info[EncodableValue (" degradationPreference" )] = EncodableValue (" maintain-resolution" );
117
+ info[EncodableValue (" degradationPreference" )] =
118
+ EncodableValue (" maintain-resolution" );
116
119
break ;
117
120
case libwebrtc::RTCDegradationPreference::BALANCED:
118
- info[EncodableValue (" degradationPreference" )] = EncodableValue (" balanced" );
121
+ info[EncodableValue (" degradationPreference" )] =
122
+ EncodableValue (" balanced" );
119
123
break ;
120
124
case libwebrtc::RTCDegradationPreference::DISABLED:
121
- info[EncodableValue (" degradationPreference" )] = EncodableValue (" disabled" );
125
+ info[EncodableValue (" degradationPreference" )] =
126
+ EncodableValue (" disabled" );
122
127
break ;
123
128
default :
124
- info[EncodableValue (" degradationPreference" )] = EncodableValue (" balanced" );
129
+ info[EncodableValue (" degradationPreference" )] =
130
+ EncodableValue (" balanced" );
125
131
break ;
126
132
}
127
133
@@ -205,7 +211,8 @@ EncodableMap rtpReceiverToMap(
205
211
206
212
EncodableMap transceiverToMap (scoped_refptr<RTCRtpTransceiver> transceiver) {
207
213
EncodableMap info;
208
- info[EncodableValue (" transceiverId" )] = EncodableValue (transceiver->transceiver_id ().std_string ());
214
+ info[EncodableValue (" transceiverId" )] =
215
+ EncodableValue (transceiver->transceiver_id ().std_string ());
209
216
info[EncodableValue (" mid" )] = EncodableValue (transceiver->mid ().std_string ());
210
217
info[EncodableValue (" direction" )] =
211
218
EncodableValue (transceiverDirectionString (transceiver->direction ()));
@@ -272,7 +279,6 @@ void FlutterPeerConnection::RTCPeerConnectionClose(
272
279
RTCPeerConnection* pc,
273
280
const std::string& uuid,
274
281
std::unique_ptr<MethodResultProxy> result) {
275
-
276
282
auto it2 = base_->peerconnections_ .find (uuid);
277
283
if (it2 != base_->peerconnections_ .end ()) {
278
284
it2->second ->Close ();
@@ -282,7 +288,7 @@ void FlutterPeerConnection::RTCPeerConnectionClose(
282
288
auto it = base_->peerconnection_observers_ .find (uuid);
283
289
if (it != base_->peerconnection_observers_ .end ())
284
290
base_->peerconnection_observers_ .erase (it);
285
-
291
+
286
292
result->Success ();
287
293
}
288
294
@@ -643,18 +649,23 @@ scoped_refptr<RTCRtpParameters> FlutterPeerConnection::updateRtpParameters(
643
649
encoding++;
644
650
}
645
651
}
646
-
647
- EncodableValue value = findEncodableValue (newParameters, " degradationPreference" );
648
- if (!value.IsNull ()) {
652
+
653
+ EncodableValue value =
654
+ findEncodableValue (newParameters, " degradationPreference" );
655
+ if (!value.IsNull ()) {
649
656
const std::string degradationPreference = GetValue<std::string>(value);
650
- if ( degradationPreference == " maintain-framerate" ) {
651
- parameters->SetDegradationPreference (libwebrtc::RTCDegradationPreference::MAINTAIN_FRAMERATE);
652
- } else if (degradationPreference == " maintain-resolution" ) {
653
- parameters->SetDegradationPreference (libwebrtc::RTCDegradationPreference::MAINTAIN_RESOLUTION);
654
- } else if (degradationPreference == " balanced" ) {
655
- parameters->SetDegradationPreference (libwebrtc::RTCDegradationPreference::BALANCED);
656
- } else if (degradationPreference == " disabled" ) {
657
- parameters->SetDegradationPreference (libwebrtc::RTCDegradationPreference::DISABLED);
657
+ if (degradationPreference == " maintain-framerate" ) {
658
+ parameters->SetDegradationPreference (
659
+ libwebrtc::RTCDegradationPreference::MAINTAIN_FRAMERATE);
660
+ } else if (degradationPreference == " maintain-resolution" ) {
661
+ parameters->SetDegradationPreference (
662
+ libwebrtc::RTCDegradationPreference::MAINTAIN_RESOLUTION);
663
+ } else if (degradationPreference == " balanced" ) {
664
+ parameters->SetDegradationPreference (
665
+ libwebrtc::RTCDegradationPreference::BALANCED);
666
+ } else if (degradationPreference == " disabled" ) {
667
+ parameters->SetDegradationPreference (
668
+ libwebrtc::RTCDegradationPreference::DISABLED);
658
669
}
659
670
}
660
671
@@ -711,8 +722,8 @@ void FlutterPeerConnection::RtpTransceiverGetCurrentDirection(
711
722
return ;
712
723
}
713
724
EncodableMap map;
714
- map[EncodableValue (" result" )] =
715
- EncodableValue ( transceiverDirectionString (transceiver->current_direction ()));
725
+ map[EncodableValue (" result" )] = EncodableValue (
726
+ transceiverDirectionString (transceiver->current_direction ()));
716
727
result_ptr->Success (EncodableValue (map));
717
728
}
718
729
@@ -731,11 +742,8 @@ void FlutterPeerConnection::CaptureFrame(
731
742
RTCVideoTrack* track,
732
743
std::string path,
733
744
std::unique_ptr<MethodResultProxy> result) {
734
- std::shared_ptr<MethodResultProxy> result_ptr (result.release ());
735
-
736
- // TODO pc->CaptureFrame();
737
-
738
- result_ptr->Success ();
745
+ FlutterFrameCapturer capturer (track, path);
746
+ capturer.CaptureFrame (std::move (result));
739
747
}
740
748
741
749
scoped_refptr<RTCRtpTransceiver> FlutterPeerConnection::getRtpTransceiverById (
0 commit comments