fix: bug-fix sweep across node, audio, render, plugin subsystems

Node core:
- MathNode/TrigonometryNode combo strings realigned with Operation enums
- mathbase scalar/vector operand pick no longer uses bitwise type checks
- NodeSetPositionAndDependenciesRecursively moves dependencies again
- RemoveAllKeyframes undo actually restores keyframes
- NodeGroup GetInputName null-deref guard, passthrough ids use input id
- NodeValueTable::Has is an exact type match; tag fallback only for
  empty tags; kStrCombo/kPushButton get data type names
- delete_all_keyframes no longer loops forever on unparented keyframes;
  keyframe-load failures propagate; rational interpolation falls back to
  double; OpacityEffect no longer leaks its internal MathNode

Audio/footage:
- AudioVisualWaveform: GetSummaryFromTime underflow OOB read, TrimIn
  prepend length bookkeeping, OverwriteSums source channel indexing
- PanNode inserts the pan value into the sample job (keyframed pan
  works); OutputParamsChanged is emitted on device change; PortAudio
  device indices are validated before Pa_GetDeviceInfo
- Footage: AdjustTimeByLoopMode no longer hangs/UBs on degenerate
  lengths, GetStreamIndex bounds-checked, CheckFootage clears stale
  state on missing files, failed probes are not cached,
  FootageDescription::Load requires its own root element

Render/track:
- ViewerOutput pushes the tagged samples value; TrackList disconnects
  the track-height lambda; GetTrackFromReference validity check
- RenderManager dummy backend: null-initialized threads, guarded
  decoder-cache/timer paths; Renderer::Destroy releases color cache
  shaders/textures; unknown dynamic backends no longer alias to oakgl
- SharedMemoryRegion POSIX attach validates segment size; ReadMessage
  skips blank lines instead of failing; GC counter clamped;
  IsRenderingCustomRange implemented; TimeOffsetNode gets a true
  inverse OutputTimeAdjustment; zero-speed clips return the held frame

Plugin/nodes:
- OliveClip: stored default region of definition is honored, on-demand
  images are cached; OliveHost sets host identity properties and logs
  instead of showing modal dialogs offscreen; Plugin.h dead decls gone
- DespillNode guards graph-less use with Rec.709 fallback; description
  typos fixed (despill, swirl); mosaic applies when only one axis
  matches; Windows-only Project filename separator test fixed
