string protocol;
parse_url(url, &protocol, &host, &port, &path); // Don't care if it fails.
- // Older versions stored the extra \r\n in the HTTP header.
- // Strip it if we find it.
- if (http_header.size() >= 4 &&
- memcmp(http_header.data() + http_header.size() - 4, "\r\n\r\n", 4) == 0) {
- http_header.resize(http_header.size() - 2);
- }
-
pthread_mutex_init(&stats_mutex, NULL);
stats.url = url;
stats.bytes_received = serialized.bytes_received();
data_fds.push_back(stream.data_fds(j));
}
- // Older versions stored the data once in the protobuf instead of
- // sending around file descriptors.
- if (data_fds.empty() && stream.has_data()) {
- data_fds.push_back(make_tempfile(stream.data()));
- }
-
servers->add_stream_from_serialized(stream, data_fds);
deserialized_urls.insert(stream.url());
for (int i = 0; i < loaded_state.inputs_size(); ++i) {
InputProto serialized_input = loaded_state.inputs(i);
- // Older versions did not store the stream header in the input,
- // only in each stream. We need to have the stream header in the
- // input as well, in case we create a new stream reusing the same input.
- // Thus, we put it into place here if it's missing.
- if (!serialized_input.has_stream_header() &&
- stream_headers_for_url.count(serialized_input.url()) != 0) {
- serialized_input.set_stream_header(stream_headers_for_url[serialized_input.url()]);
- }
-
InputWithRefcount iwr;
iwr.input = create_input(serialized_input);
iwr.refcount = 0;
optional int64 bytes_received = 3;
optional int64 last_suitable_starting_point = 9;
optional string url = 4;
-
- // Older versions stored the HTTP and video headers together in this field.
- optional bytes header = 1;
-
- // Older versions stored the data in the protobuf instead of sending file
- // descriptors around.
- optional bytes data = 2;
};
// Corresponds to class Input.
exit(1);
}
- // Split old-style headers into HTTP and video headers.
- if (!serialized.header().empty()) {
- string header = serialized.header();
- size_t split = header.find("\r\n\r\n");
- if (split == string::npos) {
- http_header = header;
- stream_header = "";
- } else {
- http_header = header.substr(0, split + 2); // Split off the second \r\n.
- stream_header = header.substr(split, string::npos);
- }
- }
-
- // Older versions did not set last_suitable_starting_point.
- if (serialized.has_last_suitable_starting_point()) {
- last_suitable_starting_point = serialized.last_suitable_starting_point();
- } else {
- last_suitable_starting_point = bytes_received;
- }
+ assert(serialized.has_last_suitable_starting_point());
+ last_suitable_starting_point = serialized.last_suitable_starting_point();
pthread_mutex_init(&queued_data_mutex, NULL);
}