Merge branch 'master' into add_manufacturer_model_to_monitors

This commit is contained in:
Isaac Connor 2021-11-17 17:45:47 -05:00
commit a0666e777a
2 changed files with 22 additions and 8 deletions

View File

@ -458,6 +458,17 @@ int FfmpegCamera::OpenFfmpeg() {
#endif #endif
} // end if hwaccel_name } // end if hwaccel_name
// set codec to automatically determine how many threads suits best for the decoding job
mVideoCodecContext->thread_count = 0;
if (mVideoCodec->capabilities | AV_CODEC_CAP_FRAME_THREADS) {
mVideoCodecContext->thread_type = FF_THREAD_FRAME;
} else if (mVideoCodec->capabilities | AV_CODEC_CAP_SLICE_THREADS) {
mVideoCodecContext->thread_type = FF_THREAD_SLICE;
} else {
mVideoCodecContext->thread_count = 1; //don't use multithreading
}
ret = avcodec_open2(mVideoCodecContext, mVideoCodec, &opts); ret = avcodec_open2(mVideoCodecContext, mVideoCodec, &opts);
e = nullptr; e = nullptr;

View File

@ -19,24 +19,27 @@
// //
// Monitor edit actions, monitor id derived, require edit permissions for that monitor // Monitor edit actions, monitor id derived, require edit permissions for that monitor
if ( ! canEdit('Monitors') ) { if (!canEdit('Monitors')) {
ZM\Warning("Monitor actions require Monitors Permissions"); ZM\Warning("Monitor actions require Monitors Permissions");
return; return;
} }
if ( $action == 'save' ) { if ($action == 'save') {
foreach ( $_REQUEST['mids'] as $mid ) { foreach ($_REQUEST['mids'] as $mid) {
$mid = ValidInt($mid); $mid = ValidInt($mid);
if ( ! canEdit('Monitors', $mid) ) { if (!canEdit('Monitors', $mid)) {
ZM\Warning("Cannot edit monitor $mid"); ZM\Warning('Cannot edit monitor '.$mid);
continue; continue;
} }
$Monitor = new ZM\Monitor($mid); $Monitor = new ZM\Monitor($mid);
if ( $Monitor->Type() != 'WebSite' ) { if ($Monitor->Type() != 'WebSite') {
$Monitor->zmcControl('stop'); $Monitor->zmcControl('stop');
} }
$Monitor->save($_REQUEST['newMonitor']); if (!$Monitor->save($_REQUEST['newMonitor'])) {
if ( $Monitor->Function() != 'None' && $Monitor->Type() != 'WebSite' ) { global $error_message;
$error_message .= 'Error saving monitor: ' . $Monitor->get_last_error().'<br/>';
}
if ($Monitor->Function() != 'None' && $Monitor->Type() != 'WebSite') {
$Monitor->zmcControl('start'); $Monitor->zmcControl('start');
} }
} // end foreach mid } // end foreach mid