Any ways to add/remove branches to/from a running pipeline

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

Any ways to add/remove branches to/from a running pipeline

Shiping
Hi, there:

I am trying to record live video, so a pipeline is setup to record video continuously.

And during this process, I would like to preview the video from source.  So I add a tee to the recording pipeline and branch out for previewing.  When preview stopped, the branch was removed from the pipeline.

I tried hard not to pause recording pipeline, but got all kinds of errors and unstable recording.  Currently all I can do is pause recording, inset/remove branch, and restart the whole pipeline.

Of cause, I lost some frames in above process.

My question is:  Is there a way to do it without pausing the recording?

Any suggestions?

Thanks

Shiping
Reply | Threaded
Open this post in threaded view
|

Re: Any ways to add/remove branches to/from a running pipeline

Aurelien Grimaud (elzz)
Le 07/10/2009 23:14, Shiping a écrit :

> Hi, there:
>
> I am trying to record live video, so a pipeline is setup to record video
> continuously.
>
> And during this process, I would like to preview the video from source.  So
> I add a tee to the recording pipeline and branch out for previewing.  When
> preview stopped, the branch was removed from the pipeline.
>
> I tried hard not to pause recording pipeline, but got all kinds of errors
> and unstable recording.  Currently all I can do is pause recording,
> inset/remove branch, and restart the whole pipeline.
>
> Of cause, I lost some frames in above process.
>
> My question is:  Is there a way to do it without pausing the recording?
>
> Any suggestions?
>
> Thanks
>
> Shiping
>    
Hi,

You should read
http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-block.txt
Dynamically changing a PLAYING pipeline should be done with pad block to
prevent any error.
Block your tee sink pad, link/unlink your preview branch, unblock.

Aurelien

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Any ways to add/remove branches to/from a running pipeline

David Schleef-2
In reply to this post by Shiping
On Wed, Oct 07, 2009 at 02:14:21PM -0700, Shiping wrote:

>
> Hi, there:
>
> I am trying to record live video, so a pipeline is setup to record video
> continuously.
>
> And during this process, I would like to preview the video from source.  So
> I add a tee to the recording pipeline and branch out for previewing.  When
> preview stopped, the branch was removed from the pipeline.
>
> I tried hard not to pause recording pipeline, but got all kinds of errors
> and unstable recording.  Currently all I can do is pause recording,
> inset/remove branch, and restart the whole pipeline.


I wrote gtkvideomonitor for this purpose.  From its name, it's clearly
dependent on Gtk+, but it would convert easily into another toolkit.
To use it, one puts a gtkvideomonitor element into a pipeline, and
then connect a GtkVideoWidget to it.  It acts like an identity, but
will convert formats to RGB and display them in the widget periodically.
The library and elements are in gst-gtk-widgets, which google knows
about.



dave...


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Anyway to add/remove branches to/from a running pipeline

Stefan Sauer
In reply to this post by Shiping
Shiping schrieb:

> Hi, there:
>
> I am trying to record live video, so a pipeline is setup to record video
> continuously.
>
> And during this process, I would like to preview the video from source.  So
> I add a tee to the recording pipeline and branch out for previewing.  When
> preview stopped, the branch was removed from the pipeline.
>
> I tried hard not to pause recording pipeline, but got all kinds of errors
> and unstable recording.  Currently all I can do is pause recording,
> inset/remove branch, and restart the whole pipeline.
>
> Of cause, I lost some frames in above process.
>
> My question is:  Is there a way to do it without pausing the recording?
>

Besides the other suggestions, you can also look at camerabin in gst-plugins-bad.

Stefan

> Any suggestions?
>
> Thanks
>
> Shiping


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Any ways to add/remove branches to/from a running pipeline

Shiping
In reply to this post by Aurelien Grimaud (elzz)
Thanks Aurelien for your suggestion, and many thanks to all the answers posted here.  I really appreciated.  This makes me feel I am not alone, there are still many experts out there willing to provide help.

I tried the method, and here are the results:

First let me put my pipeline here:

video source -> tee -> record bin
                             -> preview bin
                             -> stream bin

