-
Henrik Boström authored
The internal class owns AdapterRefs which have to be destructed on the main thread. As such, the last reference to the internal class had to be freed on the main thread. In flaky cases, when tasks were posted to the signaling thread, an operation performed and a task posted back to the main thread - the main thread would finish before the signaling thread task and the last reference to the internal class would be released on the signaling thread, causing DCHECK crashes at ~AdapterRef for being on the wrong thread. With destructor traits, if we are not already on the main thread we post to the main thread and delete RTCRtpSenderInternal there. The TearDown of RTCRtpSenderTest is updated to ensure that any pending tasks get a chance to execute, in case the signaling thread was not finished yet or else the destructor posted to the main thread does not get a chance to execute and the test would flakily leak. Before this CL: Flake's symptoms could be reproduced by adding a thread sleep at RTCRtpSenderInternal::GetStatsOnSignalingThread. After this CL: Unable to repro flake. The same applies for the other flaking tests based on replaceTrack(). Bug: 827450 Change-Id: Ib594a53042e441e591ccc2c87ae8012bcb4ec75e Reviewed-on: https://chromium-review.googlesource.com/1015002 Commit-Queue: Henrik Boström <hbos@chromium.org> Reviewed-by:
Wez <wez@chromium.org> Reviewed-by:
Guido Urdaneta <guidou@chromium.org> Cr-Commit-Position: refs/heads/master@{#553550}
a43fb027