def __init__(self, sock, server, address, content_type, request_parser, path=None, burst_size=None, on_demand=False, keepalive=False): StreamSource.__init__(self, sock, server, address, content_type, request_parser, path, burst_size, on_demand, keepalive) # Initial buffer data self.buffer_data = request_parser.body # The FLV stream header self.stream_header = None # These are the initial setup tags we send out to each new # client self.initial_tags = collections.deque() # Which type of initial tag we already got self.got_initial_meta = self.got_initial_audio = self.got_initial_video = False # Our current packets group self.packets_group = collections.deque() # Our current "burst" packets groups list self.burst_groups = collections.deque() # List of buffers for the "burst" packets self.burst_groups_data = collections.deque() # At startup we want to parse the stream header self.handle_data = self.handle_header
def new_client(self, client): StreamSource.new_client(self, client) if self.stream_header: client.add_packet(self.stream_header.raw_data) for tag in self.initial_tags: client.add_packet(tag.raw_data + tag.body) for group_data in self.burst_groups_data: client.add_packet(group_data)
def on_demand_deactivate(self): StreamSource.on_demand_deactivate(self) self.stream_header = None self.got_initial_meta = self.got_initial_audio = self.got_initial_video = False self.initial_tags.clear() self.packets_group.clear() self.burst_groups.clear() self.burst_groups_data.clear() self.handle_data = self.handle_header self.buffer_data = b''
def on_demand_deactivate(self) -> None: StreamSource.on_demand_deactivate(self) self.stream_header = None self.got_initial_meta = self.got_initial_audio = self.got_initial_video = False self.initial_tags.clear() self.packets_group.clear() self.burst_groups.clear() self.burst_groups_data.clear() self.handle_data = self.handle_header self.buffer_data = b""
def __init__(self, sock, server, address, content_type, request_parser, path = None, burst_size = None, on_demand = False, keepalive = False): StreamSource.__init__(self, sock, server, address, content_type, request_parser, path, burst_size, on_demand, keepalive) # Initial buffer data self.buffer_data = request_parser.body # The FLV stream header self.stream_header = None # These are the initial setup tags we send out to each new # client self.initial_tags = collections.deque() # Which type of initial tag we already got self.got_initial_meta = self.got_initial_audio = self.got_initial_video = False # Our current packets group self.packets_group = collections.deque() # Our current "burst" packets groups list self.burst_groups = collections.deque() # List of buffers for the "burst" packets self.burst_groups_data = collections.deque() # At startup we want to parse the stream header self.handle_data = self.handle_header
def on_demand_connected(self, sock, request_parser): self.buffer_data = request_parser.body StreamSource.on_demand_connected(self, sock, request_parser)