I tried to add preview bin when recode bin was running, first I blocked the tee->src to preview bin, BUT it stopped the whole pipeline, including record bin.  I tried several times, but could not figure out why, and no error messages printed out when I set debug level to 3.

Then I tried adding preview bin directly to running pipeline, it worked unexpectedly.  I do not know why it worked, it should not according the documents you pointed.  Removing preview bin from running pipeline was also working.

Then when I tried to add stream bin, it became more difficult.  I tried many methods - blocking, unblocking, directly adding to running pipeline, etc.  None of them worked, and the most problems were like this:

<udpsink0> warning: Internal data flow problem.
WARN     basesink gstbasesink.c:3279:gst_base_sink_chain_unlocked:<udpsink0> warning: Received buffer without a new-segment. Assuming timestamps start from 0.
INFO        GST_ERROR_SYSTEM gstelement.c:1763:gst_element_message_full:<udpsink0> posting message: Internal data flow problem.
INFO        GST_ERROR_SYSTEM gstelement.c:1786:gst_element_message_full:<udpsink0> posted warning message: Internal data flow problem.

So I am  technically stuck here for a couple of days now.

Could you guys please shad a light on me?

Many thanks

Shiping

Aurelien Grimaud (elzz) wrote
Le 07/10/2009 23:14, Shiping a écrit :
> Hi, there:
>
> I am trying to record live video, so a pipeline is setup to record video
> continuously.
>
> And during this process, I would like to preview the video from source.  So
> I add a tee to the recording pipeline and branch out for previewing.  When
> preview stopped, the branch was removed from the pipeline.
>
> I tried hard not to pause recording pipeline, but got all kinds of errors
> and unstable recording.  Currently all I can do is pause recording,
> inset/remove branch, and restart the whole pipeline.
>
> Of cause, I lost some frames in above process.
>
> My question is:  Is there a way to do it without pausing the recording?
>
> Any suggestions?
>
> Thanks
>
> Shiping
>    
Hi,

You should read
http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-block.txt
Dynamically changing a PLAYING pipeline should be done with pad block to
prevent any error.
Block your tee sink pad, link/unlink your preview branch, unblock.

Aurelien

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Any ways to add/remove branches to/from a running pipeline

sledge hammer
According to Aurelien's suggestion---> "Block your tee sink pad, link/unlink your preview branch, unblock."
This mean you should do "video source-->block-->tee" and not a "tee-->block-->preview bin/stream bin"


> Date: Tue, 13 Oct 2009 11:23:01 -0700
> From: [hidden email]
> To: [hidden email]
> Subject: Re: [gst-devel] Any ways to add/remove branches to/from a running pipeline
>
>
> Thanks Aurelien for your suggestion, and many thanks to all the answers
> posted here. I really appreciated. This makes me feel I am not alone,
> there are still many experts out there willing to provide help. :-)
>
> I tried the method, and here are the results:
>
> First let me put my pipeline here:
>
> video source -> tee -> record bin
> -> preview bin
> -> stream bin
>
> I tried to add preview bin when recode bin was running, first I blocked the
> tee->src to preview bin, BUT it stopped the whole pipeline, including record
> bin. I tried several times, but could not figure out why, and no error
> messages printed out when I set debug level to 3.
>
> Then I tried adding preview bin directly to running pipeline, it worked
> unexpectedly. I do not know why it worked, it should not according the
> documents you pointed. Removing preview bin from running pipeline was also
> working.
>
> Then when I tried to add stream bin, it became more difficult. I tried many
> methods - blocking, unblocking, directly adding to running pipeline, etc.
> None of them worked, and the most problems were like this:
>
> <udpsink0> warning: Internal data flow problem.
> WARN basesink gstbasesink.c:3279:gst_base_sink_chain_unlocked:<udpsink0>
> warning: Received buffer without a new-segment. Assuming timestamps start
> from 0.
> INFO GST_ERROR_SYSTEM
> gstelement.c:1763:gst_element_message_full:<udpsink0> posting message:
> Internal data flow problem.
> INFO GST_ERROR_SYSTEM
> gstelement.c:1786:gst_element_message_full:<udpsink0> posted warning
> message: Internal data flow problem.
>
> So I am technically stuck here for a couple of days now.
>
> Could you guys please shad a light on me?
>
> Many thanks
>
> Shiping
>
>
> Aurelien Grimaud (elzz) wrote:
> >
> > Le 07/10/2009 23:14, Shiping a écrit :
> >> Hi, there:
> >>
> >> I am trying to record live video, so a pipeline is setup to record video
> >> continuously.
> >>
> >> And during this process, I would like to preview the video from source.
> >> So
> >> I add a tee to the recording pipeline and branch out for previewing.
> >> When
> >> preview stopped, the branch was removed from the pipeline.
> >>
> >> I tried hard not to pause recording pipeline, but got all kinds of errors
> >> and unstable recording. Currently all I can do is pause recording,
> >> inset/remove branch, and restart the whole pipeline.
> >>
> >> Of cause, I lost some frames in above process.
> >>
> >> My question is: Is there a way to do it without pausing the recording?
> >>
> >> Any suggestions?
> >>
> >> Thanks
> >>
> >> Shiping
> >>
> > Hi,
> >
> > You should read
> > http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-block.txt
> > Dynamically changing a PLAYING pipeline should be done with pad block to
> > prevent any error.
> > Block your tee sink pad, link/unlink your preview branch, unblock.
> >
> > Aurelien
> >
> > ------------------------------------------------------------------------------
> > Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> > is the only developer event you need to attend this year. Jumpstart your
> > developing skills, take BlackBerry mobile applications to market and stay
> > ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> > http://p.sf.net/sfu/devconference
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Any-ways-to-add-remove-branches-to-from-a-running-pipeline-tp25794577p25878111.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


