X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=httpd.cpp;h=e71f40e2e52844604849cba0ff395d8a85c83d53;hb=eaaa19e9e70c7a23a7d41dcc6e7c8baec1e63e71;hp=689291e2c7628644f4f4b4ee5aa9c94cb870264d;hpb=236cdb59df3518222cca245434602cdd6fdeca47;p=nageru diff --git a/httpd.cpp b/httpd.cpp index 689291e..e71f40e 100644 --- a/httpd.cpp +++ b/httpd.cpp @@ -73,8 +73,10 @@ int HTTPD::answer_to_connection(MHD_Connection *connection, assert(oformat != nullptr); HTTPD::Stream *stream = new HTTPD::Stream(oformat, width, height); streams.push_back(stream); + + // Does not strictly have to be equal to MUX_BUFFER_SIZE. MHD_Response *response = MHD_create_response_from_callback( - (size_t)-1, 1048576, &HTTPD::Stream::reader_callback_thunk, stream, &HTTPD::free_stream); + (size_t)-1, MUX_BUFFER_SIZE, &HTTPD::Stream::reader_callback_thunk, stream, &HTTPD::free_stream); int ret = MHD_queue_response(connection, MHD_HTTP_OK, response); //MHD_destroy_response(response); @@ -168,8 +170,8 @@ HTTPD::Stream::Stream(AVOutputFormat *oformat, int width, int height) { AVFormatContext *avctx = avformat_alloc_context(); avctx->oformat = oformat; - uint8_t *buf = (uint8_t *)av_malloc(1048576); - avctx->pb = avio_alloc_context(buf, 1048576, 1, this, nullptr, &HTTPD::Stream::write_packet_thunk, nullptr); + uint8_t *buf = (uint8_t *)av_malloc(MUX_BUFFER_SIZE); + avctx->pb = avio_alloc_context(buf, MUX_BUFFER_SIZE, 1, this, nullptr, &HTTPD::Stream::write_packet_thunk, nullptr); avctx->flags = AVFMT_FLAG_CUSTOM_IO; mux.reset(new Mux(avctx, width, height));