[Media Recorder] Fix video freeze on short recording. Fix tab crash on initialize.
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. Bug: 859610 Change-Id: I6645aebfaa7659ab0ced0a20fae57eedfb9d84ab Reviewed-on: https://chromium-review.googlesource.com/1145877 Commit-Queue: Christian Fremerey <chfremer@chromium.org> Reviewed-by:Emircan Uysaler <emircan@chromium.org> Cr-Commit-Position: refs/heads/master@{#577735}
Showing
Please register or sign in to comment