Repository navigation
fix(windows): play audio-only media; re-extract native lib when its content changes - #255
Open
muthuraj57 wants to merge 1 commit into
Open
muthuraj57 wants to merge 1 commit into
muthuraj57 wants to merge 1 commit into
Conversation
…ontent changes - OpenMedia no longer fails with MF_E_INVALIDSTREAMNUMBER when the source has no video stream: the video stream is optional, and media without both video and audio is still rejected. - The audio thread now sees MF_SOURCE_READERF_ENDOFSTREAM (the flag was checked after the null-sample early return) and, for audio-only media, sets EOF. - Seeking after the audio thread exited (end of media) restarts it. - The producer keeps running after onPlaybackEnded, so seek + play after the end works and the next end is reported again. - Audio-only position/progress come from GetMediaPosition. - NativeLibraryLoader compared only the file size, so an updated DLL of the same size kept the stale cached copy; it now compares the content. Tested on Windows 11 (x64) with MP3, WAV and Ogg Opus files (duration, position, seek, end, replay) and an HLS video (unchanged).
This was referenced Oct 24, 2026
This branch has not been deployed
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
On Windows, opening a file with no video track (MP3, WAV, Ogg Opus, ...) failed with
MF_E_INVALIDSTREAMNUMBER(0xC00D36B3), becauseOpenMediarequired a video stream. Media Foundation decodes these files fine, so this makes the video stream optional and fixes the end-of-media bugs this exposed:OpenMediaselects the video stream only if there is one (bHasVideo); a source with neither video nor audio is still rejected.ReadVideoFrame*returnS_FALSEwithout video. On the Kotlin side a 0×0 size means audio-only instead of an error; the producer idles and the consumer reports position/progress fromGetMediaPosition.MF_SOURCE_READERF_ENDOFSTREAMwas checked after theif (!mfSample) return 0;early return, so it was never seen. For audio-only media the audio thread now sets EOF.onPlaybackEnded(it used tobreak), so the next end is reported again.NativeLibraryLoaderreused the cached DLL when only the size matched, so an updated DLL of the same size kept running the old code (it did, while testing this). It now compares the content.Test plan
Windows 11 x64:
onPlaybackEnded, seek + play after the end replays and fires the end again; CPU 0–1 %ktlintCheckadds no new findings,:mediaplayer:compileKotlinJvmpasses