When wrapping an instance of VideoFrame in another VideoFrame
using the method VideoFrame::WrapVideoFrame() [1], the wrapper
does not automatically participate in (shared) ownership of the
wrapped instance. Instead, at all usage sites, ownership is
attached externally through "AddDestructionObserver()" and an
empty method is used in combination with Base::Bind to hold a
reference to the instance inside a Base::Closure. This solution
seems far from clean.
A clean solution would be to have VideoFrame be a pure interface
and then use the decorator pattern to provide different
implementations for "regular" instances that hold data and
"wrapping" (decorator) instances that mostly delegate to a wrapped
instance but allow for some modifications.
[1] https://cs.chromium.org/chromium/src/media/base/video_frame.cc?l=406&cl=GROK&gsn=WrapVideoFrame
Comment 1 by chfremer@chromium.org
, Jul 27 2016