[pitivi] Temporary live playback restriction caps
@nekohayo
Submitted by Jeff Fortin Tam Link to original bug (#731373)
Description
In Pitivi, we encounter the usecase where we would need to downscale videos during live playback, so that they are only processed at the resolution of UI widget displaying the sink/previewer.
This approach has been demonstrated to significantly improve performance when applying effects on top of HD footage, with this proof of concept branch branch:
https://github.com/nekohayo/pitivi/commits/low-quality-preview
GES provides a set_restriction_caps method for tracks, allowing to set a width and height to clamp to. However, this API is insufficient because it was made to set permanent restriction caps (ex: rendering resolution scaling) and they get saved into the file format. Notwithstanding the fact that it interferes with the real rendering restriction caps, trying to manage this temporary stuff in Pitivi means piles upon piles of nasty hacks that conflict with each other.
-
Trying to work around the current API means tracking the state globally, setting restriction caps only in certain situations and then trying to surgically remove them right before rendering and right before any project file saving. This doesn't work.
-
Changes to restriction caps will make the pipeline go to pause. Since Pitivi autosaves a backup copy of the GES Project periodically, and GES serializes the restriction caps, Pitivi will uncontrollably stop playback whenever an automatic backup file save occurs.
Hence I have come to the conclusion that trying to work around this in Pitivi is impossible and that it is the responsibility of GES to provide a way to (un)set temporary/live/playback restriction caps globally. You need to be able to (un)inhibit those playback restriction caps (easily toggle them on/off) at any time, and since they're UI-dependent (they don't make sense outside of this context), they should never be saved into the project file.