Fast switching between H264 streams with input-selector

Marc Leeman marc.leeman at gmail.com
Tue Jan 12 15:41:22 UTC 2021


with uridecodebin you pass 2 things (of relevance here).

1. pass the uri (in this case rtsp)
2. pass the caps you want uridecodebin to produce (defaults to decoded
media, you might want to specify video/x-raw to avoid e.g. audio).

The decoder is in uridecodebin, so you get decoded frames.

I suspect that in your setup, you re-use the decoder by setting the
decoder *after* the input-selector. In the example, de decoder is in
front of the input-selector (hidden in uridecodebin).

This makes sure that you are switching in the decoded domain, not in
the compressed domain. At this point, frames have no temporal
dependencies (that produces the macro blocks in your case).

If you want to switch in the compressed domain and re-use thedecoder,
this is also possible; but in your use-case a bit more complex. You
will need to add an extra step on the produced pad of uridecodebin and
check if the buffers that are produced, are 'non-delta frames'. There
is a flag; *and* you will need to make certain, somehow, that you only
switch after getting the SPS/PPS in the stream (or out of band).

On Tue, 12 Jan 2021 at 14:30, omer.tal <jacklawi at gmail.com> wrote:
>
> Hi and thank you for your replay.
>
> I couldn't however understand how does it guarantee that I get a full frame?
> What if the pad was added during a p-frame? So the first frame I get is a
> p-frame.
>
> Anyway, I thought about something like that, but I do like to keep both
> streams connected at all time to reduce the time it takes to perform the
> connection.
>
> I think that since data was flowing through the pipeline, I can always store
> the last I-frame in a queue and just decode from there...
> I'm just not sure if the way to go is to use a PadProbe to block the
> inactive pads.
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



-- 
g. Marc


More information about the gstreamer-devel mailing list