Commit graph

24 commits

Author SHA1 Message Date
François Laignel ff470e9799 ts: move iocontext.rs to runtime/executor.rs
Part of: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/merge_requests/170
2019-12-19 20:44:00 +01:00
François Laignel 8eec141517 threadsharing: migrate to async/await and tokio 0.2.0-alpha.6
See https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/merge_requests/164
2019-12-19 20:44:00 +01:00
Sebastian Dröge b84388b0f3 threadshare: Fix shutdown race condition
We might've already handled the shutdown unparking while doing the
previous turn(s), so we have to check the atomic bool afterwards again
and before waiting (potentially) forever.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/issues/75
2019-10-02 12:02:09 +03:00
Sebastian Dröge e7053bc046 threadshare: Don't keep timers locked while waiting for IO 2019-09-09 13:55:56 +03:00
Sebastian Dröge 5f9d649021 threadshare: Handle context-wait==0 by waiting on IO 2019-09-09 12:37:18 +03:00
Mathieu Duponchelle 9d7e304fc6 threadshare: address clippy errors 2019-09-06 19:21:07 +02:00
Mathieu Duponchelle 5496067925 jitterbuffer: initial thread sharing support 2019-09-06 14:33:39 +00:00
Sebastian Dröge 33cb599464 threadshare/iocontext: Add custom interval timer implementation
This knows about our throttled event loop and ensures that timers are
triggered at most 1 throttle time later instead of 2.
2019-09-06 14:33:39 +00:00
Sebastian Dröge 50037325ff Explicitly add dyn keyword to trait objects
Trait objects without are deprecated with the latest nightly and this
makes it more clear that we're doing dynamic dispatch anyway.
2019-06-06 09:26:02 +03:00
Sebastian Dröge 9bccc50add Update for gstreamer-rs API changes 2019-05-24 13:09:32 +02:00
Sebastian Dröge f5b88d37c5 threadshare: Don't drift slowly when throttling the main context
Instead of taking a new time every iteration, take it once in the
beginning and add our wait time on every iteration. This prevents
accumulating errors and slowly drifting.
2019-04-15 18:43:01 +03:00
Sebastian Dröge 40426a2cf6 Use new boxed type support from the GLib bindings 2018-11-29 21:01:02 +02:00
Sebastian Dröge fbc0a04cff threadshare: Run everything through rustfmt again 2018-11-05 13:36:47 +02:00
Sebastian Dröge 55f9b84008 threadshare: Drop support for multi-threaded runtime as it is consistently slower
And switch to the new built-in spawning support of CurrentThread
2018-11-05 13:36:47 +02:00
Sebastian Dröge 987f78de42 threadshare: Move to tokio_threadpool and tokio_current_thread crates 2018-11-05 13:36:47 +02:00
Sebastian Dröge 9adf663073 threadshare: Add property to udpsrc for allowing port/address reuse 2018-11-05 13:36:47 +02:00
Sebastian Dröge da8390ef7b threadshare: Update for tokio API changes 2018-11-05 13:36:47 +02:00
Sebastian Dröge 2dfca38977 threadshare: Turn the single-threaded executor until no futures are left to be run before waiting
Otherwise in e.g. a pipeline like
  ts-udpsrc ! ts-queue ! fakesink
the first turn would only get a packet and queue it up, then we would
wait due to throttling and only then we would forward the packet from
the queue (but not poll the socket again), wait again due to throttling
and only then poll and get the next packet.

See https://github.com/tokio-rs/tokio/issues/310
2018-11-05 13:36:47 +02:00
Sebastian Dröge 099093e9be threadshare: Refactor pending future draining to get rid of some duplicated code 2018-11-05 13:36:20 +02:00
Sebastian Dröge ab22d81f12 threadshare: Integrate new tokio-timer into the IOContext 2018-11-05 13:36:20 +02:00
Sebastian Dröge 82cc63551c threadshare: Don't set a fallback reactor
This should not be needed and fails if we have multiple contexts
2018-11-05 13:36:20 +02:00
Sebastian Dröge e03c27814b threadshare: Implement pending futures that could be scheduled downstream as result of a push
This is used by the queue to schedule putting data into the queue once
it has space again.

Also implement blocking-wait in the queue on the sinkpad if there is no
IOContext upstream and generally clean up various things.
2018-11-05 13:36:20 +02:00
Sebastian Dröge 21f905739f threadshare: Implement error handling 2018-11-05 13:36:20 +02:00
Sebastian Dröge e269e51524 threadshare: Refactor 2018-11-05 13:36:20 +02:00