GNOME Bugzilla – Bug 652788
fdsrc doessn't respect blocksize
Last modified: 2011-06-17 09:12:13 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
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).
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 ?
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.