X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=stream.h;h=931da2aa236e941ad72833a3af0d12cdbfac2ec2;hp=5d570fded6f6bec0a2387d12b845466d61eee1cf;hb=980ac162414c9fce62af4fdb9cfc282865b31572;hpb=cb042ee88b5f4cd6e5f55bada4d9d86807f1640b diff --git a/stream.h b/stream.h index 5d570fd..931da2a 100644 --- a/stream.h +++ b/stream.h @@ -46,6 +46,9 @@ struct Stream { // Changes the backlog size, restructuring the data as needed. void set_backlog_size(size_t new_size); + // You should hold the owning Server's , since it calls add_data_raw(). + void set_header(const std::string &new_http_header, const std::string &new_stream_header); + // Mutex protecting and . // Note that if you want to hold both this and the owning server's // you will need to take before this one. @@ -112,7 +115,15 @@ struct Stream { // from points N-3..N-2. struct FragmentStart { uint64_t byte_position; - double pts; + double pts; // Unused if begins_header is true. + + // Whether the fragment started at this position is a stream header or not. + // Note that headers are stored _after_ the fragments they are headers for, + // so that they rotate out of the backlog last (and also because they are + // conveniently written then). The most current header is _not_ stored + // in the backlog; it is stored in stream_header. Only when replaced + // is it committed to the backlog and gets an entry here. + bool begins_header; }; std::deque fragments; uint64_t first_fragment_index = 0, discontinuity_counter = 0;