]> git.sesse.net Git - cubemap/blobdiff - server.cpp
Release Cubemap 1.0.0.
[cubemap] / server.cpp
index 1637d94fc068ff4f56acc0f099aad0ed60221772..879063339c9b2a6efca5a0c45fb0ce2e1633019b 100644 (file)
@@ -20,7 +20,7 @@
 #include "accesslog.h"
 #include "log.h"
 #include "markpool.h"
-#include "metacube.h"
+#include "metacube2.h"
 #include "mutexlock.h"
 #include "parse.h"
 #include "server.h"
@@ -255,8 +255,9 @@ void Server::set_header(int stream_index, const string &http_header, const strin
             client_it != clients.end();
             ++client_it) {
                Client *client = &client_it->second;
-               if (client->state == Client::SENDING_DATA &&
-                   client->stream_pos == 0) {
+               if (client->state == Client::WAITING_FOR_KEYFRAME ||
+                   (client->state == Client::SENDING_DATA &&
+                    client->stream_pos == 0)) {
                        construct_header(client);
                }
        }
@@ -542,10 +543,11 @@ void Server::construct_header(Client *client)
                        "Content-encoding: metacube\r\n" +
                        "\r\n";
                if (!stream->stream_header.empty()) {
-                       metacube_block_header hdr;
-                       memcpy(hdr.sync, METACUBE_SYNC, sizeof(hdr.sync));
+                       metacube2_block_header hdr;
+                       memcpy(hdr.sync, METACUBE2_SYNC, sizeof(hdr.sync));
                        hdr.size = htonl(stream->stream_header.size());
-                       hdr.flags = htonl(METACUBE_FLAGS_HEADER);
+                       hdr.flags = htons(METACUBE_FLAGS_HEADER);
+                       hdr.csum = htons(metacube2_compute_crc(&hdr));
                        client->header_or_error.append(
                                string(reinterpret_cast<char *>(&hdr), sizeof(hdr)));
                }