Linking elements on decodebin's pad-added signal

classic Classic list List threaded Threaded
2 messages Options
jmz
Reply | Threaded
Open this post in threaded view
|

Linking elements on decodebin's pad-added signal

jmz
I am writing an application as follows:
a) Create elements Filesrc, Decodebin, Muxer, Filesink (Encoder is created
later).
b) Add all elements to pipeline, link Filesrc with Decodebin, and link Muxer
with Filesink.
c) Set pipeline PLAYING.
d) On Decodebin's pad-added signal, create Encoder element and add it to
pipeline, and link Encoder with Decodebin and Muxer.

However, the pipeline gets stuck!

The pipeline works well if I do not add Muxer and Filesink to the pipeline
in step b but later add them to the pipeline in step d (i.e., along with
Encoder).

The --gst-debug=4 logs show as follows:
 INFO              GST_STATES
gstbin.c:3112:bin_handle_async_done:<decodebin0> committing state from READY
to PAUSED, old pending PAUSED
 INFO              GST_STATES
gstbin.c:3132:bin_handle_async_done:<decodebin0> completed state change,
pending VOID
 INFO              GST_STATES
gstelement.c:2233:_priv_gst_element_state_changed:<decodebin0> notifying
about state-changed READY to PAUSED (VOID_PENDING pending)
 INFO               GST_EVENT
gstpad.c:5083:gst_pad_send_event_unchecked:<x264enc0:sink> Received event on
flushing pad. Discarding
 INFO                GST_PADS
gstpad.c:3675:gst_pad_peer_query:<decodebin0:src_1> pad has no peer
 WARN                GST_PADS
gstpad.c:3669:gst_pad_peer_query:<decodebin0:src_0> could not send sticky
events
 INFO                GST_PADS
gstpad.c:3675:gst_pad_peer_query:<decodebin0:src_1> pad has no peer
 INFO           basetransform
gstbasetransform.c:1335:gst_base_transform_setcaps:<capsfilter0> reuse caps
 INFO               GST_EVENT
gstpad.c:5083:gst_pad_send_event_unchecked:<x264enc0:sink> Received event on
flushing pad. Discarding
 WARN                GST_PADS
gstpad.c:3669:gst_pad_peer_query:<decodebin0:src_0> could not send sticky
events
 INFO               GST_EVENT
gstpad.c:5083:gst_pad_send_event_unchecked:<x264enc0:sink> Received event on
flushing pad. Discarding
 INFO               GST_EVENT
gstpad.c:5083:gst_pad_send_event_unchecked:<x264enc0:sink> Received event on
flushing pad. Discarding
 INFO               GST_EVENT
gstpad.c:5083:gst_pad_send_event_unchecked:<x264enc0:sink> Received event on
flushing pad. Discarding
 INFO               GST_EVENT
gstpad.c:5083:gst_pad_send_event_unchecked:<x264enc0:sink> Received event on
flushing pad. Discarding
 INFO                    task
gsttask.c:300:gst_task_func:<multiqueue0:src_0> Task going to paused
 INFO                    task gsttask.c:300:gst_task_func:<qtdemux0:sink>
Task going to paused

What's wrong with adding Muxer and Filesink to the pipeline in step b?

I only link Video Encoder with Decodebin on video/x-raw caps in step d, but
do not link any elements on audio/x-raw caps. Could this make any errors?

Best regards,




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Linking elements on decodebin's pad-added signal

Tim Müller
On Sun, 2017-09-24 at 20:40 -0700, jmz wrote:

Hi,

Make sure to set elements you add to the pipeline dynamically to
PLAYING state as well (or sync_state_with_parent). The pipeline won't
do that automatically for you. If you don't, pads won't get activated
an the pipeline will silently stop streaming because it thinks it's
being shut down when pushing on a flushing pad.

Secondly, you're using x264enc here. x264enc by default will consume up
to 3 seconds of video before outputting anything to produce best
quality. This means you need 3 seconds of buffering (queue) in the
other branches (audio). Two ways to fix this: a) add a queue max-size-
time=0 max-size-bytes=0 max-size-buffers=0 before the audio encoders;
b) use x264enc tune=zerolatency.

Cheers
 -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

Join us at the GStreamer Conference!
21-22 October 2017 in Prague, Czech Republic
http://gstreamer.freedesktop.org/conference/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel