Add support for forced prebuffering.
[cubemap] / stream.cpp
index 594d77c..df13193 100644 (file)
 
 using namespace std;
 
-Stream::Stream(const string &url, size_t backlog_size, Encoding encoding)
+Stream::Stream(const string &url, size_t backlog_size, size_t prebuffering_bytes, Encoding encoding)
        : url(url),
          encoding(encoding),
          data_fd(make_tempfile("")),
           backlog_size(backlog_size),
+         prebuffering_bytes(prebuffering_bytes),
          bytes_received(0),
          last_suitable_starting_point(-1),
          pacing_rate(~0U),
@@ -50,6 +51,7 @@ Stream::Stream(const StreamProto &serialized, int data_fd)
          encoding(Stream::STREAM_ENCODING_RAW),  // Will be changed later.
          data_fd(data_fd),
          backlog_size(serialized.backlog_size()),
+         prebuffering_bytes(serialized.prebuffering_bytes()),
          bytes_received(serialized.bytes_received()),
          pacing_rate(~0U),
          queued_data_last_starting_point(-1)
@@ -71,6 +73,7 @@ StreamProto Stream::serialize()
        serialized.set_stream_header(stream_header);
        serialized.add_data_fds(data_fd);
        serialized.set_backlog_size(backlog_size);
+       serialized.set_prebuffering_bytes(prebuffering_bytes);
        serialized.set_bytes_received(bytes_received);
        serialized.set_last_suitable_starting_point(last_suitable_starting_point);
        serialized.set_url(url);