SOLVED: Sending EOS through element?

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

SOLVED: Sending EOS through element?

killerrats
This post was updated on .
          - - - - queue1 - - - rtph264depay - - - - h264parse - - - - vtee -
- - - - - - - - - - - - - - - -
         /                                                                                                                                
\  ____
rtspsrc                                                                                                                                    
| A |
         \                                                                                                                                
/
           - - - - queue2 - - - rtpjitterbuffer - - - rtpmp4gdepay - - -
aacparse - - - atee - - - - - - - -

___
|A|
queue3- - - - \
                    avimux - - appsink
queue4 - - - -/

The classes are how they are structured. I am trying to send eos through
avimux but it freezes there. If I  send through srcPipeline it's successful.
I have look through the code but haven't come up with an answer. what i want
to do is send eos through unlink the  queue3,queue4,avimux and appsink. then
i will relink them back. I have done this before but don't understand why it
doesn't want to send through avimux. anyone know? I also have faksinks
connected to the vtee and atee for continuous play. if i release pads last it will act like it doesn't freeze but it doesn't seem to send it through.

videoRecClass.cpp
---------------------
GstElement* srcPipeline;
deletepipeline();
linkpipeline();
setuppipeline();
unlinkpipeline();
ReleaseQueue4andQueue3();

PipelineClass.cpp
---------------------
_videoRecClass;

sendEosThroughAviMux(PipelineClass* pipe)
{
      pipe->_videoRecClass.ReleaseQueue4andQueue3();

      GstElement* avimux =
gst_bin_get_by_name(GST_BIN(pipe->_videoRecClass.srcPipeline),"avimux");
      if(!gst_element_send_event(avimux,gst_event_new_eos()))
        {
                ImmediateLoopQuit();
        }
}



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

Re: Sending EOS through element?

killerrats
interesting...if i release both tee's then it will pause but if I release and
unlink the tee's it will go through. The only thing is that it says can't
send eos through the avimux. I can get the element from the pipeline but it
will not send eos through.

any ideas?



--
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: Sending EOS through element?

Nicolas Dufresne-5
In reply to this post by killerrats
Le mardi 19 septembre 2017 à 09:51 -0700, killerrats a écrit :

>           - - - - queue1 - - - rtph264depay - - - - h264parse - - - - vtee -
> - - - - - - - - - - - - - - - -
>          /                                                                                                                                
> \  ____
> rtspsrc                                                                                                                                    
> > A |
>
>          \                                                                                                                                
> /
>            - - - - queue2 - - - rtpjitterbuffer - - - rtpmp4gdepay - - -
> aacparse - - - atee - - - - - - - -
>
> ___
> > A|
>
> queue3- - - - \
>            avimux - - appsink
> queue4 - - - -/
>
> The classes are how they are structured. I am trying to send eos through
> avimux but it freezes there. If I  send through srcPipeline it's successful.
> I have look through the code but haven't come up with an answer. what i want
> to do is send eos through unlink the  queue3,queue4,avimux and appsink. then
> i will relink them back. I have done this before but don't understand why it
> doesn't want to send through avimux. anyone know? I also have faksinks
> connected to the vtee and atee for continuous play.

Make sure you don't push EOS on the same thread you are pulling data
from the appsink. For the EOS to end, you need to keep pulling on the
appsink. avimux also need special handling on the GstElement for that.
Sending eos on each input pad (e.g. blocking the pad with a probe,
sending the EOS), seems far more likely to work with the benefit that
you will be sending EOS from the streaming thread.

For the sources, the base class have special handling so that it tries
at best to not block on EOS.

>
> videoRecClass.cpp
> ---------------------
> GstElement* srcPipeline;
> deletepipeline();
> linkpipeline();
> setuppipeline();
> unlinkpipeline();
>
> PipelineClass.cpp
> ---------------------
> _videoRecClass;
>
> sendEosThroughAviMux(PipelineClass* pipe)
> {
>       GstElement* avimux =
> gst_bin_get_by_name(GST_BIN(pipe->_videoRecClass.srcPipeline),"avimux");
>       if(!gst_element_send_event(avimux,gst_event_new_eos()))
> {
>                 ImmediateLoopQuit();
> }
> }
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sending EOS through element?