Windows Live: Κρατήστε τους φίλους σας ενήμερους για τις δραστηριότητές σας στο Internet.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Any ways to add/remove branches to/from a running pipeline

Shiping
So, this means the other branches connected after this tee (say record branch in my pipeline ) have to be temporarily stopped ?
Thanks
Shiping
sledge hammer wrote
According to Aurelien's suggestion---> "Block your tee sink pad, link/unlink your preview branch, unblock."
This mean you should do "video source-->block-->tee" and not a "tee-->block-->preview bin/stream bin"
Reply | Threaded
Open this post in threaded view
|

Re: Any ways to add/remove branches to/from a running pipeline

Aurelien Grimaud (elzz)
Le 16/10/2009 17:02, Shiping a écrit :
> So, this means the other branches connected after this tee (say record branch
> in my pipeline ) have to be temporarily stopped ?
> Thanks
> Shiping
>
>    
There will be no more buffers going downstream your tee, so downstream
branched will be "paused"
But, the block, unlink/link unblock will not take long and as buffers
carry timestamp, this should not be a problem.

Aurelien

> sledge hammer wrote:
>    
>>
>> According to Aurelien's suggestion--->  "Block your tee sink pad,
>> link/unlink your preview branch, unblock."
>> This mean you should do "video source-->block-->tee" and not a
>> "tee-->block-->preview bin/stream bin"
>>
>>
>>      
>    


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Any ways to add/remove branches to/from a running pipeline

Aurelien Grimaud (elzz)
In reply to this post by Shiping
Le 13/10/2009 20:23, Shiping a écrit :

> Thanks Aurelien for your suggestion, and many thanks to all the answers
> posted here.  I really appreciated.  This makes me feel I am not alone,
> there are still many experts out there willing to provide help. :-)
>
> I tried the method, and here are the results:
>
> First let me put my pipeline here:
>
> video source ->  tee ->  record bin
>                               ->  preview bin
>                               ->  stream bin
>
> I tried to add preview bin when recode bin was running, first I blocked the
> tee->src to preview bin, BUT it stopped the whole pipeline, including record
> bin.  I tried several times, but could not figure out why, and no error
> messages printed out when I set debug level to 3.
>
> Then I tried adding preview bin directly to running pipeline, it worked
> unexpectedly.  I do not know why it worked, it should not according the
> documents you pointed.  Removing preview bin from running pipeline was also
> working.
>    
If you do your stuff (link/unlink) between two buffers, it will be ok.
But a buffer arrives on tee:sink, then you had a src pad and tee
forwards to the new src pad which is NOT LINKED. Therefore you get the
internal data flow problem.
Moreover this error is carried on all upstream elements and your whole
pipeline stops !

