Fix deadlock in VideoSendStream tests, cause of flake on some bots.

Bug: webrtc:10861, webrtc:10880
Change-Id: Ic3ff9fab420e1fd634f58ef86d2f8890e23cfd03
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150220
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Yves Gerey <yvesg@google.com>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28969}
This commit is contained in:
Tommi
2019-08-27 11:34:20 +02:00
committed by Commit Bot
parent 0c141c591a
commit 31d1bcef23
5 changed files with 160 additions and 87 deletions

View File

@ -32,6 +32,7 @@ class SingleThreadedTaskQueueForTesting {
public:
using Task = std::function<void()>;
using TaskId = size_t;
constexpr static TaskId kInvalidTaskId = static_cast<TaskId>(-1);
explicit SingleThreadedTaskQueueForTesting(const char* name);
~SingleThreadedTaskQueueForTesting();
@ -59,6 +60,13 @@ class SingleThreadedTaskQueueForTesting {
// Returns true iff called on the thread associated with the task queue.
bool IsCurrent();
// Returns true iff the task queue is actively being serviced.
bool IsRunning();
bool HasPendingTasks() const;
void Stop();
private:
struct QueuedTask {
QueuedTask(TaskId task_id, int64_t earliest_execution_time, Task task);