Skip to content

Commit

Permalink
Update version to 2025.0.0-beta-3 (#121)
Browse files Browse the repository at this point in the history
Also cancel bandwidth timers when a camera stream is removed
  • Loading branch information
Gold872 authored Oct 21, 2024
1 parent ce6d05b commit a96201d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/widgets/mjpeg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class MjpegStreamState {
});
}

void dispose() {
void dispose({bool deleting = false}) {
for (StreamSubscription subscription in _subscriptions.values) {
subscription.cancel();
}
Expand All @@ -186,6 +186,10 @@ class MjpegStreamState {
httpClient.close();
httpClient = Client();
bitCount = 0;

if (deleting) {
bandwidthTimer.cancel();
}
}

void cancelSubscription(Key key) {
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/nt_widgets/multi-topic/camera_stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class CameraStreamModel extends MultiTopicNTWidgetModel {
if (deleting) {
_lastDisplayedImage?.evict();
mjpegStream?.previousImage?.evict();
mjpegStream?.dispose();
mjpegStream?.dispose(deleting: deleting);
}

super.disposeWidget(deleting: deleting);
Expand Down Expand Up @@ -318,7 +318,7 @@ class CameraStreamWidget extends NTWidget {

if (createNewWidget) {
model.lastDisplayedImage?.evict();
model.mjpegStream?.dispose();
model.mjpegStream?.dispose(deleting: true);

model.mjpegStream = MjpegStreamState(stream: stream);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: elastic_dashboard
description: A simple and modern dashboard for FRC.
publish_to: 'none'
version: 2025.0.0-beta-2
version: 2025.0.0-beta-3

environment:
sdk: '>=3.0.2 <4.0.0'
Expand Down

0 comments on commit a96201d

Please sign in to comment.