I used tee to forward the same stream to many udpsrc which were
linked/unlinked dynamically.
Without blocking stream, sometimes, the streaming process for all udpsrc
stopped for the reason mentionned before.

You have to make sure no buffer arrives to tee, therefore block your tee
input (sink pad).
When blocked (in the blocked call back for instance), link or unlink as
needed, the (always in your callback) unblock the tee:sink pad.

Non blocking the pad will work only to remove a downstream bin, if you
remove the tee:src request pad while pipeline is running.
The locks used in tee ensure (I think) that it works.

To be sure : use block.

Aurelien

> Then when I tried to add stream bin, it became more difficult.  I tried many
> methods - blocking, unblocking, directly adding to running pipeline, etc.
> None of them worked, and the most problems were like this:
>
> <udpsink0>  warning: Internal data flow problem.
> WARN     basesink gstbasesink.c:3279:gst_base_sink_chain_unlocked:<udpsink0>
> warning: Received buffer without a new-segment. Assuming timestamps start
> from 0.
> INFO        GST_ERROR_SYSTEM
> gstelement.c:1763:gst_element_message_full:<udpsink0>  posting message:
> Internal data flow problem.
> INFO        GST_ERROR_SYSTEM
> gstelement.c:1786:gst_element_message_full:<udpsink0>  posted warning
> message: Internal data flow problem.
>
> So I am  technically stuck here for a couple of days now.
>
> Could you guys please shad a light on me?
>
> Many thanks
>
> Shiping
>
>
> Aurelien Grimaud (elzz) wrote:
>    
>> Le 07/10/2009 23:14, Shiping a écrit :
>>      
>>> Hi, there:
>>>
>>> I am trying to record live video, so a pipeline is setup to record video
>>> continuously.
>>>
>>> And during this process, I would like to preview the video from source.
>>> So
>>> I add a tee to the recording pipeline and branch out for previewing.
>>> When
>>> preview stopped, the branch was removed from the pipeline.
>>>
>>> I tried hard not to pause recording pipeline, but got all kinds of errors
>>> and unstable recording.  Currently all I can do is pause recording,
>>> inset/remove branch, and restart the whole pipeline.
>>>
>>> Of cause, I lost some frames in above process.
>>>
>>> My question is:  Is there a way to do it without pausing the recording?
>>>
>>> Any suggestions?
>>>
>>> Thanks
>>>
>>> Shiping
>>>
>>>        
>> Hi,
>>
>> You should read
>> http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-block.txt
>> Dynamically changing a PLAYING pipeline should be done with pad block to
>> prevent any error.
>> Block your tee sink pad, link/unlink your preview branch, unblock.
>>
>> Aurelien
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>>
>>      
>    


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Any ways to add/remove branches to/from a running pipeline

Shiping
Thanks sledge and Aurelien for quick reply.  I will give it a shot ASAP and, may come back with a successful story  or more questions.

Aurelien Grimaud (elzz) wrote
Le 13/10/2009 20:23, Shiping a écrit :
> Thanks Aurelien for your suggestion, and many thanks to all the answers
> posted here.  I really appreciated.  This makes me feel I am not alone,
> there are still many experts out there willing to provide help. :-)
>
> I tried the method, and here are the results:
>
> First let me put my pipeline here:
>
> video source ->  tee ->  record bin
>                               ->  preview bin
>                               ->  stream bin
>
> I tried to add preview bin when recode bin was running, first I blocked the
> tee->src to preview bin, BUT it stopped the whole pipeline, including record
> bin.  I tried several times, but could not figure out why, and no error
> messages printed out when I set debug level to 3.
>
> Then I tried adding preview bin directly to running pipeline, it worked
> unexpectedly.  I do not know why it worked, it should not according the
> documents you pointed.  Removing preview bin from running pipeline was also
> working.
>    
If you do your stuff (link/unlink) between two buffers, it will be ok.
But a buffer arrives on tee:sink, then you had a src pad and tee
forwards to the new src pad which is NOT LINKED. Therefore you get the
internal data flow problem.
Moreover this error is carried on all upstream elements and your whole
pipeline stops !

