Changing audio property without stopping audio branch

Giacomo D omagico.olo at gmail.com
Sat Oct 3 08:54:28 PDT 2015


Hi everyone.
I'm trying to change the audio source of my pipeline without stopping the
audio.
I have a pipeline with many video branch and I can change the video output
on my screen choosing each time, clicking on a button, the video source that
I want to show, without stopping the video output.
When I change the video I want to change the audio, too. 
So, could I change "location" property of my "filesrc" at run time without
stopping the audio?
The audio branch is like this:

filesrc --> decodebin --> audioconvert --> audioresample --> autoaudiosink

At the beginning I set  the location property to the same source of the
video which is shown on my screen. When I want to change the video source I
have to change the audio source and so I proceed like this:

I add a PROBE on  audioconvert "src" with Gst.PadProbeType.BLOCK_DOWNSTREAM
and in the probe_callback I add a PROBE on audioresample "src" and after I
send an EOS event on audioresample "sink".
Now in the event_probe_callback method I have to change the audio source, is
it correct?

    def event_probe_cb(self, pad, event,user_data):
        pad.remove_probe(self.eos_probe)

        self.filesrc4_a.set_state (Gst.State.NULL)
        self.decodebin_a_ON_AIR.set_state (Gst.State.NULL)
        self.audioconvert_a_ON_AIR.set_state (Gst.State.NULL)
        self.filesrc4_a.unlink(self.decodebin_a_ON_AIR)
        self.audioconvert_a_ON_AIR.unlink(self.audioresample_a_ON_AIR)
        self.audioresample_a_ON_AIR.unlink(self.autoaudiosink_a_ON_AIR)

        self.filesrc_a = Gst.ElementFactory.make('filesrc', None)
        self.filesrc_a.set_property("location",
"/home/.../Romeo_e_Giulietta.mp4")
        self.pipeline.add(self.filesrc_a)
        self.filesrc_a.link(self.decodebin_a_ON_AIR)
        self.filesrc_a.set_state (Gst.State.PLAYING)
        return True


 When I run my project and I change audio and video sources, I get this
error:


(oggetto_regia.py:23966): GStreamer-WARNING **: 
Trying to join task 0x7f754c030ef0 from its thread would deadlock.
You cannot change the state of an element from its streaming
thread. Use g_idle_add() or post a GstMessage on the bus to
schedule the state change from the main thread.


(oggetto.py:23966): GStreamer-WARNING **: 
Trying to join task 0x7f754c030ef0 from its thread would deadlock.
You cannot change the state of an element from its streaming
thread. Use g_idle_add() or post a GstMessage on the bus to
schedule the state change from the main thread.


(oggetto.py:23966): GStreamer-CRITICAL **: gst_object_get_parent: assertion
'GST_IS_OBJECT (object)' failed
Process finished with exit code 139

I'm watching this example :
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-dynamic-pipelines.html

and I know there is something that I forget about checking on the thread of
event_probe_cb call, but I don't know how to do it in Python.

Is there someone who can help me?

Thanks in advance,
Giacomo








--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Changing-audio-property-without-stopping-audio-branch-tp4673941.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list