From eb0f54e79d8ab14704d8a4e866d6ceb244f0be6a Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Wed, 2 Oct 2019 23:48:13 +0200 Subject: [PATCH] reset status values properly on reconnect --- htdocs/openwebrx.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index ac319d2..4eea348 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1170,6 +1170,7 @@ function audio_calculate_resampling(targetRate) debug_ws_data_received=0; +debug_ws_time_start = 0; max_clients_num=0; client_num = 0; @@ -1749,6 +1750,8 @@ function on_ws_opened() { ws.send("SERVER DE CLIENT client=openwebrx.js type=receiver"); divlog("WebSocket opened to "+ws_url); + debug_ws_data_received = 0; + debug_ws_time_start = new Date().getTime(); reconnect_timeout = false; } @@ -2087,11 +2090,11 @@ function audio_init() audio_debug_time_start=(new Date()).getTime(); audio_debug_time_last_start=audio_debug_time_start; + audio_buffer_current_count_debug = 0; //https://github.com/0xfe/experiments/blob/master/www/tone/js/sinewave.js audio_initialized=1; // only tell on_ws_recv() not to call it again - //on Chrome v36, createJavaScriptNode has been replaced by createScriptProcessor createjsnode_function = (audio_context.createJavaScriptNode == undefined)?audio_context.createScriptProcessor.bind(audio_context):audio_context.createJavaScriptNode.bind(audio_context); audio_node = createjsnode_function(audio_buffer_size, 0, 1); @@ -2749,11 +2752,14 @@ function debug_audio() progressbar_set(e("openwebrx-bar-audio-speed"),audio_speed_value/500000,"Audio stream ["+(audio_speed_value/1000).toFixed(0)+" kbps]",false); var audio_output_value=(audio_buffer_current_count_debug*audio_buffer_size)/audio_debug_time_taken; - progressbar_set(e("openwebrx-bar-audio-output"),audio_output_value/55000,"Audio output ["+(audio_output_value/1000).toFixed(1)+" ksps]",audio_output_value>55000||audio_output_value<10000); + var audio_max_rate = audio_context.sampleRate * 1.25; + var audio_min_rate = audio_context.sampleRate * .25; + progressbar_set(e("openwebrx-bar-audio-output"),audio_output_value/audio_max_rate,"Audio output ["+(audio_output_value/1000).toFixed(1)+" ksps]",audio_output_value>audio_max_rate||audio_output_value