I used tee to forward the same stream to many udpsrc which were
linked/unlinked dynamically.
Without blocking stream, sometimes, the streaming process for all udpsrc
stopped for the reason mentionned before.

You have to make sure no buffer arrives to tee, therefore block your tee
input (sink pad).
When blocked (in the blocked call back for instance), link or unlink as
needed, the (always in your callback) unblock the tee:sink pad.

Non blocking the pad will work only to remove a downstream bin, if you
remove the tee:src request pad while pipeline is running.
The locks used in tee ensure (I think) that it works.

To be sure : use block.

Aurelien
> Then when I tried to add stream bin, it became more difficult.  I tried many
> methods - blocking, unblocking, directly adding to running pipeline, etc.
> None of them worked, and the most problems were like this:
>
> <udpsink0>  warning: Internal data flow problem.
> WARN     basesink gstbasesink.c:3279:gst_base_sink_chain_unlocked:<udpsink0>
> warning: Received buffer without a new-segment. Assuming timestamps start
> from 0.
> INFO        GST_ERROR_SYSTEM
> gstelement.c:1763:gst_element_message_full:<udpsink0>  posting message:
> Internal data flow problem.
> INFO        GST_ERROR_SYSTEM
> gstelement.c:1786:gst_element_message_full:<udpsink0>  posted warning
> message: Internal data flow problem.
>
> So I am  technically stuck here for a couple of days now.
>
> Could you guys please shad a light on me?
>
> Many thanks
>
> Shiping
>
>
> Aurelien Grimaud (elzz) wrote:
>    
>> Le 07/10/2009 23:14, Shiping a écrit :
>>      
>>> Hi, there:
>>>
>>> I am trying to record live video, so a pipeline is setup to record video
>>> continuously.
>>>
>>> And during this process, I would like to preview the video from source.
>>> So
>>> I add a tee to the recording pipeline and branch out for previewing.
>>> When
>>> preview stopped, the branch was removed from the pipeline.
>>>
>>> I tried hard not to pause recording pipeline, but got all kinds of errors
>>> and unstable recording.  Currently all I can do is pause recording,
>>> inset/remove branch, and restart the whole pipeline.
>>>
>>> Of cause, I lost some frames in above process.
>>>
>>> My question is:  Is there a way to do it without pausing the recording?
>>>
>>> Any suggestions?
>>>
>>> Thanks
>>>
>>> Shiping
>>>
>>>        
>> Hi,
>>
>> You should read
>> http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-block.txt
>> Dynamically changing a PLAYING pipeline should be done with pad block to
>> prevent any error.
>> Block your tee sink pad, link/unlink your preview branch, unblock.
>>
>> Aurelien
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>>
>>      
>    


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Any ways to add/remove branches to/from a running pipeline

Håvard Graff
Hi.

I posted this a while back in this mailinglist.

The problem with the "block-pad" soultion is that you are dependant of getting another buffer on the tee srcpad after you block it. If this is no problem, then this solution is the easiest one. If there is a chance no more buffers will arrive on the src-pad you can do:

