When editing buffer settings, ensure that MaxImageBuffers > PreEventCount.

pull/4202/head
Isaac Connor 2024-05-14 10:03:20 -04:00
parent a9a0a916a3
commit b4e29f45b5
4 changed files with 28 additions and 10 deletions

View File

@ -165,6 +165,7 @@ $SLANG = array(
'BadPort' => 'Port must be set to a valid number',
'BadPostEventCount' => 'Post event image count must be an integer of zero or more',
'BadPreEventCount' => 'Pre event image count must be at least zero, and less than image buffer size',
'BadPreEventCountMaxImageBufferCount' => 'Max Image Buffer Count should be greater than Pre event image count or else it cannot be satisfied',
'BadRefBlendPerc' => 'Reference blend percentage must be a positive integer',
'BadNoSaveJPEGsOrVideoWriter' => 'SaveJPEGs and VideoWriter are both set to disabled. Nothing will be recorded!',
'BadSectionLength' => 'Section length must be an integer of 30 or more',

View File

@ -141,7 +141,7 @@ function initPage() {
};
});
document.querySelectorAll('input[name="newMonitor[ImageBufferCount]"],input[name="newMonitor[MaxImageBufferCount]"],input[name="newMonitor[Width]"],input[name="newMonitor[Height]"],input[name="newMonitor[PreEventCount]"]').forEach(function(el) {
el.oninput = window['update_estimated_ram_use'].bind(el);
el.oninput = window['buffer_setting_oninput'].bind(el);
});
update_estimated_ram_use();
@ -311,17 +311,31 @@ function random_WebColour() {
);
}
function buffer_setting_oninput(e) {
const max_image_buffer_count = document.getElementById('newMonitor[MaxImageBufferCount]');
const pre_event_count = document.getElementById('newMonitor[PreEventCount]');
console.log(pre_event_count.value ,'>', max_image_buffer_count.value, this);
if (parseInt(pre_event_count.value) > parseInt(max_image_buffer_count.value)) {
if (this.id=='newMonitor[PreEventCount]') {
max_image_buffer_count.value=pre_event_count.value;
} else {
pre_event_count.value = max_image_buffer_count.value;
}
}
update_estimated_ram_use();
}
function update_estimated_ram_use() {
var width = document.querySelectorAll('input[name="newMonitor[Width]"]')[0].value;
var height = document.querySelectorAll('input[name="newMonitor[Height]"]')[0].value;
var colours = document.querySelectorAll('select[name="newMonitor[Colours]"]')[0].value;
const width = document.querySelectorAll('input[name="newMonitor[Width]"]')[0].value;
const height = document.querySelectorAll('input[name="newMonitor[Height]"]')[0].value;
const colours = document.querySelectorAll('select[name="newMonitor[Colours]"]')[0].value;
var min_buffer_count = parseInt(document.querySelectorAll('input[name="newMonitor[ImageBufferCount]"]')[0].value);
min_buffer_count += parseInt(document.querySelectorAll('input[name="newMonitor[PreEventCount]"]')[0].value);
var min_buffer_size = min_buffer_count * width * height * colours;
let min_buffer_count = parseInt(document.querySelectorAll('input[name="newMonitor[ImageBufferCount]"]')[0].value);
min_buffer_count += parseInt(document.getElementById('newMonitor[PreEventCount]').value);
const min_buffer_size = min_buffer_count * width * height * colours;
document.getElementById('estimated_ram_use').innerHTML = 'Min: ' + human_filesize(min_buffer_size);
var max_buffer_count = parseInt(document.querySelectorAll('input[name="newMonitor[MaxImageBufferCount]"]')[0].value);
const max_buffer_count = parseInt(document.getElementById('newMonitor[MaxImageBufferCount]').value);
if (max_buffer_count) {
var max_buffer_size = (min_buffer_count + max_buffer_count) * width * height * colours;
document.getElementById('estimated_ram_use').innerHTML += ' Max: ' + human_filesize(max_buffer_size);

View File

@ -142,6 +142,9 @@ function validateForm( form ) {
errors[errors.length] = "<?php echo translate('BadPostEventCount') ?>";
if ( !form.elements['newMonitor[StreamReplayBuffer]'].value || !(parseInt(form.elements['newMonitor[StreamReplayBuffer]'].value) >= 0 ) )
errors[errors.length] = "<?php echo translate('BadStreamReplayBuffer') ?>";
if (form.elements['newMonitor[PreEventCount]'].value > form.elements['newMonitor[MaxImageBufferCount]'].value)
errors[errors.length] = "<?php echo translate('BadPreEventCountMaxImageBufferCount') ?>";
if ( !form.elements['newMonitor[AlarmFrameCount]'].value || !(parseInt(form.elements['newMonitor[AlarmFrameCount]'].value) > 0 ) )
errors[errors.length] = "<?php echo translate('BadAlarmFrameCount') ?>";
if ( !form.elements['newMonitor[SectionLength]'].value || !(parseInt(form.elements['newMonitor[SectionLength]'].value) >= 30 ) )

View File

@ -1071,7 +1071,7 @@ echo htmlSelect('newMonitor[OutputContainer]', $videowriter_containers, $monitor
</tr>
<tr>
<td class="text-right pr-3"><?php echo translate('MaxImageBufferCount'); echo makeHelpLink('MaxImageBufferCount'); ?></td>
<td><input type="number" name="newMonitor[MaxImageBufferCount]" value="<?php echo validHtmlStr($monitor->MaxImageBufferCount()) ?>" min="0"/></td>
<td><input type="number" id="newMonitor[MaxImageBufferCount]" name="newMonitor[MaxImageBufferCount]" value="<?php echo validHtmlStr($monitor->MaxImageBufferCount()) ?>" min="0"/></td>
</tr>
<tr>
<td class="text-right pr-3"><?php echo translate('WarmupFrames') ?></td>
@ -1079,7 +1079,7 @@ echo htmlSelect('newMonitor[OutputContainer]', $videowriter_containers, $monitor
</tr>
<tr>
<td class="text-right pr-3"><?php echo translate('PreEventImageBuffer') ?></td>
<td><input type="number" name="newMonitor[PreEventCount]" value="<?php echo validHtmlStr($monitor->PreEventCount()) ?>" min="0"/></td>
<td><input type="number" id="newMonitor[PreEventCount]" name="newMonitor[PreEventCount]" value="<?php echo validHtmlStr($monitor->PreEventCount()) ?>" min="0"/></td>
</tr>
<tr>
<td class="text-right pr-3"><?php echo translate('PostEventImageBuffer') ?></td>