Yves Gerey c33e4910c5 Prevent 'use after free' by waiting for all queued tasks to be processed.
Sometimes, a task bound to VideoSendStreamTest was called
after the underlying object had been destructed:
 1. |test| goes out of scope.
 2. There might still have been a task in fixture's queue,
    setup by OnSendRtp (capturing [this]) and invoked before
    the destruction of the fixture.

This CL uses the same workaround than BandwidthStatsTest:
block until all posted tasks are processed.

This fixes the following flaky tests:
 * VideoSendStreamTest.ChangingNetworkRoute
 * VideoSendStreamTest.RespectsMinTransmitBitrate*

Bug: webrtc:11156
Change-Id: I229c96d2abbbb60b43e9d9f62ad112507a21fe48
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/163984
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#30152}
2020-01-07 04:18:51 +00:00
..
2019-08-01 14:09:23 +00:00