Callback from pipeline to notify about video picture size changing

Akon2 aakmail at mail.ru
Thu Dec 7 08:04:26 UTC 2017


Hi all,

Please consider the following simple pipeline:

static const gchar PipelineCommand[] =
    "videotestsrc "
    "! capsfilter name=capsfilter caps=video/x-raw,width=320,height=240 "
    "! videocrop name=videocrop top=100 bottom=100 left=100 right=100"
    "! autovideosink";

Effectively, this produces 120 x 40 video picture size. 

Then, when the pipeline is playing, the capsfilter changes to reduce video
picture size, e.g. caps=video/x-raw,width=100,height=100. This leads to
pipeline error (reported as data flow error in videotestsrc), because now
video picture size after cropping becomes negative (-100 x -100). videocrop
itself detects such conditions and simply sets an error return code that is
propagated further.

One way to prevent the error is to detect video picture size change *before
caps negotiation process reaches videocrop* and adjust videocrop's
properties accordingly. How?

I tried to set a (synchronous) callback that is invoked from pipeline worker
thread to monitor caps change:

g_signal_connect(video_crop_sink_pad, "notify::caps",
(GCallback)videoCropSinkCapsChanged, (__bridge void *)self);

but with no luck - the error I see on a sync bus handler occurs before. Caps
change occurs after caps negotiation completes, so it's not a surprise.

Do I need some playing with pad blocking feature (gst_pad_add_probe() method
with the GST_PAD_PROBE_TYPE_BLOCK) to get the goal?

Maybe, an alternative way - is to write a thin videocrop wrapper (as a
plugin) to handle such conditions woulb be easier?

Note: In real life video actually comes from network with H264 encoding over
RTP.

Thanks in advance!



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list