Reland [Media Recorder] Fix video freeze on short recording. Fix tab crash on initialize.
Patch Set 1 is the original CL that got reverted. Patch Set 2 fixes the reason for the revert. Reason for the revert was a memory leak during a unit test. This was caused by a newly added DeleteSoon() causing the test to exist before all objects had been released. The fix is to add a ScopedTaskEnvironment::RunUntilIdle() at test teardown. 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: I120b60b4b5cdf7462e38a74b7c757af6b5e1a7d6 Reviewed-on: https://chromium-review.googlesource.com/1167742Reviewed-by:Christian Fremerey <chfremer@chromium.org> Commit-Queue: Christian Fremerey <chfremer@chromium.org> Cr-Commit-Position: refs/heads/master@{#581672}
Showing
Please register or sign in to comment