X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=httpd.cpp;fp=httpd.cpp;h=487d429c5d5b1e49df0a4e019f954823ffb2ceee;hb=95ad88db99ba896fb5bfcfd5c221f735a3e34b7e;hp=6bf436478b8df8cd9afb83301b0ec6a330f808c7;hpb=e573a43daf94593900197293b56bbe728d40ade6;p=nageru diff --git a/httpd.cpp b/httpd.cpp index 6bf4364..487d429 100644 --- a/httpd.cpp +++ b/httpd.cpp @@ -67,8 +67,13 @@ int HTTPD::answer_to_connection(MHD_Connection *connection, AVOutputFormat *oformat = av_guess_format(global_flags.stream_mux_name.c_str(), nullptr, nullptr); assert(oformat != nullptr); + // TODO: This is an ugly place to have this logic. + const int bit_rate = global_flags.stream_audio_codec_name.empty() ? + DEFAULT_AUDIO_OUTPUT_BIT_RATE : + global_flags.stream_audio_codec_bitrate; + int time_base = global_flags.stream_coarse_timebase ? COARSE_TIMEBASE : TIMEBASE; - HTTPD::Stream *stream = new HTTPD::Stream(oformat, width, height, time_base); + HTTPD::Stream *stream = new HTTPD::Stream(oformat, width, height, time_base, bit_rate); { unique_lock lock(streams_mutex); streams.insert(stream); @@ -112,7 +117,7 @@ void HTTPD::request_completed(struct MHD_Connection *connection, void **con_cls, } } -HTTPD::Stream::Stream(AVOutputFormat *oformat, int width, int height, int time_base) +HTTPD::Stream::Stream(AVOutputFormat *oformat, int width, int height, int time_base, int bit_rate) { AVFormatContext *avctx = avformat_alloc_context(); avctx->oformat = oformat; @@ -128,7 +133,7 @@ HTTPD::Stream::Stream(AVOutputFormat *oformat, int width, int height, int time_b avctx->flags = AVFMT_FLAG_CUSTOM_IO; - mux.reset(new Mux(avctx, width, height, video_codec, time_base)); + mux.reset(new Mux(avctx, width, height, video_codec, time_base, bit_rate)); } ssize_t HTTPD::Stream::reader_callback_thunk(void *cls, uint64_t pos, char *buf, size_t max)