- Input *input = NULL;
- map<string, Input *>::iterator deserialized_input_it =
- deserialized_inputs->find(stream_id);
- if (deserialized_input_it != deserialized_inputs->end()) {
- input = deserialized_input_it->second;
- if (input->get_url() != src) {
- fprintf(stderr, "INFO: Stream '%s' has changed URL from '%s' to '%s', restarting input.\n",
- stream_id.c_str(), input->get_url().c_str(), src.c_str());
- input->close_socket();
- delete input;
- input = NULL;
+ if (deserialized_urls.count(stream_config.url) == 0) {
+ stream_index = servers->add_stream(stream_config.url,
+ stream_config.hls_url,
+ stream_config.backlog_size,
+ stream_config.prebuffering_bytes,
+ Stream::Encoding(stream_config.encoding),
+ Stream::Encoding(stream_config.src_encoding),
+ stream_config.hls_frag_duration,
+ stream_config.hls_backlog_margin,
+ stream_config.allow_origin);
+ } else {
+ stream_index = servers->lookup_stream_by_url(stream_config.url);
+ assert(stream_index != -1);
+ servers->set_backlog_size(stream_index, stream_config.backlog_size);
+ if (!stream_config.hls_url.empty()) {
+ servers->register_hls_url(stream_index, stream_config.hls_url);