How to pause an individual queue?

mattes effemm at mykmk.com
Tue Dec 18 16:41:33 PST 2012


> I have the following pipeline:
> 
>   filesrc -> avidemux -> queue -> mp4decoder -> videosink
>                       -> queue -> aacdecoder -> audiosink
> 
> Everything plays back fine. I can pause playback fine, by sending
> a GST_STATE_PAUSED to the pipeline. Playback stop and resumes once
> I set the pipeline state back to GST_STATE_PLAYING.
> 
> How do I pause an individual queue/element?
> 
> I tried setting GST_STATE_PAUSED on audiosink and audio decoder,
> but it pauses the entire pipeline. Meaning video playback and audio
> playback stops. Resetting audiosync to GST_STATE_PLAYING and botyh
> video and audio resume.
> 
> I like to either the audio chain or video chain. 
> I am obviously doing something wrong. What am I missing?
> 
> Is there a difference in behaviour between live and on demand?

You can't really pause individual elements in most cases. "Pausing"
usually happens in the sink (for non-live sources): the sink stops
rendering data, and at some point the upstream elements just block in
gst_pad_push_buffer(), because downstream doesn't consume data any more
(and queues fill up etc.). Or a source stops producing data. Most
filters / elements in the middle, don't differentiate between paused and
playing state.

You can block data flow by setting up a pad block, but that will have
repercussions on the other branch.

You can also add a valve element (or a pad probe that drops buffers) and
just drop buffers on one branch. That might cause issues with preroll
though, if data doesn't reach the sinks any more (you can set the sink
async=false then though).

What are you trying to do? (big picture)

Cheers
 -Tim

Thanks for the response.

This is currently a sandbox project helping me to learn and understand
how to manage pipelines, queues and element using the gstreamer API
with C.  As I go along, probably more questions will arise.

My goal is to extend my existing recording pipeline. I like to add 3
functionalities:   pause/resume, audio mute and video mute while
recording is active.

   v4l2src -> h264encoder -> venc \
                                   -> qtmux -> filesink
   alsasrc -> aacencoder  -> aenc /
   
- Audio mute can be handled with the volume element.
- Video mute possibly a filter inside the video encoding chain.
- Pause/resume audio and video is what I am trying to figure out.

I am currently in the process of morphing my recording pipeline (gst-launch)
in to C. So I can do some experimenting.

Any ideas/recommendation on pause/resume implementation?

Mat




More information about the gstreamer-devel mailing list