After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 652788 - fdsrc doessn't respect blocksize
fdsrc doessn't respect blocksize
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.32
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-06-16 23:22 UTC by Mathieu Virbel
Modified: 2011-06-17 09:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mathieu Virbel 2011-06-16 23:22:00 UTC
Hi,

I wanted to use fdsrc to read raw RGBA images from stdin. But it seem that blocksize is not respected by fdsrc since i got error like:

** (gst-launch-0.10:27332): WARNING **: ffmpegcsp0: size 1917952 is not a multiple of unit size 1920000

When i look at gstfdsrc.c, it look like read() is not protected if the blocksize is less than required. As the manpage said: "It is not an error if this number is smaller than the number of bytes requested;" but it's possible ! You need to fill the buffer completly, not leaving with a half-buffer.

Here is a simple test that show the invalid read():

cat /dev/urandom | GST_DEBUG=fdsrc:5 gst-launch fdsrc blocksize=1920000 ! fakesink

Will output things like:
0:00:06.091897230 27426      0x2458ee0 LOG                    fdsrc gstfdsrc.c:464:gst_fd_src_create:<fdsrc0> read 32768
0:00:06.091906240 27426      0x2458ee0 LOG                    fdsrc gstfdsrc.c:478:gst_fd_src_create:<fdsrc0> Read buffer of size 32768
Comment 1 Tim-Philipp Müller 2011-06-17 08:57:59 UTC
For what it's worth, it would be better to use a "videoparse" element after fdsrc than relying on the blocksize property (not least because you also need to set the right caps on the buffers).
Comment 2 Mathieu Virbel 2011-06-17 09:04:10 UTC
Ok, this is my current command line :
./glretrace -o python2.7.trace | GST_DEBUG=fdsrc:5 gst-launch -v fdsrc blocksize=1920000 ! video/x-raw-rgb,red_mask=\(int\)0xff000000,green_mask=\(int\)0x00ff0000,blue_mask=\(int\)0x0000ff00,width=800,height=600,framerate=\(fraction\)1/25,bpp=\(int\)32,depth=\(int\)32 ! ffmpegcolorspace ! video/x-raw-yuv,width=800,height=600 ! x264enc pass=quant ! avimux ! filesink location=output.avi

It's always the module next to fdsrc that failed if the blocksize is not respected. It my approach is wrong ?
Comment 3 David Schleef 2011-06-17 09:12:13 UTC
The blocksize property is only a hint.  All elements derived from GstBaseSrc have it, and many of them will return various sized buffers as standard practice.

As Tim said, use videoparse to parse raw video.