forked from flutter-webrtc/flutter-webrtc
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
PeerConnection.getStats()
for iOS (#161)
- Loading branch information
1 parent
ee4db28
commit c8bcd8b
Showing
6 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/// Representation of an `RTCStatisticsReport`. | ||
class RtcStats { | ||
/// List of all RTC stats reports converted to flat `Map`. | ||
var statsList: [[String: Any]] = [] | ||
|
||
/// Converts the provided `RTCStatisticsReport` into `RtcStats`. | ||
init(report: RTCStatisticsReport) { | ||
for (_, stats) in report.statistics { | ||
var statDetails: [String: Any] = [:] | ||
statDetails["id"] = stats.id | ||
statDetails["type"] = stats.type | ||
statDetails["timestampUs"] = Int(stats.timestamp_us) | ||
|
||
for (statName, statValue) in stats.values { | ||
statDetails[statName] = statValue | ||
} | ||
|
||
self.statsList.append(statDetails) | ||
} | ||
} | ||
|
||
/// Converts these `RtcStats` into a `Map` which can be returned to the | ||
/// Flutter side. | ||
func asFlutterResult() -> [[String: Any]] { | ||
return self.statsList | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters