X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=server.cpp;h=879063339c9b2a6efca5a0c45fb0ce2e1633019b;hb=ee1346294bd78efbba2b4f9108585467eee43f5a;hp=1637d94fc068ff4f56acc0f099aad0ed60221772;hpb=1c6b126fe95eb0465383ba225da764757eba05c0;p=cubemap diff --git a/server.cpp b/server.cpp index 1637d94..8790633 100644 --- a/server.cpp +++ b/server.cpp @@ -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(&hdr), sizeof(hdr))); }