[GTK4] GtkVideo or MediaFile do not consistently detect video duration for files on disk
Steps to reproduce
- Create a new GtkVideo and display it. I happen to be doing it by filename.
Current behavior
Sometimes the video duration is detected and the video is seekable. Sometimes the video duration is not detected, causing the duration not to be displayed on the right side of the progress bar, and the video to not be seekable. This appears to be very racy and I get this behaviour regardless of whether I'm testing with short or long videos.
I've tested with mp4, webm, and mkv, the format doesn't seem to matter. It can take many runs of the sample application to see both outcomes.
Expected outcome
For a file on disk with a known duration, the GtkVideo widget should always and consistently detect the duration. Behaviour should not vary based on race conditions internal to GTK.
Version information
GTK 4.2, Fedora 34, X11/i3
Additional information
I've tested with both fast (local nvme) and slow (HDDs over NFS) disks with large and small files. The behaviour is racy no matter the configuration. I have not tested to see if using a GFile or memoryinputstream make a difference.