After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 746462 - rtpsession/rtpjitterbuffer: Use a thread pool to share all the timeout threads between elements
rtpsession/rtpjitterbuffer: Use a thread pool to share all the timeout thread...
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
unspecified
Other All
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-19 14:52 UTC by Sebastian Dröge (slomo)
Modified: 2018-05-04 09:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rtpsession: Use a thread pool to share all the RTCP sending threads between elements (13.18 KB, patch)
2015-03-19 14:52 UTC, Sebastian Dröge (slomo)
none Details | Review
rtpjitterbuffer: Use a thread pool to share all timeout threads between elements (15.35 KB, patch)
2015-03-19 16:49 UTC, Sebastian Dröge (slomo)
none Details | Review
rtpsession: Use a thread pool to share all the RTCP sending threads between elements (14.16 KB, patch)
2015-03-19 17:51 UTC, Sebastian Dröge (slomo)
none Details | Review
rtpjitterbuffer: Use a thread pool to share all timeout threads between elements (19.31 KB, patch)
2015-03-19 17:51 UTC, Sebastian Dröge (slomo)
none Details | Review
rtpsession: Use a thread pool to share all the RTCP sending threads between elements (15.57 KB, patch)
2015-05-20 07:59 UTC, Sebastian Dröge (slomo)
none Details | Review
rtpjitterbuffer: Use a thread pool to share all timeout threads between elements (19.34 KB, patch)
2015-05-20 08:00 UTC, Sebastian Dröge (slomo)
none Details | Review
rtpjitterbuffer: Use a thread pool to share all timeout threads between elements (24.04 KB, patch)
2015-05-20 10:12 UTC, Sebastian Dröge (slomo)
none Details | Review

Description Sebastian Dröge (slomo) 2015-03-19 14:52:10 UTC
See patch. This allows us to keep the number of threads much lower if there
are multiple RTP sessions (or other users of GThreadPool).
Comment 1 Sebastian Dröge (slomo) 2015-03-19 14:52:14 UTC
Created attachment 299830 [details] [review]
rtpsession: Use a thread pool to share all the RTCP sending threads between elements

Usually the RTCP sending thread is idle, and during that times could easily be
used by other rtpsessions for sending or even other users of non-exclusive GThreadPools.

This allows us to keep the number of threads in scenarios with many
rtpsessions much lower, while still making it possible to have up to 1 thread
per session if really needed.
Comment 2 Sebastian Dröge (slomo) 2015-03-19 15:58:55 UTC
I'm doing the same with jitterbuffer currently btw, will attach that patch here too.
Comment 3 Sebastian Dröge (slomo) 2015-03-19 16:49:06 UTC
Created attachment 299852 [details] [review]
rtpjitterbuffer: Use a thread pool to share all timeout threads between elements

Unless there's packet loss or other events that need our attention, the
timeout thread is usually idle and could be used by other rtpjitterbuffers or
any other users of non-exclusive GThreadPools.

This allows us to keep the number of threads in scenarios with many
rtpjitterbuffers much lower, while still making it possible to have up
to 1 thread per jitterbuffer if really needed.
Comment 4 Sebastian Dröge (slomo) 2015-03-19 16:53:18 UTC
The patches are breaking the unit tests, but otherwise seem to mostly work. Will investigate.
Comment 5 Olivier Crête 2015-03-19 17:27:31 UTC
Can you also check with the Farstream unit tests (just do "make check"), they exercise the rtp stuff quite a bit.
Comment 6 Sebastian Dröge (slomo) 2015-03-19 17:51:50 UTC
Created attachment 299858 [details] [review]
rtpsession: Use a thread pool to share all the RTCP sending threads between elements

Usually the RTCP sending thread is idle, and during that times could easily be
used by other rtpsessions for sending or even other users of non-exclusive GThreadPools.

This allows us to keep the number of threads in scenarios with many
rtpsessions much lower, while still making it possible to have up to 1 thread
per session if really needed.
Comment 7 Sebastian Dröge (slomo) 2015-03-19 17:51:56 UTC
Created attachment 299859 [details] [review]
rtpjitterbuffer: Use a thread pool to share all timeout threads between elements

Unless there's packet loss or other events that need our attention, the
timeout thread is usually idle and could be used by other rtpjitterbuffers or
any other users of non-exclusive GThreadPools.

This allows us to keep the number of threads in scenarios with many
rtpjitterbuffers much lower, while still making it possible to have up
to 1 thread per jitterbuffer if really needed.
Comment 8 Sebastian Dröge (slomo) 2015-04-13 06:59:59 UTC
(In reply to Olivier Crête from comment #5)
> Can you also check with the Farstream unit tests (just do "make check"),
> they exercise the rtp stuff quite a bit.

The farstream testsuite did not pass all for me, independent of my patches :)


The remaining changes needed for my patches for now are to make the unit tests a bit less dependent on the internal behaviour of the elements. The unit test assumes that the element is requesting clock ids in a specific way
Comment 9 Sebastian Dröge (slomo) 2015-05-20 07:59:59 UTC
Created attachment 303641 [details] [review]
rtpsession: Use a thread pool to share all the RTCP sending threads between elements

Usually the RTCP sending thread is idle, and during that times could easily be
used by other rtpsessions for sending or even other users of non-exclusive GThreadPools.

This allows us to keep the number of threads in scenarios with many
rtpsessions much lower, while still making it possible to have up to 1 thread
per session if really needed.
Comment 10 Sebastian Dröge (slomo) 2015-05-20 08:00:19 UTC
Created attachment 303642 [details] [review]
rtpjitterbuffer: Use a thread pool to share all timeout threads between elements

Unless there's packet loss or other events that need our attention, the
timeout thread is usually idle and could be used by other rtpjitterbuffers or
any other users of non-exclusive GThreadPools.

This allows us to keep the number of threads in scenarios with many
rtpjitterbuffers much lower, while still making it possible to have up
to 1 thread per jitterbuffer if really needed.
Comment 11 Sebastian Dröge (slomo) 2015-05-20 10:12:41 UTC
Created attachment 303650 [details] [review]
rtpjitterbuffer: Use a thread pool to share all timeout threads between elements

Unless there's packet loss or other events that need our attention, the
timeout thread is usually idle and could be used by other rtpjitterbuffers or
any other users of non-exclusive GThreadPools.

This allows us to keep the number of threads in scenarios with many
rtpjitterbuffers much lower, while still making it possible to have up
to 1 thread per jitterbuffer if really needed.

Also fix the unit test. We now directly handle timeouts that are too late
anyway instead of doing a roundtrip via the clock, so the test can't see
any related clock ids anymore.
Comment 12 Sebastian Dröge (slomo) 2015-05-25 15:51:20 UTC
This all does not seem very useful with latest GLib anymore. Threads are only migrated from a thread pool to the global one after they were idle for >=15 seconds. So no real sharing happens here unless there is nothing to do here for >=15 seconds, which is rather unlikely.

I think this was different some GLib versions ago, where threads immediately went back to the global thread pool and thus could be shared.


What we could do here instead now would be to have one thread pool for all instances, but there we could easily cause too many threads (> number of instances) to be started.
Comment 13 Sebastian Dröge (slomo) 2018-05-04 09:39:16 UTC
This approach has proven to be useless, but Mathieu will provide a new approach for both in the next days :)