Go for a 0.250 second buffer length.
This commit is contained in:
+6
-5
@@ -629,12 +629,12 @@ static int init(int argc, char **argv) {
|
||||
config.alsa_use_hardware_mute = 0; // don't use it by default
|
||||
|
||||
config.audio_backend_latency_offset = 0;
|
||||
config.audio_backend_buffer_desired_length = 0.15;
|
||||
config.audio_backend_buffer_desired_length = 0.25;
|
||||
config.audio_backend_buffer_interpolation_threshold_in_seconds =
|
||||
0.100; // below this, basic interpolation will be used to save time.
|
||||
0.175; // below this, basic interpolation will be used to save time.
|
||||
config.alsa_maximum_stall_time = 0.200; // 200 milliseconds -- if it takes longer, it's a problem
|
||||
config.audio_backend_silence_threshold = 0.040; //start sending silent frames if the delay goes below this time
|
||||
config.audio_backend_silence_scan_interval = 0.003; //check silence threshold this often
|
||||
config.audio_backend_silence_threshold = 0.60; //start sending silent frames if the delay goes below this time
|
||||
config.audio_backend_silence_scan_interval = 0.004; //check silence threshold this often
|
||||
|
||||
stall_monitor_error_threshold =
|
||||
(uint64_t)1000000 * config.alsa_maximum_stall_time; // stall time max to microseconds;
|
||||
@@ -1472,7 +1472,8 @@ void *alsa_buffer_monitor_thread_code(void *arg) {
|
||||
sleep_time_in_fp = sleep_time_in_fp << 32;
|
||||
sleep_time_in_fp = sleep_time_in_fp / 1000;
|
||||
// debug(1,"alsa: sleep_time: %d ms or 0x%" PRIx64 " in fp form.",sleep_time_ms,sleep_time_in_fp);
|
||||
int frames_of_silence = (desired_sample_rate * sleep_time_ms * 2) / 1000;
|
||||
// int frames_of_silence = (desired_sample_rate * sleep_time_ms * 2) / 1000;
|
||||
int frames_of_silence = 1024;
|
||||
size_t size_of_silence_buffer = frames_of_silence * frame_size;
|
||||
// debug(1,"Silence buffer length: %u bytes.",size_of_silence_buffer);
|
||||
void *silence = malloc(size_of_silence_buffer);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* All rights reserved.
|
||||
*
|
||||
* Modifications for audio synchronisation
|
||||
* and related work, copyright (c) Mike Brady 2014 -- 2018
|
||||
* and related work, copyright (c) Mike Brady 2014 -- 2019
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
@@ -624,6 +624,16 @@ int32_t rand_in_range(int32_t exclusive_range_limit) {
|
||||
|
||||
static inline void process_sample(int32_t sample, char **outp, enum sps_format_t format, int volume,
|
||||
int dither, rtsp_conn_info *conn) {
|
||||
/*
|
||||
{
|
||||
static int old_volume = 0;
|
||||
if (volume != old_volume) {
|
||||
debug(1,"Volume is now %d.",volume);
|
||||
old_volume = volume;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
int64_t hyper_sample = sample;
|
||||
int result = 0;
|
||||
|
||||
@@ -1554,7 +1564,7 @@ void *player_thread_func(void *arg) {
|
||||
|
||||
conn->dac_buffer_queue_minimum_length = (int64_t)(
|
||||
config.audio_backend_buffer_interpolation_threshold_in_seconds * config.output_rate);
|
||||
debug(1, "dac_buffer_queue_minimum_length is %" PRId64 " frames.",
|
||||
debug(3, "dac_buffer_queue_minimum_length is %" PRId64 " frames.",
|
||||
conn->dac_buffer_queue_minimum_length);
|
||||
|
||||
conn->session_corrections = 0;
|
||||
@@ -2220,9 +2230,6 @@ void *player_thread_func(void *arg) {
|
||||
}
|
||||
}
|
||||
|
||||
if (config.output->preflight)
|
||||
config.output->preflight(conn->outbuf,play_samples);
|
||||
|
||||
if ((current_delay < conn->dac_buffer_queue_minimum_length) ||
|
||||
(config.packet_stuffing == ST_basic)) {
|
||||
play_samples =
|
||||
|
||||
Reference in New Issue
Block a user