ftue changes

This commit is contained in:
Seth Call 2020-09-01 13:33:04 -05:00
parent cc69aa098e
commit 16c5ee9c78
14 changed files with 122 additions and 101 deletions

View File

@ -60,35 +60,35 @@ module JamRuby
if ip_address and !ip_address.eql?(conn.ip_address) if ip_address and !ip_address.eql?(conn.ip_address)
# turn ip_address string into a number, then fetch the isp and block records and update location info # turn ip_address string into a number, then fetch the isp and block records and update location info
addr = JamIsp.ip_to_num(ip_address) #addr = JamIsp.ip_to_num(ip_address)
#puts("============= JamIsp.ip_to_num returns #{addr} for #{ip_address} =============") #puts("============= JamIsp.ip_to_num returns #{addr} for #{ip_address} =============")
isp = JamIsp.lookup(addr) #isp = JamIsp.lookup(addr)
#puts("============= JamIsp.lookup returns #{isp.inspect} for #{addr} =============") #puts("============= JamIsp.lookup returns #{isp.inspect} for #{addr} =============")
if isp.nil? then #if isp.nil? then
ispid = 0 # ispid = 0
else #else
ispid = isp.coid # ispid = isp.coid
end #end
block = GeoIpBlocks.lookup(addr) #block = GeoIpBlocks.lookup(addr)
#puts("============= GeoIpBlocks.lookup returns #{block.inspect} for #{addr} =============") #puts("============= GeoIpBlocks.lookup returns #{block.inspect} for #{addr} =============")
if block.nil? then #if block.nil? then
locid = 0 # locid = 0
else #else
locid = block.locid # locid = block.locid
end #end
location = GeoIpLocations.find_by_locid(locid) #location = GeoIpLocations.find_by_locid(locid)
if location.nil? || isp.nil? || block.nil? #if location.nil? || isp.nil? || block.nil?
locidispid = nil # locidispid = nil
else #else
locidispid = locid*1000000+ispid # locidispid = locid*1000000+ispid
end #end
conn.ip_address = ip_address conn.ip_address = ip_address
conn.addr = addr #conn.addr = addr
conn.locidispid = locidispid #conn.locidispid = locidispid
conn.save!(validate: false) conn.save!(validate: false)
end end
@ -186,32 +186,34 @@ SQL
# turn ip_address string into a number, then fetch the isp and block records # turn ip_address string into a number, then fetch the isp and block records
addr = JamIsp.ip_to_num(ip_address) addr = nil
#addr = JamIsp.ip_to_num(ip_address)
#puts("============= JamIsp.ip_to_num returns #{addr} for #{ip_address} =============") #puts("============= JamIsp.ip_to_num returns #{addr} for #{ip_address} =============")
isp = JamIsp.lookup(addr) #isp = JamIsp.lookup(addr)
#puts("============= JamIsp.lookup returns #{isp.inspect} for #{addr} =============") #puts("============= JamIsp.lookup returns #{isp.inspect} for #{addr} =============")
if isp.nil? then #if isp.nil? then
ispid = 0 # ispid = 0
else #else
ispid = isp.coid # ispid = isp.coid
end #end
block = GeoIpBlocks.lookup(addr) #block = GeoIpBlocks.lookup(addr)
#puts("============= GeoIpBlocks.lookup returns #{block.inspect} for #{addr} =============") #puts("============= GeoIpBlocks.lookup returns #{block.inspect} for #{addr} =============")
if block.nil? then #if block.nil? then
locid = 0 # locid = 0
else #else
locid = block.locid # locid = block.locid
end #end
location = GeoIpLocations.find_by_locid(locid) #location = GeoIpLocations.find_by_locid(locid)
if location.nil? || isp.nil? || block.nil? #if location.nil? || isp.nil? || block.nil?
# locidispid = nil
#else
# locidispid = locid*1000000+ispid
#end
addr = IPAddr.new(ip_address).to_i
locidispid = nil locidispid = nil
else
locidispid = locid*1000000+ispid
end
lock_connections(conn) lock_connections(conn)
conn.exec("INSERT INTO connections (user_id, client_id, channel_id, ip_address, client_type, addr, locidispid, aasm_state, stale_time, expire_time, udp_reachable, gateway, is_jamblaster) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)", conn.exec("INSERT INTO connections (user_id, client_id, channel_id, ip_address, client_type, addr, locidispid, aasm_state, stale_time, expire_time, udp_reachable, gateway, is_jamblaster) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)",

View File

@ -45,10 +45,10 @@ module JamRuby
end end
end end
isp = JamIsp.lookup(addr) #isp = JamIsp.lookup(addr)
if isp #if isp
ispid = isp.coid # ispid = isp.coid
end #end
end end
{city: city, state: state, country: country, addr: addr, locidispid: (locid.nil? || ispid.nil?) ? nil : Score.compute_locidispid(locid, ispid) } {city: city, state: state, country: country, addr: addr, locidispid: (locid.nil? || ispid.nil?) ? nil : Score.compute_locidispid(locid, ispid) }

View File

@ -1,4 +1,5 @@
require 'ipaddr' require 'ipaddr'
=begin
module JamRuby module JamRuby
class JamIsp < ActiveRecord::Base class JamIsp < ActiveRecord::Base
@ -219,3 +220,4 @@ module JamRuby
end end
end end
end end
=end

View File

@ -49,21 +49,21 @@ module JamRuby
if ip_address and !ip_address.eql?(connection.ip_address) if ip_address and !ip_address.eql?(connection.ip_address)
# locidispid stuff # locidispid stuff
addr = JamIsp.ip_to_num(ip_address) #addr = JamIsp.ip_to_num(ip_address)
isp = JamIsp.lookup(addr) #isp = JamIsp.lookup(addr)
if isp.nil? then ispid = 0 else ispid = isp.coid end #if isp.nil? then ispid = 0 else ispid = isp.coid end
block = GeoIpBlocks.lookup(addr) #block = GeoIpBlocks.lookup(addr)
if block.nil? then locid = 0 else locid = block.locid end #if block.nil? then locid = 0 else locid = block.locid end
location = GeoIpLocations.find_by_locid(locid) #location = GeoIpLocations.find_by_locid(locid)
if location.nil? || isp.nil? || block.nil? #if location.nil? || isp.nil? || block.nil?
locidispid = nil # locidispid = nil
else #else
locidispid = locid*1000000+ispid # locidispid = locid*1000000+ispid
end #end
connection.ip_address = ip_address connection.ip_address = ip_address
connection.addr = addr #connection.addr = addr
connection.locidispid = locidispid #connection.locidispid = locidispid
end end
connection.client_type = 'latency_tester' connection.client_type = 'latency_tester'

View File

@ -4,7 +4,7 @@ include Devise::Models
module JamRuby module JamRuby
class User < ActiveRecord::Base class User < ActiveRecord::Base
include Geokit::ActsAsMappable::Glue unless defined?(acts_as_mappable) #include Geokit::ActsAsMappable::Glue unless defined?(acts_as_mappable)
include HtmlSanitize include HtmlSanitize
#include ::AutoStripAttributes #include ::AutoStripAttributes
html_sanitize strict: [:first_name, :last_name, :city, :state, :country, :biography] html_sanitize strict: [:first_name, :last_name, :city, :state, :country, :biography]
@ -68,7 +68,7 @@ module JamRuby
devise :database_authenticatable, :recoverable, :rememberable devise :database_authenticatable, :recoverable, :rememberable
acts_as_mappable #acts_as_mappable
after_save :update_teacher_pct after_save :update_teacher_pct
@ -1833,7 +1833,8 @@ module JamRuby
# gets the GeoIpLocation for the user's last_jam_locidispid (where are they REALLY, vs profile info) # gets the GeoIpLocation for the user's last_jam_locidispid (where are they REALLY, vs profile info)
def geoiplocation def geoiplocation
GeoIpLocations.find_by_locid(last_jam_locidispid / 1000000) if last_jam_locidispid return nil
#GeoIpLocations.find_by_locid(last_jam_locidispid / 1000000) if last_jam_locidispid
end end
def update_last_jam(remote_ip, reason) def update_last_jam(remote_ip, reason)

View File

@ -317,14 +317,14 @@
display: 'MacOSX Built-In', display: 'MacOSX Built-In',
shortName: 'Built-In', shortName: 'Built-In',
videoURL: "https://www.youtube.com/watch?v=7-9PW50ygHk", videoURL: "https://www.youtube.com/watch?v=7-9PW50ygHk",
showKnobs: false, showKnobs: true,
showASIO: false showASIO: false
}, },
MacOSX_interface: { MacOSX_interface: {
display: 'MacOSX external interface', display: 'MacOSX external interface',
shortName: 'External', shortName: 'External',
videoURL: "https://www.youtube.com/watch?v=7BLld6ogm14", videoURL: "https://www.youtube.com/watch?v=7BLld6ogm14",
showKnobs: false, showKnobs: true,
showASIO: false showASIO: false
}, },
Win32_wdm: { Win32_wdm: {
@ -338,14 +338,14 @@
display: 'Windows ASIO', display: 'Windows ASIO',
shortName : 'ASIO', shortName : 'ASIO',
videoURL: "https://www.youtube.com/watch?v=PGUmISTVVMY", videoURL: "https://www.youtube.com/watch?v=PGUmISTVVMY",
showKnobs: false, showKnobs: true,
showASIO: true showASIO: true
}, },
Win32_asio4all: { Win32_asio4all: {
display: 'Windows ASIO4ALL', display: 'Windows ASIO4ALL',
shortName : 'ASIO4ALL', shortName : 'ASIO4ALL',
videoURL: "https://www.youtube.com/watch?v=PGUmISTVVMY", videoURL: "https://www.youtube.com/watch?v=PGUmISTVVMY",
showKnobs: false, showKnobs: true,
showASIO: true showASIO: true
}, },
Linux: { Linux: {

View File

@ -177,21 +177,7 @@ StatsInfo = {
audio_type = 'JamBlaster' audio_type = 'JamBlaster'
audioStats.push(@stat(audio, 'audio', 'Gear Driver', 'audio_in_type', audio_type)) audioStats.push(@stat(audio, 'audio', 'Gear Driver', 'audio_in_type', audio_type))
if audio.framesize? if audio.framesize?
framesize = '?' framesize = audio.framesize + ' ms'
if audio.framesize == 1.0
framesize = '1 ms'
else if audio.framesize == 2.0
framesize = '1 ms'
else if audio.framesize == 2.5
framesize = '2.5 ms'
else if audio.framesize == 5
framesize = '5 ms'
else if audio.framesize == 10
framesize = '10 ms'
else if audio.framesize == 20
framesize = '20 ms'
else if audio.framesize == 40
framesize = '40 ms'
audioStats.push(@stat(audio, 'audio', 'Frame Size', 'framesize', framesize)) audioStats.push(@stat(audio, 'audio', 'Frame Size', 'framesize', framesize))
networkTag = null networkTag = null

View File

@ -19,7 +19,9 @@
var ADJUST_GEAR_LINK_CLICKED = 'frame_buffers.adjust_gear_settings_clicked'; var ADJUST_GEAR_LINK_CLICKED = 'frame_buffers.adjust_gear_settings_clicked';
function selectedFramesize() { function selectedFramesize() {
return parseFloat($frameSize.val()); var selectedFrameSize = parseFloat($frameSize.val());
console.log("selected FrameSize: ", selectedFrameSize)
return selectedFrameSize;
} }
function selectedBufferIn() { function selectedBufferIn() {
@ -67,6 +69,7 @@
} }
function switchToWdm() { function switchToWdm() {
/**
if($frameSize.find('option').length == 3){ if($frameSize.find('option').length == 3){
console.log("switching to WDM framesizez") console.log("switching to WDM framesizez")
$frameSize.html('<option val="2.5">2.5</option><option val="5">5</option><option val="10">10</option><option val="20">20</option><option val="40">40</option>') $frameSize.html('<option val="2.5">2.5</option><option val="5">5</option><option val="10">10</option><option val="20">20</option><option val="40">40</option>')
@ -74,11 +77,12 @@
} }
else { else {
console.log("nothing to switch to on WDM") console.log("nothing to switch to on WDM")
} }*/
} }
function switchOffWdm() { function switchOffWdm() {
/**
if($frameSize.find('option').length != 3){ if($frameSize.find('option').length != 3){
console.log("switching off of WDM") console.log("switching off of WDM")
$frameSize.html('<option val="2.5">2.5</option><option val="5">5</option><option val="10">10</option>') $frameSize.html('<option val="2.5">2.5</option><option val="5">5</option><option val="10">10</option>')
@ -86,7 +90,7 @@
} }
else { else {
console.log("nothing to clean up on WDM") console.log("nothing to clean up on WDM")
} }*/
} }

View File

@ -547,29 +547,46 @@
function onSampleRateChanged() { function onSampleRateChanged() {
console.log("onSampleRateChanged: ", sampleRate.selectedSampleRate()) console.log("onSampleRateChanged: ", sampleRate.selectedSampleRate())
context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); //context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']});
jamClient.FTUESetPreferredMixerSampleRate(sampleRate.selectedSampleRate()); jamClient.FTUESetPreferredMixerSampleRate(sampleRate.selectedSampleRate());
jamClient.FTUESetPreferredOutputSampleRate(sampleRate.selectedSampleRate()); jamClient.FTUESetPreferredOutputSampleRate(sampleRate.selectedSampleRate());
invalidateScore(); invalidateScore();
safeAtttemptScore();
} }
function onFramesizeChanged() { function onFramesizeChanged() {
context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); //context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']});
updateDefaultBuffers(); updateDefaultBuffers();
jamClient.FTUESetFrameSize(frameBuffers.selectedFramesize()); jamClient.FTUESetFrameSize(frameBuffers.selectedFramesize());
invalidateScore(); invalidateScore();
safeAtttemptScore();
} }
function onBufferInChanged() { function onBufferInChanged() {
context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); //context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']});
jamClient.FTUESetInputLatency(frameBuffers.selectedBufferIn()); jamClient.FTUESetInputLatency(frameBuffers.selectedBufferIn());
invalidateScore(); invalidateScore();
safeAtttemptScore()
} }
function onBufferOutChanged() { function onBufferOutChanged() {
context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); //context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']});
jamClient.FTUESetOutputLatency(frameBuffers.selectedBufferOut()); jamClient.FTUESetOutputLatency(frameBuffers.selectedBufferOut());
invalidateScore(); invalidateScore();
safeAtttemptScore()
}
function safeAtttemptScore() {
scheduleRescanSystem(function() {
if (getSelectedInputs().length > 0 && getSelectedOutputs().length == 2) {
logger.debug("after rescan, ready to attempt score")
attemptScore();
}
else {
logger.debug("after rescan, not ready to attempt score")
}
}, 500, false);
return false;
} }
function getSelectedInputs() { function getSelectedInputs() {
@ -588,16 +605,7 @@
$highLatencyNotice = null; $highLatencyNotice = null;
} }
scheduleRescanSystem(function() { safeAtttemptScore()
if (getSelectedInputs().length > 0 && getSelectedOutputs().length == 2) {
logger.debug("after rescan, ready to attempt score")
attemptScore();
}
else {
logger.debug("after rescan, not ready to attempt score")
}
}, 3000, false);
return false;
}) })
} }

