fromFFI static method
Creates an RtcStatsType basing on the ffi.RtcStatsType
received from
the native side.
Implementation
static RtcStatsType? fromFFI(ffi.RtcStatsType stats) {
switch (stats.runtimeType.toString().substring(2)) // Skip '_$' prefix.
{
case 'RtcStatsType_RtcMediaSourceStatsImpl':
{
var source = (stats as ffi.RtcStatsType_RtcMediaSourceStats);
if (source.kind
is ffi.RtcMediaSourceStatsMediaType_RtcAudioSourceStats) {
return RtcAudioSourceStats.fromFFI(
stats.kind
as ffi.RtcMediaSourceStatsMediaType_RtcAudioSourceStats,
stats.trackIdentifier);
} else {
return RtcVideoSourceStats.fromFFI(
stats.kind
as ffi.RtcMediaSourceStatsMediaType_RtcVideoSourceStats,
stats.trackIdentifier);
}
}
case 'RtcStatsType_RtcIceCandidateStatsImpl':
{
return RtcIceCandidateStats.fromFFI(
stats as ffi.RtcStatsType_RtcIceCandidateStats);
}
case 'RtcStatsType_RtcOutboundRtpStreamStatsImpl':
{
return RtcOutboundRtpStreamStats.fromFFI(
stats as ffi.RtcStatsType_RtcOutboundRtpStreamStats);
}
case 'RtcStatsType_RtcInboundRtpStreamStatsImpl':
{
return RtcInboundRtpStreamStats.fromFFI(
stats as ffi.RtcStatsType_RtcInboundRtpStreamStats);
}
case 'RtcStatsType_RtcTransportStatsImpl':
{
return RtcTransportStats.fromFFI(
stats as ffi.RtcStatsType_RtcTransportStats);
}
case 'RtcStatsType_RtcRemoteInboundRtpStreamStatsImpl':
{
return RtcRemoteInboundRtpStreamStats.fromFFI(
stats as ffi.RtcStatsType_RtcRemoteInboundRtpStreamStats);
}
case 'RtcStatsType_RtcRemoteOutboundRtpStreamStatsImpl':
{
return RtcRemoteOutboundRtpStreamStats.fromFFI(
stats as ffi.RtcStatsType_RtcRemoteOutboundRtpStreamStats);
}
case 'RtcStatsType_RtcIceCandidatePairStatsImpl':
{
return RtcIceCandidatePairStats.fromFFI(
stats as ffi.RtcStatsType_RtcIceCandidatePairStats);
}
default:
{
return null;
}
}
}