mirror of
https://github.com/Genymobile/scrcpy
synced 2024-12-18 05:14:35 +00:00
Increase default audio buffer for FLAC
FLAC is not low latency: the default encoder produces blocks of 4096 samples, which represent ~85.333ms. Increase the audio buffer by default so that audio playback works.
This commit is contained in:
parent
394b8e61ad
commit
cd03f92c68
@ -2264,6 +2264,17 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|||||||
opts->require_audio = true;
|
opts->require_audio = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opts->audio_playback && opts->audio_buffer == -1) {
|
||||||
|
// Use 50 ms audio buffer by default, but use a higher value for FLAC,
|
||||||
|
// which is not low latency (the default encoder produces blocks of
|
||||||
|
// 4096 samples, which represent ~85.333ms).
|
||||||
|
LOGI("FLAC audio: audio buffer increased to 120 ms (use "
|
||||||
|
"--audio-buffer to set a custom value)");
|
||||||
|
opts->audio_buffer = opts->audio_codec == SC_CODEC_FLAC
|
||||||
|
? SC_TICK_FROM_MS(120)
|
||||||
|
: SC_TICK_FROM_MS(50);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_V4L2
|
#ifdef HAVE_V4L2
|
||||||
if (v4l2) {
|
if (v4l2) {
|
||||||
if (opts->lock_video_orientation ==
|
if (opts->lock_video_orientation ==
|
||||||
|
@ -46,7 +46,7 @@ const struct scrcpy_options scrcpy_options_default = {
|
|||||||
.window_height = 0,
|
.window_height = 0,
|
||||||
.display_id = 0,
|
.display_id = 0,
|
||||||
.display_buffer = 0,
|
.display_buffer = 0,
|
||||||
.audio_buffer = SC_TICK_FROM_MS(50),
|
.audio_buffer = -1, // depends on the audio format,
|
||||||
.audio_output_buffer = SC_TICK_FROM_MS(5),
|
.audio_output_buffer = SC_TICK_FROM_MS(5),
|
||||||
.time_limit = 0,
|
.time_limit = 0,
|
||||||
#ifdef HAVE_V4L2
|
#ifdef HAVE_V4L2
|
||||||
|
Loading…
Reference in New Issue
Block a user