- set<string> expecting_stream_ids = deserialized_stream_ids;
- for (unsigned i = 0; i < config.streams.size(); ++i) {
- const StreamConfig &stream_config = config.streams[i];
- if (deserialized_stream_ids.count(stream_config.stream_id) == 0) {
- servers->add_stream(stream_config.stream_id, stream_config.backlog_size);
+ if (deserialized_urls.count(stream_config.url) == 0) {
+ stream_index = servers->add_stream(stream_config.url,
+ stream_config.backlog_size,
+ stream_config.prebuffering_bytes,
+ Stream::Encoding(stream_config.encoding),
+ Stream::Encoding(stream_config.src_encoding));
+ } 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);
+ servers->set_prebuffering_bytes(stream_index, stream_config.prebuffering_bytes);
+ servers->set_encoding(stream_index,
+ Stream::Encoding(stream_config.encoding));
+ servers->set_src_encoding(stream_index,
+ Stream::Encoding(stream_config.src_encoding));
+ }
+
+ servers->set_pacing_rate(stream_index, stream_config.pacing_rate);
+
+ string src = stream_config.src;
+ Input::Encoding src_encoding = Input::Encoding(stream_config.src_encoding);
+ if (!src.empty()) {
+ const auto input_it = inputs->find(make_pair(src, src_encoding));
+ if (input_it != inputs->end()) {
+ input_it->second.input->add_destination(stream_index);
+ ++input_it->second.refcount;
+ }