Skip to content

Fixes - #66

Merged
darbyjohnston merged 18 commits into
OpenTimelineIO:mainfrom
darbyjohnston:fixes
Sep 8, 2026
Merged

darbyjohnston merged 18 commits into
OpenTimelineIO:mainfrom
darbyjohnston:fixes

Conversation

@darbyjohnston

Copy link
Copy Markdown
Collaborator

Various fixes:

  • Effects render safely from two threads. The property-set scratch buffer is gone, contexts are read once at load, host lookups on shared maps are finds, and the plugins look parameters up when used instead of caching handles in plugin-global maps. That removed 18 create-instance overrides and about 280 lines.
  • Parameters are read by their declared type, so JSON integers reach double parameters as doubles and stored defaults reach plugins at all. Verified by rendering Draw.otio with the fill key removed: identical to the explicit fill.
  • SVG frames premultiplied once.
  • Time warps scale about the media start.
  • Playback follows the clock, not the tick rate. That one predates the feather-tk update.
  • Closing a file keeps the current and B files.
  • -raw rgb24 converts on channel count.
  • FFmpeg constructors free what they made before a failure, and the AVIO buffer leak with its old \bug note is closed.
  • Media that fails to open is opened and logged once, not per frame.
  • OTIOZ offsets come from the local header. I built zip64 fixtures with Python's zipfile, which puts a 20-byte extra field in the local header only. Main renders the JPEG one wrong and crashes on the sequence one. The branch renders both identically to the plain timelines.
  • Failed image reads give an empty frame; failed writes are reported, so an unwritable output directory is an error instead of a clean exit.
  • Memory map error paths close what they opened, including the Windows view check that tested the wrong member.
  • Thumbnail cancellation answers aspect requests, so no widget future is left with a broken promise.
  • A missing numbered file is an error, not a dereference of an empty vector.

Assisted-by: Claude:claude-fable-5-1 [patch] [debugging]

The viewer renders on the UI thread and each timeline's thumbnails on a
thread of their own, through the same host and the same plugins, and
two things they shared were written on every render.

PropertySet::getString() copied the value into a scratch buffer on the
property set and handed back a pointer into it; on the plugin's own set,
shared by every instance, two renders resized the same buffer under each
other. The stored string is handed out directly now: it stays put until
the property is set again, which for a plugin's set is describe time.
The supported context is read once at load rather than on every exec,
and the host's lookups on the shared plugin maps are finds, so a name
that is not there is an error rather than an insertion.

The plugins kept their parameter handles in plugin-global maps keyed by
instance, filled at create-instance time from both threads and never
emptied. The base class looks a parameter up when it is used instead,
and the eighteen create-instance overrides that only filled the maps go.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
A parameter's value reaches the plugin through paramGetValue, which
wrote whatever type the value happened to be held as: a JSON integer
was written as int64 through the double pointer a Double parameter
passes, and a default stored as int was not written at all, because
that branch did not exist. The draw plugin's box was never filled by
default for that reason.

The instance keeps each parameter with its declared OpenFX type, and the
host converts to that: doubles for the Double, RGB and RGBA families,
ints for Integer, Boolean and Choice, a string for String, with
components past what the value has written as zero. Defaults are read
in full rather than their first component, and stored the way OTIO
metadata arrives, so both take the same path. A null handle is an
error rather than a dereference.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
lunasvg renders premultiplied and the comp premultiplies again, so every
antialiased edge of an SVG clip came out darker than drawn. The bitmap
is converted to plain RGBA before it is handed on, which also does the
channel swap the loop was doing by hand.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
The warp subtracted the range start, scaled, and never added the start
back, so a warped sequence that starts at frame 1001 asked for frames
near zero, which do not exist.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
The playback timer was started with a timeout of 1000 over the frame
rate in a call that takes microseconds, so it fired on every tick and
the frame advanced at whatever rate the application ticks. Each tick
now asks how many whole frames have elapsed since the last one it
advanced and moves by that, carrying the remainder, so the rate is the
timeline's and tick latency does not accumulate.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
Closing a file before the current one left the current index alone, so
the file after the current one became current. The index, and the B
index, move down with the files.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
The raw output converted only when the data type differed, and the
readers always produce four channels, so -raw rgb24 wrote RGBA pixels
under an RGB label. The y4m path already checked the channel count.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
The members are raw FFmpeg handles, and a constructor that throws runs
no destructor, so an open that failed part way leaked what came before
it: an opened format context when the stream info was not found, both
codec contexts and the open file when the header could not be written.
The freeing moves into one function the destructor and the constructor's
catch both call.

The AVIO buffer for memory-backed reads was never freed either. It is
the caller's to free, and libavformat may have replaced it, so it is
the context's pointer that goes.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
A read node that could not be created was not cached, so a missing
movie was probed, and the error logged, on every frame of the render.
The failure is cached as a null node and logged once per reference.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
The data of an entry was found by adding the central directory's
filename and extra field sizes to the local header offset, and the
local header's extra field need not be the same size: Python's zipfile
writes a zip64 extra there and not in the central directory, which put
the pointer twenty bytes into the data. The local header is read for
its own sizes, and the two copies of the lookup become one.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
The result of read_image() was ignored, so a file that failed part way
through was composited from whatever the buffer held. An empty frame is
returned instead, which the comp treats as missing media.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
ImageBuf::write() returns false rather than throwing, and the result was
dropped, so an output directory that does not exist gave a clean exit
from toucan-render and a completed progress dialog from the export
tool. The error is thrown, which the callers already catch.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
A constructor that throws runs no destructor, so a file that could not
be mapped leaked its descriptor, or its handles on Windows, where the
view check also tested the wrong member and never failed. The advice
was given before the map was checked, and doubled up; it comes after.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
Only the thumbnail requests were drained, so an aspect request pending
when the generator went away left the widget's future with a broken
promise, which get() throws.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
getSequence() returns nothing when the directory is there and the file
is not, and the first element of nothing was then taken.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
The same shape as the video reader and writer: raw FFmpeg handles, a
constructor that throws, and no destructor to free what came before
the throw. The freeing moves into one function the destructor and the
constructor's catch both call, and the AVIO buffer goes with the
context.

The resampler is drained once the decoder is: when the rates differ it
holds a tail of its own, and that tail was replaced with silence.
Checked against ffmpeg's own resample of the same file at 44.1 kHz:
identical to the last sample.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
The crossfade gain was worked out once per frame and applied to every
sample in it, so a dissolve was a staircase with one step per frame.
The gain is a line from the frame's start to its end now. The audio
time warp keeps its range start, as the image graph's does, and media
that failed to open is cached as such rather than opened, and logged,
again on every frame.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
OpenFX passes Boolean and Integer parameter values as int, and the host
now writes them that way. The plugins were receiving them into bool and
int64_t variables, which the old host had matched by writing whatever
type the JSON held. Written as int, a bool got four bytes into one, and
on Windows that took the gradient generator's stack with it: the test
render hung at the first gradient frame.

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
@darbyjohnston
darbyjohnston merged commit 5537af4 into OpenTimelineIO:main Sep 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant