Improve the screen capture threading model
Categories
(Core :: WebRTC: Audio/Video, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox112 | --- | fixed |
People
(Reporter: pehrsons, Assigned: pehrsons)
References
(Blocks 1 open bug)
Details
Attachments
(5 files)
The ScreenCaptureThread is currently an old libwebrtc class. On Windows it is specialized (UI) subclass of this that we built on top of this old libwebrtc class.
Alternatives exist, for instance base::Thread
which is a chromium import that we use for ipc. I also think it would be easy enough to get the support we need (the ui thread on windows) out of nsThread.
Then we also use this thread differently on different platforms. On Windows we use a (platform) timer to drive the frame capturing. On Linux and Mac we run the capturing in a busy-loop, even though the thread has a task queue. This needed some special treatment to work.
I'm thinking once we have an nsSerialEventTarget (which base::Thread and nsThread both implement) we can run the capturing with an nsTimer instead. We'll have to try out a bit how it behaves under load on single-core machines, but I think it could be decent.
Assignee | ||
Comment 1•2 years ago
|
||
Assignee | ||
Comment 2•2 years ago
|
||
VideoCapture used to be a base::Thread called VideoCapture.
DesktopCapture used to be a rtc::PlatformThread/PlatformUIThread called ScreenCaptureThread.
Assignee | ||
Comment 3•2 years ago
|
||
Assignee | ||
Comment 4•2 years ago
|
||
Mozification: With this patch desktop capture runs on an nsThread, driven by an
nsTimer.
The logic for scheduling the timer is similar to the non-win32 cases prior to
this patch, but this patch also takes into account the wall-clock duration of
the frame capture. This should result in more accurate framerates when the
capture is fast enough (less than 50% of the wall-clock budget of the requested
framerate).
Updated•2 years ago
|
Assignee | ||
Comment 5•2 years ago
|
||
Updated•2 years ago
|
Comment 7•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/9bb34476446b
https://hg.mozilla.org/mozilla-central/rev/1aa7bb249577
https://hg.mozilla.org/mozilla-central/rev/49cab24f10f9
https://hg.mozilla.org/mozilla-central/rev/6ac26b111043
https://hg.mozilla.org/mozilla-central/rev/ec2dfdd59ba1
Description
•