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<mutex> lock(streams_mutex);
streams.insert(stream);
}
}
-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;
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)