Skip to content

Commit

Permalink
fix: fix getStats for remote track. (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc authored Nov 16, 2023
1 parent 74d7bcb commit 1366ff2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/src/track/local/audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class LocalAudioTrack extends LocalTrack

@override
Future<bool> monitorStats() async {
if (sender == null || events.isDisposed) {
if (sender == null || events.isDisposed || !isActive) {
_currentBitrate = 0;
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/track/local/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class LocalVideoTrack extends LocalTrack with VideoTrack {

@override
Future<bool> monitorStats() async {
if (sender == null || events.isDisposed) {
if (sender == null || events.isDisposed || !isActive) {
_currentBitrate = 0;
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/track/remote/audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class RemoteAudioTrack extends RemoteTrack

@override
Future<bool> monitorStats() async {
if (receiver == null && events.isDisposed) {
if (receiver == null || events.isDisposed || !isActive) {
_currentBitrate = 0;
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/track/remote/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RemoteVideoTrack extends RemoteTrack with VideoTrack {

@override
Future<bool> monitorStats() async {
if (receiver == null && events.isDisposed) {
if (receiver == null || events.isDisposed || !isActive) {
_currentBitrate = 0;
return false;
}
Expand Down

1 comment on commit 1366ff2

@FantaZZ
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉🎉🎉

Please sign in to comment.