[gstreamer-bugs] [Bug 599769] New: [gstbasesrc] [gstfilesrc] : stat in get_size failure handling.
GStreamer (bugzilla.gnome.org)
bugzilla at gnome.org
Tue Oct 27 07:29:35 PDT 2009
https://bugzilla.gnome.org/show_bug.cgi?id=599769
GStreamer | gstreamer (core) | git
Summary: [gstbasesrc] [gstfilesrc] : stat in get_size failure
handling.
Classification: Desktop
Product: GStreamer
Version: git
OS/Version: Linux
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: gstreamer (core)
AssignedTo: gstreamer-bugs at lists.sourceforge.net
ReportedBy: gstelzz at yahoo.fr
QAContact: gstreamer-bugs at lists.sourceforge.net
GNOME target: ---
GNOME version: ---
I use gstreamer to play audio raw PCMA files through RTP.
Pipeline looks like filesrc -> capsfilter -> pcmapay -> rtp.
For performance concern, filesrc uses mmap (mmapsize=163840, blocksize=4000).
The problem being that using mmap may lead to bus error if file is
removed/changed while buffer is still flowing ...
I made an ugly workaround to prevent mmap to lead to core dump.
The idea is to trap sigbus, and change the faulting address value to provide a
buffer full of 0xd5 instead.
My test was based on a 21916 bytes file (2.8 secs), which is removed when being
played.
A sigbus is raised into rtppcmapay (the adapter stores buffer which are after
the delete invalid). I replace faulting buffer by my silence buffer and return
from sighandler. Silence is played through RTP, everything is ok.
Or looks like. Instead of getting .5 sec silence (my 4000 bytes of block out of
filesrc), I have 20.5 secs silence (beign the mmapsize length).
The explanation :
Basesrc is getting size from subclass (get_size / gst_file_src_get_size) which
issue a stat and because file does no longer exist, fails and returns FALSE.
Therefore gst_base_src_update_length compute a maxsize to (guint64) -1.
(offset >= maxsize) is false, (offset + *length >= maxsize) is false, length is
though unchanged (previously set to mmapsize) and gst_base_src_update_length
returns TRUE.
gst_basesrc_get_range then tries to create a buffer of 4000 bytes as if file
was still there, and moreover, as if file was big enough which is not sure.
To change as little as possible, here is a patch which modify the get_size of
filesrc. When stat fails, the size ist set to 0 and returns TRUE. on ESTALE (I
use files accessed through NFS), the size is set to the previously size saved
in basesrc->size.
This fixed the issue.
When I remove the file, I have a sigbus but filesrc eos when reading next
buffer, so I have .5 sec silence maximum.
--
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the Gstreamer-bugs
mailing list