Commit 09f337f3 authored by jan.koester's avatar jan.koester
Browse files

test

parent 7bce91d0
Loading
Loading
Loading
Loading
+6 −5
Changes for plugins/media/media.cpp: 6 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -1218,15 +1218,16 @@ namespace blogi {
                    return false;

                if(ss->produced < ss->sendSize){
                    static constexpr size_t MAX_FILL = BLOCKSIZE * 16;
                    static constexpr size_t STREAM_CHUNK = 65536;
                    static constexpr size_t MAX_FILL = STREAM_CHUNK * 32;
                    std::vector<char> chunk(STREAM_CHUNK);
                    size_t filled = 0;
                    while(filled < MAX_FILL && ss->produced < ss->sendSize){
                        const size_t remaining = ss->sendSize - ss->produced;
                        const size_t toRead = remaining < BLOCKSIZE ? remaining : BLOCKSIZE;
                        char chunk[BLOCKSIZE];
                        const size_t toRead = remaining < STREAM_CHUNK ? remaining : STREAM_CHUNK;
                        size_t n;
                        try {
                            n = ss->client->readBodyChunkNonBlocking(chunk, toRead);
                            n = ss->client->readBodyChunkNonBlocking(chunk.data(), toRead);
                        } catch(...) {
                            n = static_cast<size_t>(-1);
                        }
@@ -1237,7 +1238,7 @@ namespace blogi {
                        }
                        if(n > 0){
                            if(n > remaining) n = remaining;
                            req.SendData.append(chunk, n);
                            req.SendData.append(chunk.data(), n);
                            ss->produced += n;
                            filled += n;
                        } else {