1. Attach an event-probe to the tee srcpad you want to unlink.
2. Send a custom downstream serialized event on the tee sinkpad
3. Inside the callback of the event-prove, confirm the arrival of your custom event and:
        a) Unlink the branch from the tee srcpad
        b) remove the probe
        c) release the tee srcpad (note that this is actually safe to do inside the callback!)
        d) return FALSE (so you don't pass that event downstream)

For us this is absolutely necessary, since the call can be ended at any time, and hence you can't know if you get another buffer.

Håvard

-----Original Message-----
From: Shiping [mailto:[hidden email]]
Sent: 16. oktober 2009 18:34
To: [hidden email]
Subject: Re: [gst-devel] Any ways to add/remove branches to/from a running pipeline


Thanks sledge and Aurelien for quick reply.  I will give it a shot ASAP and,
may come back with a successful story :handshake: or more questions.
:confused:


Aurelien Grimaud (elzz) wrote:

>
> Le 13/10/2009 20:23, Shiping a écrit :
>> Thanks Aurelien for your suggestion, and many thanks to all the answers
>> posted here.  I really appreciated.  This makes me feel I am not alone,
>> there are still many experts out there willing to provide help. :-)
>>
>> I tried the method, and here are the results:
>>
>> First let me put my pipeline here:
>>
>> video source ->  tee ->  record bin
>>                               ->  preview bin
>>                               ->  stream bin
>>
>> I tried to add preview bin when recode bin was running, first I blocked
>> the
>> tee->src to preview bin, BUT it stopped the whole pipeline, including
>> record
>> bin.  I tried several times, but could not figure out why, and no error
>> messages printed out when I set debug level to 3.
>>
>> Then I tried adding preview bin directly to running pipeline, it worked
>> unexpectedly.  I do not know why it worked, it should not according the
>> documents you pointed.  Removing preview bin from running pipeline was
>> also
>> working.
>>    
> If you do your stuff (link/unlink) between two buffers, it will be ok.
> But a buffer arrives on tee:sink, then you had a src pad and tee
> forwards to the new src pad which is NOT LINKED. Therefore you get the
> internal data flow problem.
> Moreover this error is carried on all upstream elements and your whole
> pipeline stops !
>
> I used tee to forward the same stream to many udpsrc which were
> linked/unlinked dynamically.
> Without blocking stream, sometimes, the streaming process for all udpsrc
> stopped for the reason mentionned before.
>
> You have to make sure no buffer arrives to tee, therefore block your tee
> input (sink pad).
> When blocked (in the blocked call back for instance), link or unlink as
> needed, the (always in your callback) unblock the tee:sink pad.
>
> Non blocking the pad will work only to remove a downstream bin, if you
> remove the tee:src request pad while pipeline is running.
> The locks used in tee ensure (I think) that it works.
>
> To be sure : use block.
>
> Aurelien
>> Then when I tried to add stream bin, it became more difficult.  I tried
>> many
>> methods - blocking, unblocking, directly adding to running pipeline, etc.
>> None of them worked, and the most problems were like this:
>>
>> <udpsink0>  warning: Internal data flow problem.
>> WARN     basesink
>> gstbasesink.c:3279:gst_base_sink_chain_unlocked:<udpsink0>
>> warning: Received buffer without a new-segment. Assuming timestamps start
>> from 0.
>> INFO        GST_ERROR_SYSTEM
>> gstelement.c:1763:gst_element_message_full:<udpsink0>  posting message:
>> Internal data flow problem.
>> INFO        GST_ERROR_SYSTEM
>> gstelement.c:1786:gst_element_message_full:<udpsink0>  posted warning
>> message: Internal data flow problem.
>>
>> So I am  technically stuck here for a couple of days now.
>>
>> Could you guys please shad a light on me?
>>
>> Many thanks
>>
>> Shiping
>>
>>
>> Aurelien Grimaud (elzz) wrote:
>>    
>>> Le 07/10/2009 23:14, Shiping a écrit :
>>>      
>>>> Hi, there:
>>>>
>>>> I am trying to record live video, so a pipeline is setup to record
>>>> video
>>>> continuously.
>>>>
>>>> And during this process, I would like to preview the video from source.
>>>> So
>>>> I add a tee to the recording pipeline and branch out for previewing.
>>>> When
>>>> preview stopped, the branch was removed from the pipeline.
>>>>
>>>> I tried hard not to pause recording pipeline, but got all kinds of
>>>> errors
>>>> and unstable recording.  Currently all I can do is pause recording,
>>>> inset/remove branch, and restart the whole pipeline.
>>>>
>>>> Of cause, I lost some frames in above process.
>>>>
>>>> My question is:  Is there a way to do it without pausing the recording?
>>>>
>>>> Any suggestions?
>>>>
>>>> Thanks
>>>>
>>>> Shiping
>>>>
>>>>        
>>> Hi,
>>>
>>> You should read
>>> http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-block.txt
>>> Dynamically changing a PLAYING pipeline should be done with pad block to
>>> prevent any error.
>>> Block your tee sink pad, link/unlink your preview branch, unblock.
>>>
>>> Aurelien
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and
>>> stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>>
>>>
>>>      
>>    
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>

--
View this message in context: http://www.nabble.com/Any-ways-to-add-remove-branches-to-from-a-running-pipeline-tp25794577p25928355.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel