gtk_media_file_set_input_stream assertion failure when using GStreamer backend
Calling gtk_media_file_set_input_stream
with a valid GInputStream asserts in the gtkgstmediafile
implementation.
Steps to reproduce
Write a GTK4 application, using GTK_MEDIA=gstreamer
, with the following calls:
SoupSession* session = soup_session_new();
SoupMessage* msg = soup_message_new("GET", "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4");
GInputStream* stream = soup_session_send(session, msg, NULL, NULL);
GtkMediaStream* file = gtk_media_file_new();
gtk_media_file_set_input_stream(GTK_MEDIA_FILE(file), stream);
Current behavior
Program crashes with the following:
ERROR:../modules/media/gtkgstmediafile.c:276:gtk_gst_media_file_open: code should not be reached
The assert in question is:
/* It's an input stream */
g_assert_not_reached ();
When using the ffmpeg backend instead, gtk_media_file_set_input_stream
works as expected.
Expected outcome
The program should not crash, and the GtkMediaFile should be usable as if it had been initialized with gtk_media_file_set_filename
.
Version information
GTK version: 4.3.0
Flatpak runtime: org.gnome.Sdk 40
Additional information
Discussed here: https://discourse.gnome.org/t/gtk4-video-playback-from-inputstream/6762
Edited by atoft