X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=stream.cpp;h=87a7db771f51032f790abce1d3de8b34376d5ed0;hp=b7a92c2293832e7d77c3b0c8b4c20e604b195a44;hb=d4f9b205e5091c496f0367dcd4dcc29e0a842f7f;hpb=9b8129d05b5d1ec0caed09a40f170e967afc60b3 diff --git a/stream.cpp b/stream.cpp index b7a92c2..87a7db7 100644 --- a/stream.cpp +++ b/stream.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -26,6 +27,7 @@ Stream::Stream(const string &url, size_t backlog_size, Encoding encoding) bytes_received(0), last_suitable_starting_point(-1), mark_pool(NULL), + pacing_rate(~0U), queued_data_last_starting_point(-1) { if (data_fd == -1) { @@ -51,31 +53,15 @@ Stream::Stream(const StreamProto &serialized, int data_fd) backlog_size(serialized.backlog_size()), bytes_received(serialized.bytes_received()), mark_pool(NULL), + pacing_rate(~0U), queued_data_last_starting_point(-1) { if (data_fd == -1) { 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); }