Closed Bug 1649058 Opened 1 month ago Closed 1 month ago

MediaEngineDefaultVideoSource() will deadlock if used


(Core :: WebRTC: Audio/Video, enhancement, P3)




Tracking Status
firefox80 --- fixed


(Reporter: jya, Assigned: achronop)





(1 file)

will deadlock if called.

This was introduced in bug 1518946.

media::Await blocks the current thread, while waiting for the promise to be resolved.
The promise can't be resolved on the thread we're waiting on; nor can we wait on the same thread.

This is clearly documented there:

Here Await is given the main thread for both the thread to resolve the promise and the thread to be waiting on.
So the code will block the mainthread and the promise to be resolved needs to dispatch a task to the main thread; which is blocked.

Flags: needinfo?(achronop)

This is true. However, it would be a problem if the method was called from the main thread. It is not and that's is why it has been implemented like that. I will add an assert to make sure that the method is not called from the main thread. Thank you for the report.

Severity: -- → S4
Flags: needinfo?(achronop)
Priority: -- → P3
Assignee: nobody → achronop

It would have been much more efficition to use SyncRunnable instead of MozPromise here which will unnecessarily dispatches at least 3 tasks (and creating the runnables)

Severity: S4 → N/A
Type: defect → enhancement
Pushed by
Replace MozPromise with SyncRunnable and assert not main thread. r=jya
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
You need to log in before you can comment on or make changes to this bug.