media-playback: Unbuffered Media Source

When using an IP camera on a local network, we wanted to minimize
delay. In order to achieve minimum delay, we allowed Media Source to
set BufferingMB to 0, and when it is 0, also enable AVFMT_FLAG_NOBUFFER
in the AVFormatContext flags.
This commit is contained in:
LiamCoal 2020-02-07 20:15:56 -08:00
parent e73e76048e
commit 2b7f4dfa6b
2 changed files with 4 additions and 1 deletions

View file

@ -585,6 +585,9 @@ static bool init_avformat(mp_media_t *m)
av_dict_set_int(&opts, "buffer_size", m->buffering, 0);
m->fmt = avformat_alloc_context();
if (m->buffering == 0) {
m->fmt->flags |= AVFMT_FLAG_NOBUFFER;
}
if (!m->is_local_file) {
m->fmt->interrupt_callback.callback = interrupt_callback;
m->fmt->interrupt_callback.opaque = m;

View file

@ -163,7 +163,7 @@ static obs_properties_t *ffmpeg_source_getproperties(void *data)
obs_module_text("RestartWhenActivated"));
prop = obs_properties_add_int_slider(props, "buffering_mb",
obs_module_text("BufferingMB"), 1,
obs_module_text("BufferingMB"), 0,
16, 1);
obs_property_int_set_suffix(prop, " MB");