DescriptionWebmMuxer-MediaRecorderHandler: thread hopping and data ownership
This CL addresses the global thread model between
VideoTrackRecorder - MediaRecorderHandler - WebmMuxer.
The constraints: all of them are created on Main Renderer
thread, whereas VTR frames come via Renderer IO thread.
The final result goes to Blink on Main Renderer Thread.
VideoTrackRecorder (IO) sends frames to WebmMuxer,
that is destroyed on Main Render thread. This causes a
race between WebmMuxer dtor and (the last) frame in
flight. This race was found during integration tests.
To address this issue, this CL moves WebmMuxer
to Main render thread completely, and the frames coming
from VTR on IO thread are trampolined on
MediaRecorderHandler thanks to BindToCurrentLoop.
To clarify data ownership across all these thread hops,
the encoded/contained data is managed as a
scoped_ptr<std::string>. This is OK since that data is
not shared, but passed from stage to stage
(and StringPiece only works in a single thread
environment since the data is not copied but managed
as unowned pointer).
Unittests, docs and headers adapted.
BUG=262211
TESTS=All appropriate UTs passing and also the whole
shebang test in https://crrev.com/1354863002/
Committed: https://crrev.com/a46a0503424df3f5f14c9b6422cdf97a26b9d45b
Cr-Commit-Position: refs/heads/master@{#350234}
Patch Set 1 : #
Total comments: 1
Patch Set 2 : Fix data ownership before thread jump. ajose@ comment #
Total comments: 3
Patch Set 3 : miu@ proposal #
Total comments: 12
Patch Set 4 : miu@s comments #
Total comments: 2
Patch Set 5 : StringPiece passed by value #Messages
Total messages: 27 (12 generated)
|