X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=server.h;h=edcdc83438b9a0322f382514601abf71e46f43ff;hp=2d227b6e1797ec331c7a6e966ec412d5f6c7a79b;hb=1e15bf9054e65adfce268578f4e474c980ef6443;hpb=40ed7df894c8645c132a5bea2bfb12a9be2b82ef diff --git a/server.h b/server.h index 2d227b6..edcdc83 100644 --- a/server.h +++ b/server.h @@ -12,6 +12,7 @@ #include #include "client.h" +#include "stream.h" #include "thread.h" class ClientProto; @@ -34,7 +35,9 @@ public: std::vector get_client_stats() const; // Set header (both HTTP header and any stream headers) for the given stream. - void set_header(const std::string &stream_id, const std::string &header); + void set_header(const std::string &stream_id, + const std::string &http_header, + const std::string &stream_header); // Set that the given stream should use the given mark pool from now on. // NOTE: This should be set before any clients are connected! @@ -51,13 +54,15 @@ public: // at the same time). CubemapStateProto serialize(); void add_client_from_serialized(const ClientProto &client); - void add_stream(const std::string &stream_id, size_t bytes_received); - void add_stream_from_serialized(const StreamProto &stream); + void add_stream(const std::string &stream_id, size_t bytes_received, Stream::Encoding encoding); + void add_stream_from_serialized(const StreamProto &stream, int data_fd); void set_backlog_size(const std::string &stream_id, size_t new_size); + void set_encoding(const std::string &stream_id, Stream::Encoding encoding); private: - // Mutex protecting queued_data only. Note that if you want to hold both this - // and below, you will need to take before this one. + // Mutex protecting queued_add_clients and streams[..]->queued_data. + // Note that if you want to hold both this and below, + // you will need to take before this one. mutable pthread_mutex_t queued_data_mutex; // Deferred commands that should be run from the do_work() thread as soon as possible. @@ -71,7 +76,6 @@ private: // // Protected by . std::vector queued_add_clients; - std::map queued_data; // All variables below this line are protected by the mutex. mutable pthread_mutex_t mutex;