]> git.sesse.net Git - cubemap/commitdiff
Respect prebuffering_bytes= on existing streams when reloading.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 22 Jul 2015 22:01:39 +0000 (00:01 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 22 Jul 2015 22:01:39 +0000 (00:01 +0200)
main.cpp
server.cpp
server.h
serverpool.cpp
serverpool.h

index 2080d73e82fc75acb066ad36b44cee93d1956cac..32d654cee654bef1bea675585c1a0c23250e3129 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -185,6 +185,7 @@ void create_streams(const Config &config,
                        stream_index = servers->lookup_stream_by_url(stream_config.url);
                        assert(stream_index != -1);
                        servers->set_backlog_size(stream_index, stream_config.backlog_size);
+                       servers->set_prebuffering_bytes(stream_index, stream_config.prebuffering_bytes);
                        servers->set_encoding(stream_index,
                                              Stream::Encoding(stream_config.encoding));
                }
index 2f7a3327079af265a0faf2469b9b8b29c2f9a308..33a335ab2e036b903c4d89e87cc22d838dbdd160 100644 (file)
@@ -317,6 +317,13 @@ void Server::set_backlog_size(int stream_index, size_t new_size)
        assert(stream_index >= 0 && stream_index < ssize_t(streams.size()));
        streams[stream_index]->set_backlog_size(new_size);
 }
+
+void Server::set_prebuffering_bytes(int stream_index, size_t new_amount)
+{
+       MutexLock lock(&mutex);
+       assert(stream_index >= 0 && stream_index < ssize_t(streams.size()));
+       streams[stream_index]->prebuffering_bytes = new_amount;
+}
        
 void Server::set_encoding(int stream_index, Stream::Encoding encoding)
 {
index feea863f2a9fa0e8b6340c081ec071e4f5ef3235..79c35f82e8bf065a9fe9e7f6bff33ef8eb3b6a23 100644 (file)
--- a/server.h
+++ b/server.h
@@ -59,6 +59,7 @@ public:
        int add_stream_from_serialized(const StreamProto &stream, int data_fd);
        int lookup_stream_by_url(const std::string &url) const;
        void set_backlog_size(int stream_index, size_t new_size);
+       void set_prebuffering_bytes(int stream_index, size_t new_amount);
        void set_encoding(int stream_index, Stream::Encoding encoding);
 
 private:
index 310a0a7f8fe894ffbfded8fd36bb348ed9b1babb..a834e8c539eec3fadc0abbea91b7188a7da1b263 100644 (file)
@@ -201,6 +201,13 @@ void ServerPool::set_backlog_size(int stream_index, size_t new_size)
        }       
 }
 
+void ServerPool::set_prebuffering_bytes(int stream_index, size_t new_amount)
+{
+       for (int i = 0; i < num_servers; ++i) {
+               servers[i].set_prebuffering_bytes(stream_index, new_amount);
+       }
+}
+
 void ServerPool::set_encoding(int stream_index, Stream::Encoding encoding)
 {
        for (int i = 0; i < num_servers; ++i) {
index 4b56544241afba4883fe899cae308d50707c9b63..e0c59cd01252cfa0821dd226ddc161daa385db7b 100644 (file)
@@ -49,6 +49,9 @@ public:
        // Changes the given stream's backlog size on all the servers.
        void set_backlog_size(int stream_index, size_t new_size);
 
+       // Changes the given stream's amount of forced prebuffering on all the servers.
+       void set_prebuffering_bytes(int stream_index, size_t new_amount);
+
        // Changes the given stream's encoding type on all the servers.
        void set_encoding(int stream_index, Stream::Encoding encoding);