Fixed video not playing after import - #625
Open
sofian wants to merge 3 commits into
Open
Conversation
3 tasks
aalex
approved these changes
Jul 27, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Importing a video froze the UI for ~1s and then often left the source not playing (on Ubuntu 24.04). Root cause:
VideoImpl::waitForNextBits()busy-spun on the GUI thread waiting for the first decoded frame. That pattern dates back to the original GStreamer backend, where frames arrived on GStreamer's own thread so spinning was merely wasteful. Since the Qt6 Multimedia port, frames are delivered viaQVideoSink::videoFrameChangedon the event loop of the thread that owns the player (the GUI thread) — so the spin blocked the very event loop needed to deliver the frame it was waiting for, guaranteeing a timeout and leaving the media pipeline in a bad state.Video::setUri()now returns immediately with a fallback icon instead of blocking.Video::_pollForBits()replaces the blocking wait with non-blockingQTimer::singleShot-based polling.MainWindow::sourcePropertyChanged, mirroring the existing"name"handling)._videoTypeinVideo's default constructor (used when loading sources from a project file), which the new fallback-icon logic depends on.Test plan
qmake6 mapmap.pro && makebuilds cleantests/suite builds and all 44 existing Qt Test cases pass (QT_QPA_PLATFORM=offscreen ./mapmap_tests)Video/VideoPlayerImplcode directly: before the fix, construction always took ~1.4s and always logged "No bits coming"; after the fix, construction returns immediately and bits/dimensions arrive asynchronously without blocking the GUI thread