Reland #2 [Media Recorder] Fix video freeze on short recording.
Reason for the revert was duplicate initialization that happened because a different fix for the initialization issue had already landed in the master branch. Original CL description: Fixes an issue where VideoTrackRecorder when used in combination with VEAEncoder and very short recording durations (just 1 frame) would occasionally hold on to video frames forever, causing frame buffers from the buffer pool to become permanently blocked, eventually leading to video capture freezing. The cause was a circular ownership that would happen if only 1 frame is recorded. This CL additionally fixes a crash that could happen on initialization of VEAEncoder. This issue was revealed during testing of the above fix. Since it is not 100% if this crash was masked by the other issue, and would only start occurring with the above fix, I am making a fix for that part of this CL as well. The cause for the crash issue was that class VEAEncoder, which uses RefCountedThreadSafe<>, would post an asynchronous task from its constructor. If this task would finish executing before the newly constructed instance was assigned to a scoped_refptr<> by however called the constructor, the instance would destroy itself, because of the AddRef() and subsequent Release() done by the posting and running of the asynchronous task. The fix for this is to use a new method Initialize() instead of posting a task from the constructor. TBR=emircan@chromium.org Bug: 859610 Change-Id: I77d6865be574bf86afca7d0908ce2339f6ecd91e Reviewed-on: https://chromium-review.googlesource.com/1173408Reviewed-by:Emircan Uysaler <emircan@chromium.org> Reviewed-by:
Christian Fremerey <chfremer@chromium.org> Commit-Queue: Christian Fremerey <chfremer@chromium.org> Cr-Commit-Position: refs/heads/master@{#582753}
Showing
Please register or sign in to comment