def _block_intersrc(self, audio_or_video): ''' The intersrc (into the dest pipeline) is blocked until it's definitely got a source. ''' def _blocked_probe_callback(*_): self.logger.debug('_blocked_probe_callback called') return Gst.PadProbeReturn.OK # We block the source (output) pad of this intervideosrc/interaudiosrc until we're sure video # is being sent. Otherwise we can get a partial message, which causes an error. block_pad(self._get_intersrc_src_pad(audio_or_video))
def create_interaudiosink_and_connections(self): ''' interaudiosink/interaudiosrc are used to connect the master pipeline with the local pipeline for this output. ''' self.interaudiosink = self.source.add_element('interaudiosink', self) self.audio_element_multiqueue_should_connect_to = self.interaudiosink channel_name = create_intersink_channel_name() self.interaudiosrc.set_property('channel', channel_name) self.interaudiosink.set_property('channel', channel_name) # We block the source (output) pad of this interaudiosrc until we're sure audio is being sent. # Otherwise we can get a partial message, which causes an error. # We don't need to do this if the other one is playing. if self.source.get_state() not in [Gst.State.PLAYING, Gst.State.PAUSED]: block_pad(self, 'interaudiosrc_src_pad')
def create_intervideosink_and_connections(self): ''' intervideosink/intervidesrc are used to connect the master pipeline with the local pipeline for this output. ''' self.intervideosink = self.source.add_element('intervideosink', self) self.video_element_multiqueue_should_connect_to = self.intervideosink channel_name = create_intersink_channel_name() self.intervideosrc.set_property('channel', channel_name) self.intervideosink.set_property('channel', channel_name) # We block the source (output) pad of this intervideosrc until we're sure video is being sent. # Otherwise the output pipeline will have a 'not negotiated' error if it starts before the other one. # We don't need to do this if the other one is playing. # Note: without this things work *most* of the time. # 'test_image_input' is an example that fails without it. if self.source.get_state() not in [Gst.State.PLAYING, Gst.State.PAUSED]: block_pad(self, 'intervideosrc_src_pad')