This commit is contained in:
2026-07-17 08:26:48 +08:00
parent d9a4e27045
commit 2aa921b215
61 changed files with 731 additions and 254 deletions
+10 -3
View File
@@ -37,9 +37,16 @@ DynamicRenderer::~DynamicRenderer()
// system libGL/libvulkan loader is never mistaken for an Oak render backend.
QString DynamicRenderer::LibraryFilename() const
{
const QString base = backend_ == QStringLiteral("vulkan") ?
QStringLiteral("oakvulkan") :
QStringLiteral("oakgl");
QString base;
if (backend_ == QStringLiteral("opengl")) {
base = QStringLiteral("oakgl");
} else if (backend_ == QStringLiteral("vulkan")) {
base = QStringLiteral("oakvulkan");
} else {
// Unknown backend: use the name verbatim so the load fails and the
// caller's OpenGL fallback engages
base = backend_;
}
#if defined(Q_OS_WIN)
const QString filename = base + QStringLiteral(".dll");
#elif defined(Q_OS_MAC)
+25 -26
View File
@@ -38,37 +38,36 @@ bool WriteMessage(QIODevice *device, const QJsonObject &obj)
bool ReadMessage(QByteArray *buffer, QJsonObject *out, bool *ok)
{
const int newline = buffer->indexOf('\n');
if (newline < 0) {
// No complete line buffered yet.
return false;
}
const QByteArray line = buffer->left(newline);
buffer->remove(0, newline + 1);
// Skip blank lines silently (e.g. a stray newline) without flagging an error.
if (line.trimmed().isEmpty()) {
if (ok) {
*ok = false;
while (true) {
const int newline = buffer->indexOf('\n');
if (newline < 0) {
// No complete line buffered yet.
return false;
}
return false;
}
QJsonParseError err;
const QJsonDocument doc = QJsonDocument::fromJson(line, &err);
if (err.error != QJsonParseError::NoError || !doc.isObject()) {
if (ok) {
*ok = false;
const QByteArray line = buffer->left(newline);
buffer->remove(0, newline + 1);
// Skip blank lines silently (e.g. a stray newline) without flagging an error.
if (line.trimmed().isEmpty()) {
continue;
}
return false;
}
*out = doc.object();
if (ok) {
*ok = true;
QJsonParseError err;
const QJsonDocument doc = QJsonDocument::fromJson(line, &err);
if (err.error != QJsonParseError::NoError || !doc.isObject()) {
if (ok) {
*ok = false;
}
return false;
}
*out = doc.object();
if (ok) {
*ok = true;
}
return true;
}
return true;
}
// ---- HandshakeMsg ---------------------------------------------------------------------------
+20
View File
@@ -166,6 +166,26 @@ bool SharedMemoryRegion::Open(const QString &key, size_t size, Mode mode)
shm_unlink(name_bytes.constData());
return false;
}
} else {
// mmap() succeeds even beyond the real segment size and only faults
// (SIGBUS) on access, so verify the segment is large enough up front.
struct stat st;
if (fstat(fd_, &st) != 0) {
error_ = QStringLiteral("fstat failed: %1")
.arg(QString::fromUtf8(strerror(errno)));
::close(fd_);
fd_ = -1;
return false;
}
if (st.st_size < off_t(size)) {
error_ = QStringLiteral(
"shared memory segment is %1 bytes, smaller than the requested %2")
.arg(qint64(st.st_size))
.arg(qint64(size));
::close(fd_);
fd_ = -1;
return false;
}
}
data_ = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0);
+10 -2
View File
@@ -504,8 +504,16 @@ void PreviewAutoCacher::CancelAudioTasks(bool and_wait_for_them_to_finish)
bool PreviewAutoCacher::IsRenderingCustomRange() const
{
/*const VideoCacheData &d = video_cache_data_.value(viewer_node_);
return d.iterator.IsCustomRange() && d.iterator.HasNext();*/
if (!use_custom_range_) {
return false;
}
for (const VideoJob &job : pending_video_jobs_) {
if (job.range == custom_autocache_range_ && job.iterator.HasNext()) {
return true;
}
}
return false;
}
+18 -5
View File
@@ -129,16 +129,24 @@ QVariant Renderer::GetDefaultShader()
void Renderer::Destroy()
{
destroyed_ = true;
if (lifetime_) {
lifetime_->alive = false;
}
if (!default_shader_.isNull()) {
DestroyNativeShader(default_shader_);
default_shader_.clear();
}
color_cache_.clear();
{
QMutexLocker locker(&color_cache_mutex_);
// Destroy the cached native shaders explicitly. The LUT textures are
// TexturePtrs whose destructors call DestroyTexture(), so the cache must
// be cleared while the renderer is still alive for those to be honored.
for (auto it = color_cache_.begin(); it != color_cache_.end(); it++) {
if (!it->compiled_shader.isNull()) {
DestroyNativeShader(it->compiled_shader);
}
}
color_cache_.clear();
}
if (!interlace_texture_.isNull()) {
DestroyNativeShader(interlace_texture_);
@@ -150,6 +158,11 @@ void Renderer::Destroy()
}
texture_cache_.clear();
destroyed_ = true;
if (lifetime_) {
lifetime_->alive = false;
}
DestroyInternal();
}
+1 -1
View File
@@ -26,7 +26,7 @@ namespace olive
void RenderJobTracker::insert(const TimeRange &range, JobTime job_time)
{
// First remove any ranges with this (code copied
// First remove any ranges that overlap this one (code copied from TimeRangeList::remove)
TimeRangeList::util_remove(&jobs_, range);
// Now append the job
+21 -3
View File
@@ -220,7 +220,12 @@ RenderTicketPtr RenderManager::RenderFrame(const RenderVideoParams &params)
}
if (worker_params.return_type == ReturnType::kNull) {
dry_run_thread_->AddTicket(ticket);
if (dry_run_thread_) {
dry_run_thread_->AddTicket(ticket);
} else {
// No render threads (e.g. dummy backend), finish without a result
ticket->Finish();
}
} else if (worker_pool_ &&
worker_pool_->SubmitFrame(ticket, worker_params)) {
return ticket;
@@ -247,13 +252,16 @@ RenderTicketPtr RenderManager::RenderAudio(const RenderAudioParams &params)
ticket->setProperty("aparam", QVariant::fromValue(params.audio_params));
ticket->setProperty("mode", params.mode);
if (params.generate_waveforms) {
if (params.generate_waveforms && !waveform_threads_.empty()) {
size_t thread_index = last_waveform_thread_ % waveform_threads_.size();
RenderThread *thread = waveform_threads_[thread_index];
thread->AddTicket(ticket);
last_waveform_thread_++;
} else {
} else if (audio_thread_) {
audio_thread_->AddTicket(ticket);
} else {
// No render threads (e.g. dummy backend), finish without a result
ticket->Finish();
}
return ticket;
@@ -278,6 +286,11 @@ void RenderManager::SetAggressiveGarbageCollection(bool enabled)
{
aggressive_gc_ += enabled ? 1 : -1;
// Clamp at zero so unbalanced disable calls can't drive the counter negative
if (aggressive_gc_ < 0) {
aggressive_gc_ = 0;
}
if (aggressive_gc_ > 0) {
decoder_clear_timer_->setInterval(kDecoderMaximumInactivityAggressive);
} else {
@@ -287,6 +300,11 @@ void RenderManager::SetAggressiveGarbageCollection(bool enabled)
void RenderManager::ClearOldDecoders()
{
if (!decoder_cache_) {
// No decoder cache exists on backends without a renderer (e.g. dummy)
return;
}
QMutexLocker locker(decoder_cache_->mutex());
qint64 min_age =
+3 -3
View File
@@ -255,11 +255,11 @@ private:
QTimer *decoder_clear_timer_;
RenderThread *dry_run_thread_;
RenderThread *audio_thread_;
RenderThread *dry_run_thread_ = nullptr;
RenderThread *audio_thread_ = nullptr;
std::vector<RenderThread *> waveform_threads_;
size_t last_waveform_thread_;
size_t last_waveform_thread_ = 0;
std::list<RenderThread *> render_threads_;