def _video_sink_flush(self, pdraw, videosink, userdata): id_ = py_object_cast(userdata) if id_ not in self.streams: self.logging.logE( 'Received flush event from unknown ID {}'.format(id_)) return with self.streams[id_]['video_sink_lock']: self.logging.logD("flush_callback {}".format(id_)) if self.flush_callback is not None: res = self.flush_callback(id_) if res != 0: self.logging.logE( 'video sink flush id {} error {}'.format(id_, res)) res = od.vbuf_queue_flush(self.streams[id_]['video_queue']) if res < 0: self.logging.logE('vbuf_queue_flush() returned %s' % res) else: self.logging.logI('vbuf_queue_flush() returned %s' % res) res = od.pdraw_video_sink_queue_flushed(pdraw, videosink) self.streams[id_]['video_sink_flushed'] = True if res < 0: self.logging.logE( 'pdraw_video_sink_queue_flushed() returned %s' % res) else: self.logging.logD( 'pdraw_video_sink_queue_flushed() returned %s' % res)
def _video_sink_flush(self, pdraw, videosink, userdata): id_ = py_object_cast(userdata) if id_ not in self.streams: self.logger.error( 'Received flush event from unknown ID {}'.format(id_)) return -errno.ENOENT # FIXME: Workaround video_sink_flush called with destroyed media if not self.pdraw: self.logger.error( "_video_sink_flush called with a destroyed pdraw id : {}".format( id_) ) return -errno.EINVAL # FIXME: Workaround video_sink_flush called with destroyed video queue if not self.streams[id_]['video_queue']: self.logger.error( "_video_sink_flush called with a destroyed queue id : {}".format( id_) ) return -errno.EINVAL with self.streams[id_]['video_sink_lock']: self.logger.debug("flush_callback {}".format(id_)) flush_callback = self.flush_callbacks[self.streams[id_]['type']] if flush_callback is not None: flushed = self.callbacks_thread_loop.run_async(flush_callback) try: if not flushed.result_or_cancel(timeout=5.): self.logger.error( 'video sink flush id {} error'.format(id_)) except FutureTimeoutError: self.logger.error( 'video sink flush id {} timeout'.format(id_)) # NOTE: If the user failed to flush its buffer at this point, # bad things WILL happen we're acknowledging the buffer flush # in all cases... res = od.vbuf_queue_flush(self.streams[id_]['video_queue']) if res < 0: self.logger.error('vbuf_queue_flush() returned %s' % res) else: self.logger.info('vbuf_queue_flush() returned %s' % res) res = od.pdraw_video_sink_queue_flushed(pdraw, videosink) if res < 0: self.logger.error( 'pdraw_video_sink_queue_flushed() returned %s' % res) else: self.logger.debug( 'pdraw_video_sink_queue_flushed() returned %s' % res) return 0
def _video_sink_queue_event(self, pomp_evt, userdata): id_ = py_object_cast(userdata) self.logging.logD('media id = {}'.format(id_)) if id_ not in self.streams: self.logging.logE( 'Received queue event from unknown ID {}'.format(id_)) return # acknowledge event res = od.pomp_evt_clear(self.streams[id_]['video_queue_event']) if res != 0: self.logging.logE( "Unable to clear frame received event ({})".format(res)) # process all available buffers in the queue with self.streams[id_]['video_sink_lock']: while self._process_stream(id_): pass
def _video_sink_queue_event(self, pomp_evt, userdata): id_ = py_object_cast(userdata) self.logging.debug('media id = {}'.format(id_)) if id_ not in self.streams: self.logging.error( 'Received queue event from unknown ID {}'.format(id_)) return # acknowledge event res = od.pomp_evt_clear(self.streams[id_]['video_queue_event']) if res != 0: self.logging.error( "Unable to clear frame received event ({})".format(res)) if not self._is_ready_to_play: self.logging.debug("The stream is no longer ready: drop one frame") return # process all available buffers in the queue with self.streams[id_]['video_sink_lock']: while self._process_stream(id_): pass