Quantcast

observing problems with dynamic pipeline (gstreamer version 1.4.5), video stall, audio freeze, pipeline graph shows old pipeline not yet deleted and new pipeline not yet fully created !!!!!

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

observing problems with dynamic pipeline (gstreamer version 1.4.5), video stall, audio freeze, pipeline graph shows old pipeline not yet deleted and new pipeline not yet fully created !!!!!

Nitin Mahajan
Hello folks,

I'm facing some problem while playing around with with dynamic pipelines.
Need your help / suggestions based on below scenario in case observer something wrong in approach.

I have a gstreamer demuxer plugin (not the standard plugin) with 1 video and 1 audio pad.
This plugin has 2 source pads: video pad, audio pad. (always 2 pads, doesn't have multiple audio pads per stream as per regular demuxers)

For each pad there is dedicated gst_buffer_pool allocated which contains pool of buffers to host Video and Audio ES post demuxing. In this configuration A/V playback is working OK (the pipeline is constructed with playbin)

Now on top of this I have to support switching to another audio stream present in the container (MP4) at run time when gstreamer pipeline is in playing state (with same reason as explained above that number of src pads is fixed)

demux has to switch to another audio stream as mentioned above which has different codec type. So following the dynamic pipeline principles, following steps are done in sequence to attain this objective:
While injection to demux video pad is ongoing (I guess it should be ok to let continue video inject because we are considering deletion and creation of new src pad for audio only chain) ,older audio pad is removed by following below steps: 
flush the pipeline, send eos event and remove pad followed by no more pad notification:
1. gst_pad_push_event (audio_stream->pad, gst_event_new_flush_start ());
2. gst_pad_push_event (audio_stream->pad, gst_event_new_flush_stop (TRUE));
3. gst_pad_push_event (audio_stream->pad, gst_event_new_eos ());
4. Flush the buffer pool associated associated with audio stream
5. gst_element_remove_pad (xx, audio_stream->pad);
6. gst_element_no_more_pads (xx);

And then a new audio pad is created with following operations
1. gst_pad_set_active pad
2. gst_pad_use_fixed_caps
3. gst_pad_push_event gst_event_new_stream_start
4. gst_pad_set_caps pad
5. gst_element_add_pad
6. new segment event
7. caps event
8. push buffers

gstreamer version: 1.4.5

Note that all above steps are done in sequence and in same thread context which we can call as streaming thread as per gstreamer design. Being sequential operations there is no possibility to push buffers or events on audio stream src pad (old and then new) from any other thread.
But during this period I have another thread which keeps on pushing the buffers on video src pad (which although little different from standard gstreamer streaming thread concept but since the ongoing operations are on audio stream pad so it should not create problem .. problem with buffer timestamps in case ?

The expectation was, after above steps, we can inject audio buffers on new audio pad and overall there should be just change in audio stream with no problem on video.
But the observations are not as per expectation !!!!

Video is stalled for some time when older audio pad is deleted and new audio pad is created.
Thereafter video playback is fine but there is no audio and from demux perspective audio packets are pushed without any error on new audio pad.
And the pipeline dump gives an idea that older chain is still not deleted and new chain is not built yet.

Taking dump of GST pipeline it seems that older pipeline is not deleted and new pipeline from new audio pad is partially created upto proxypad16 inside decodebin,
This pad is connected with Gstaacparse src pad but the chain meets dead end at this stage !!!!

gst_pad_push() is always successful on new audio pad. The buffers which are pushed on audio pad are allocated from buffer pool.

Any suggestions for debugging will be helpful especially with dynamic pipeline management (gstreamer 1.4.5)

Thanks
Nitin

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Loading...