[cast] Handle frame size changes directly in the VideoToolbox encoder.
To implement various kinds of re-initialization conditions more easily,
this CL subsumes responsibility for handling frame size changes directly
in the VideoToolbox encoder.
The design is very similar to the previous one with a proxy encoder.
Instead of proxying the entire encoder, only the video frame factory is
proxied. Both the encoder and the proxy own a ref-counted reference to
the factory, which in turn owns a weak back-reference to the encoder and
a ref-counted reference to the current pixel buffer pool.
When a frame size change is detected either by the encoder or by the
video frame factory, the internal compression session is reset. This is
done synchronously when executing on the Cast main thread, and by
posting a task to the cast main thread when not.
The code to re-initialize the compression session will be re-used in
upcoming work where additional conditions, such as backgrounding, need
to be monitored for session reinitialization.
This new CL fixes the cast unit tests by modifying the tests to handle
encoders that do not have a frame delay when changing the video size.
R=dcaiafa@chromium.org, miu@chromium.org
BUG=477895
Review URL: https://codereview.chromium.org/
1100643002
Cr-Commit-Position: refs/heads/master@{#326907}