How to handle an empty video file when the file is loaded into a pipeline

I am making a player to play video files. My app simply freezes when the video file is empty. I wrote a small test program which can not get bus errors. How to handle this problem in gstreamer?

You should get an error message on the bus in that case.

$ touch empty

$ gst-play-1.0 empty 
ERROR Stream contains no data. for file:///home/tpm/empty
(...)
1 Like

Thanks for your reply, Tim. I got error:
ERROR Could not determine type of stream
with gstreamer 1.22.5 on Ubuntu 22.04
No bus error for this?

When I ran my pipeline in my app to load an empty video file, I got error message
***buffer overflow detected ***: terminated
the whole app crashed. I set a break point inside bus error handler and did not see any error there.

We’d need to see a stack trace from the crash/abort to know what’s going on there (with debug symbols please), to see if it’s in your app or somewhere in GStreamer (or other dependencies).

gstdiscoverer can be used to check if the audio/video file is valid before it is played.