killerrats
This post was updated on .
got it to do the eos to send through queue3 and queue4 and the callback got
the eos on the appsink sinkpad. i setup a thread to unlink the elements from
the main pipeline. for some reason i end up unblock the pads before linking
the elements. then once it links the elements then it will put each element
into playing state. setup the callback for appsink. it seems to go into a
paused state instead of playing mode. if i put the unblocking after play
state for each element it will show eos througout the pipeline. any ideas
why?

unsigned int __stdcall PipelineClass::TheStopVideoThread(void*p_this)
{
        PipelineClass* pipe = static_cast<PipelineClass*>(p_this);
       
        // block each pad
        // setup call back grabbing eos in appsink sinkpad
        // send eos through queue3 and queue4
                 
        return 0;
}

GstPadProbeReturn PipelineClass::RtspEventProbe (GstPad * pad, GstPadProbeInfo * info, gpointer pipelineclass)
{
        if (GST_EVENT_TYPE (GST_PAD_PROBE_INFO_DATA (info)) != GST_EVENT_EOS)
        {
                return GST_PAD_PROBE_PASS;
        }
       
                HANDLE handle =
                        (HANDLE)_beginthreadex(0, 0, &PipelineClass::TheRelinkVideoRecThread, pipe, 0, 0);
                CloseHandle(handle);

                return GST_PAD_PROBE_DROP;
}

unsigned int __stdcall PipelineClass::TheRelinkVideoRecThread(void*p_this)
{
        // unlink the elements
        // setup the elements again
       // unblock each src pad on the tee's
        // put elements into play mode
        // setup appsink callback
}

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

SOLVED: Re: Sending EOS through element?

killerrats
This post was updated on .
In reply to this post by Nicolas Dufresne-5
        ///// -------------- PIPELINE ------------- /////////////
        - - - - q1 - - - rtph264depay - - - - h264parse - - - - vtee - - - -
- - - - - - - - - - - - -\
       /                                                                                                                            
______
rtspsrc                                                                                      
|Rec(NotABin)| & |Fakesink(NotABin)|
       \ - - - - q2 - - - rtpjitterbuffer - - - rtpmp4gdepay - - - aacparse
- - - faad - - - atee - - /

Fakesink(NotABin)
queue5 - - - - - fakesink
queue6 - - - - - fakesink

________
|Rec(NotABin)|
q3- - - - \
           avimux - - appsink
q4 - - - -/

above is the pipeline. all elements are in the main pipeline there is no
bins for branches. there is no ghost pads to each queue for rec and
fakesink. request pad from each tee and get sink pad from each queue to the
appropriate element.

figured out that if I put a sleep(300) in the unblocking each tee in the
CheckBlocking method will eventually let the data go through instead of just
unblock immediately. I tried putting the videoblocked = false above and
immediate but still froze so I let the method wait til the variable was
false. But of course i would assign the variable to false after i ran the
checkblocked method. Don't know if this helps anybody.
It seems to work without flaws. ran for 9 hours and works nicely.

GstPadProbeReturn PipelineClass::CheckBlocked (GstPad * pad, GstPadProbeInfo
* info, gpointer user_data)
{
        PipelineClass* pipe = (PipelineClass*)user_data;

        do{
                Sleep(300);
        }while(pipe->VideoBlocked);

        return GST_PAD_PROBE_REMOVE;
}
unsigned int __stdcall PipelineClass::TheStopVideoThread(void*p_this)
{
        PipelineClass* pipe = static_cast<PipelineClass*>(p_this);
       
        // block each pad
        // setup call back grabbing eos in appsink sinkpad
        // send eos through queue3 and queue4
                 
        return 0;
}

GstPadProbeReturn PipelineClass::RtspEventProbe (GstPad * pad,
GstPadProbeInfo * info, gpointer pipelineclass)
{
        if (GST_EVENT_TYPE (GST_PAD_PROBE_INFO_DATA (info)) !=
GST_EVENT_EOS)
        {
                return GST_PAD_PROBE_PASS;
        }
       
                HANDLE handle =
                        (HANDLE)_beginthreadex(0, 0,
&PipelineClass::TheRelinkVideoRecThread, pipe, 0, 0);
                CloseHandle(handle);

                return GST_PAD_PROBE_DROP;
}

unsigned int __stdcall PipelineClass::TheRelinkVideoRecThread(void*p_this)
{
        // unlink the elements
        // setup the elements again
       // remove probe by id
       // unblock each src pad on the tee's
       // set variable videoblock to false to unblock each tee
       pipe->VideoBlocked = false;
        // put elements into play mode
        // setup appsink callback
}



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel