[GTK4] Using GtkMediaFile increases CPU usage substantially compared with using GtkVideo without GtkMediaFile
Steps to reproduce
- Play a video using gtk_video_new_for_filename
- Play the same video using gtk_media_file_new_for_filename and gtk_video_new_for_media_stream
Depending on the input video I see CPU usage increase dramatically when using MediaFile, regardless of whether I'm using opengl or cairo rendering. GPU core utilization seems unaffected. For some of my sample videos, the CPU usage (zen+ architecture) as a percentage of one core is (reported by top):
|GtkVideo||GtkMediaFile + GtkVideo|
With the cairo renderer the absolute CPU usage increases (sometimes to over 140% of one core) but the deltas remain more or less the same.
I would expect them to be within margin of error of each other.
GTK 4.2, Fedora 34, X11/i3/picom
I first debugged this when trying to swap out GtkVideo for GtkPicture + GtkMediaFile to hide the controls. I initially thought it was an issue with GtkPicture being somehow less efficient but the same behaviour happens with GtkVideo. I ultimately decided to just hide the controls for GtkVideo since I can't preload the video data anyway due to #4062