fix linux liveview stop teardown #526

Open
opened 2026-04-05 16:22:16 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @thomashenauer on 3/1/2026

Description

Before this fix, stopping Linux liveview did not reliably close the underlying RTSP/RTSPS stream session. In practice, the transport could remain active after pressing Stop, leaving stale stream state and causing unstable restart behavior.

This PR fixes Linux liveview stop/teardown so stopping a live stream reliably closes the RTSP/RTSPS session and resets both pipeline and UI state.

What this PR changes

  • Linux GStreamer stop teardown in wxMediaCtrl2::Stop():
    • set playbin to GST_STATE_READY
    • wait briefly for transition
    • set playbin to GST_STATE_NULL
    • wait for stop transition completion
    • clear playbin URI
  • Liveview UI state handling in MediaPlayCtrl:
    • track explicit stop requests during loading
    • de-duplicate queued <stop> tasks
    • treat explicit stop during loading as authoritative, preventing stuck stop icon/state

User-visible result

  • Stopping liveview now properly tears down the RTSP/RTSPS stream session.
  • Stopping liveview no longer leaves the stop button stuck when the stream is frozen.
  • Teardown is deterministic and restart behavior is stable.

Scope / non-goals

  • Scope is limited to Linux liveview teardown and MediaPlayCtrl stop-state handling.
  • No printer protocol changes.
  • No preset/profile/translation changes.
  • A non-fatal GStreamer warning (gst_video_center_rect: assertion 'src->h != 0' failed) may still appear in frozen H2D live view edge cases;

Screenshots/Recordings/Graphs

N/A (lifecycle/state fix, no visual layout change).

Tests

Date tested: March 1, 2026
Platform: Arch Linux, kernel 6.18.13-arch1-1, GStreamer 1.28.1.

Build verification

  • ./build_linux.sh -dsti succeeded.

Automated tests

  • cd build & ctest --test-dir tests result: 146/146 passed.

Manual verification

  • Regression flow tested:
    • start liveview
    • reproduce frozen H2D stream
    • stop liveview
    • re-enable liveview
    • repeat stop/play actions
  • Result:
    • stop icon correctly returns to play
    • no stuck UI state observed
    • no crash observed

Connection lifecycle check (ss -tpn)

  • Before enabling liveview: MQTT (:8883) only
  • While liveview enabled: MQTT (:8883) + RTSP (:322)
  • After stop: RTSP (:322) disappears, MQTT remains

Tested printers:

  • Bambu X1C
  • Bambu H2D
*Originally created by @thomashenauer on 3/1/2026* # Description Before this fix, stopping Linux liveview did **not** reliably close the underlying RTSP/RTSPS stream session. In practice, the transport could remain active after pressing Stop, leaving stale stream state and causing unstable restart behavior. This PR fixes Linux liveview stop/teardown so stopping a live stream reliably closes the RTSP/RTSPS session and resets both pipeline and UI state. ## What this PR changes - Linux GStreamer stop teardown in `wxMediaCtrl2::Stop()`: - set playbin to `GST_STATE_READY` - wait briefly for transition - set playbin to `GST_STATE_NULL` - wait for stop transition completion - clear playbin URI - Liveview UI state handling in `MediaPlayCtrl`: - track explicit stop requests during loading - de-duplicate queued `<stop>` tasks - treat explicit stop during loading as authoritative, preventing stuck stop icon/state ## User-visible result - Stopping liveview now properly tears down the RTSP/RTSPS stream session. - Stopping liveview no longer leaves the stop button stuck when the stream is frozen. - Teardown is deterministic and restart behavior is stable. ## Scope / non-goals - Scope is limited to Linux liveview teardown and `MediaPlayCtrl` stop-state handling. - No printer protocol changes. - No preset/profile/translation changes. - A non-fatal GStreamer warning (`gst_video_center_rect: assertion 'src->h != 0' failed`) may still appear in frozen H2D live view edge cases; # Screenshots/Recordings/Graphs N/A (lifecycle/state fix, no visual layout change). ## Tests Date tested: March 1, 2026 Platform: Arch Linux, kernel 6.18.13-arch1-1, GStreamer 1.28.1. ### Build verification - `./build_linux.sh -dsti` succeeded. ### Automated tests - `cd build` & `ctest --test-dir tests` result: **146/146 passed**. ### Manual verification - Regression flow tested: - start liveview - reproduce frozen H2D stream - stop liveview - re-enable liveview - repeat stop/play actions - Result: - stop icon correctly returns to play - no stuck UI state observed - no crash observed ### Connection lifecycle check (`ss -tpn`) - Before enabling liveview: MQTT (`:8883`) only - While liveview enabled: MQTT (`:8883`) + RTSP (`:322`) - After stop: RTSP (`:322`) disappears, MQTT remains Tested printers: - Bambu X1C - Bambu H2D
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#526