From b0d88f7c1f73c68dc828ce6b972990b93e995909 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 30 Jan 2016 09:35:23 -0800 Subject: [PATCH] libobs: Start audio tracks before starting video tracks When using multi-track audio, encoders cannot be paired like they can when only using a single audio track with video, so it has to choose the best point in the interleaved buffer as the "starting point", and if the encoders start up at different times, it has to prune that data and wait to start the output on the next video keyframe. When the audio encoders started up, there was the case where the encoders would take some time to load, and it would cause the pruning code to wait for the next keyframe to ensure startup syncing. Starting the audio encoders before starting the video encoder should reduce the possibility of that happening in a multi-track scenario. --- libobs/obs-output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libobs/obs-output.c b/libobs/obs-output.c index 29e8e4d59..502f28f3b 100644 --- a/libobs/obs-output.c +++ b/libobs/obs-output.c @@ -1289,11 +1289,11 @@ static void hook_data_capture(struct obs_output *output, bool encoded, preserve_active(output) ? "on" : "off"); } + if (has_audio) + start_audio_encoders(output, encoded_callback); if (has_video) obs_encoder_start(output->video_encoder, encoded_callback, output); - if (has_audio) - start_audio_encoders(output, encoded_callback); } else { if (has_video) video_output_connect(output->video,