-
|
I'm thinking of this in context of a video editor, where a user may want to play the same media file concurrently on separate tracks, sometimes time-offset a bit relative to each other. I'd imagine this would require multiple sinks at least (probably not prudent to run multiple iterators out of the same sink), but would it actually be wise to acquire multiple sinks from the same Track? If not, should I also use separate Sources/Inputs for each of these concurrently-playing tracks? I'd like to optimize for perf / memory / fetches, preferably without thwarting the Source's caching strategy. Thanks for any advice! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
You can and should share Inputs and InputTracks as much as possible. Sharing the Input means you'll share the underlying Source and its caching mechanism, meaning writes from different places will hit the same cache. Generally, for each input media file, it's best to just have one Input for it around to maximize caching and reuse. For reading, you can also share Sinks since they're not really stateful, they're more just namespaces for media data accessors. The only thing stateful are the things the sink returns, like the iterators. Those you should create one per usage, unless you wanna really optimize things and use the same decoder to drive multiple tracks - however, this only works if the timing is lined up. |
Beta Was this translation helpful? Give feedback.
You can and should share Inputs and InputTracks as much as possible. Sharing the Input means you'll share the underlying Source and its caching mechanism, meaning writes from different places will hit the same cache. Generally, for each input media file, it's best to just have one Input for it around to maximize caching and reuse.
For reading, you can also share Sinks since they're not really stateful, they're more just namespaces for media data accessors. The only thing stateful are the things the sink returns, like the iterators. Those you should create one per usage, unless you wanna really optimize things and use the same decoder to drive multiple tracks - however, this only works if …