View File

@ -22,6 +22,7 @@
.buffers { .buffers {
float:left; float:left;
width:60%; width:60%;
display:none;
h2 { h2 {
margin-left:5px; margin-left:5px;

View File

@ -177,6 +177,20 @@
.frame-and-buffers { .frame-and-buffers {
display: none; display: none;
margin-top: 5px; margin-top: 5px;
.framesize {
float:none;
width:auto;
margin-right:0;
.dropdown-wrapper.easydropdown-wrapper {
width:73px;
}
}
.framesize h2 {
display:inline;
margin-right:15px;
}
} }
.audio-port { .audio-port {
@ -723,7 +737,7 @@
} }
.easydropdown-wrapper { .easydropdown-wrapper {
width:auto; width:auto;
float:left;
} }
} }

View File

@ -1,7 +1,9 @@
.frame-and-buffers .frame-and-buffers
.framesize .framesize
h2 Frame h2 Frame Size:
select.select-frame-size select.select-frame-size
option val='1' 1
option val='2' 2
option val='2.5' 2.5 option val='2.5' 2.5
option val='5' 5 option val='5' 5
option val='10' 10 option val='10' 10

View File

@ -306,7 +306,7 @@ if defined?(Bundler)
config.middleware.insert_before "ActionDispatch::Cookies", "Middlewares::ClearDuplicatedSession" config.middleware.insert_before "ActionDispatch::Cookies", "Middlewares::ClearDuplicatedSession"
config.network_test_required = false config.network_test_required = false
# how long should the frontend wait for the IO to stabilize before asking for a IO score? # how long should the frontend wait for the IO to stabilize before asking for a IO score?
config.ftue_io_wait_time = 10 config.ftue_io_wait_time = 5
# what should the threshold be for us to say, 'this person can't play at this rate' during the network test # what should the threshold be for us to say, 'this person can't play at this rate' during the network test
config.ftue_packet_rate_treshold = 0.95 config.ftue_packet_rate_treshold = 0.95
# how long to test at each network test step # how long to test at each network test step

View File

@ -63,6 +63,7 @@ module JamWebsockets
@maximum_minutely_heartbeat_rate_client = nil @maximum_minutely_heartbeat_rate_client = nil
@gateway_name = nil @gateway_name = nil
@stored_ars = nil @stored_ars = nil
@stored_ars_beta = nil
@ar_base_logger = ::Logging::Repository.instance[ActiveRecord::Base] @ar_base_logger = ::Logging::Repository.instance[ActiveRecord::Base]
@message_stats = {} @message_stats = {}
@time_it_sums = {} @time_it_sums = {}