def _video_data_cb(self, element): buf = element.emit('pull-buffer') ts = int(buf.timestamp / 1000000.0) ts = ts % 0x100000000 log.debug('[V] %5d [%d] %s', int(ts), int(buf.duration / 1000000), ellip(str(buf).encode('hex'), maxlen=102)) frame = self.make_rtmp_video(buf) reactor.callFromThread(self._stream.write_video, ts, frame)
def _audio_data_cb(self, element): buf = element.emit('pull-buffer') ts = int(buf.timestamp / 1000000.0) ts = ts % 0x100000000 # api clients are supposed to handle # timestamp wraps (4-bytes only) log.debug('[A] %5d [%d] %s', int(ts), int(buf.duration / 1000000), ellip(str(buf).encode('hex'), maxlen=102)) frame = self.make_rtmp_audio(buf) reactor.callFromThread(self._stream.write_audio, ts, frame)