How to switch element exactly on force key unit event

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

How to switch element exactly on force key unit event

jmz
Hi,

My pipeline looks like "tee ! queue ! filesink" where filesink will be
dynamically switched. I want to send EOS to the current filesink and start a
new filesink with a complete reference frame (i.e., SPS, PPS, and IFrame). I
use the following steps:

 1) Push upstream force-key-unit event to tee's sink pad.
 2) Install a GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM probe on queue's src pad.
 3) Inside the probe callback, if receiving force key unit event:
    3a) remove the probe first
    3b) push EOS to filesink's sink pad (is the filesink finalized
correctly?)
    3c) remove the current filesink from pipeline and add a new filesink to
pipeline
    3d) return GST_PAD_PROBE_PASS (for passing downstream force-key-unit
event to the new filesink)
    Otherwise (i.e., not force key unit event), return GST_PAD_PROBE_PASS.

However, as I investigated the new sink file, the file starts with IFrame
instead of a complete reference frame. The SPS and PPS are shown with an
IFrame after several IDR frames and non-IDR frames.

Where do the other frames (appearing at the beginning of the new file) come
from? I block queue's src pad, switch filesink, and pass the force key unit
to the new filesink. The new file should start with the key unit.

Thanks for any help.




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

Re: How to switch element exactly on force key unit event

jmz
jmz wrote
> Where do the other frames (appearing at the beginning of the new file)
> come
> from? I block queue's src pad, switch filesink, and pass the force key
> unit
> to the new filesink. The new file should start with the key unit.

I found the reason that the new file does not contain SPS and PPS at the
beginning of file. I have pipeline as "h264parse ! mpegtsmux ! tee ! queue !
multifilesink." To switch multifilesink, an upstream force-key-unit event
(set running_time to to GST_CLOCK_TIME_NONE) is pushed to tee's sink pad
[step 1]. Both mpegtsmux and h264parse receive the event. If mpegtsmux
pushes a downstream force-key-unit event before h264parse does (is this
always?), only keyframe comes along with the event. This is why the new file
is created with no SPS and PPS upon receiving the downstream event [step
3c].

If I send the upstream force-key-unit event to only h264parse, the h264parse
will send downstream force-key-unit event along with SPS, PPS, and keyframe.
However, the mpegtsmux does not push the downstream force-key-unit event
because it has queued that a new key unit should be produced at a specific
time. This is mpegtsmux_sink_event() reports "skipping downstream force key
unit event as an upstream force key unit is already queued"

Shall I send the upstream force-key-unit event to only h264parse or both
h264parse and mpegtsmux? If only h264parse, can we let an element
(mpegtsmux) push a downstream event even if it has queued an upstream force
key unit?

Hope my question is described clearly and someone would give me a hand.
Thanks.




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