Commit graph

138 commits

Author SHA1 Message Date
Sebastian Dröge
83cc8104a1 Fix or silence all remaining clippy warnings
Also ignore common errors we don't care about when running clippy and
make clippy errors fail the CI.
2019-09-07 10:42:07 +03:00
Mathieu Duponchelle
9d7e304fc6 threadshare: address clippy errors 2019-09-06 19:21:07 +02:00
Mathieu Duponchelle
202ff408e7 jitterbuffer: share context downstream
.. and execute pending futures after pushing buffers
2019-09-06 14:33:39 +00: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
Mathieu Duponchelle
b7e55836c1 WIP: thread-sharing jitterbuffer
Actual thread-sharing will follow!
2019-09-06 14:33:39 +00:00
François Laignel
0e11ac87d3 Update for new {Value, StructureRef}::get signature
See https://github.com/gtk-rs/glib/pull/513
and https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/merge_requests/310
2019-08-13 15:29:28 +02:00
Mathieu Duponchelle
da2332d814 ts-queue: Make PendingQueue a proper struct 2019-08-09 11:44:47 +00:00
Mathieu Duponchelle
892c812669 ts-queue: split up enqueue_item
This is far from a full refactoring, but it makes the current
implementation slightly easier to understand
2019-08-09 11:44:47 +00:00
Ray Tiley
ccd607707d threadsharing/udpsrc: Fix build on Windows 2019-08-08 10:32:19 -04:00
Sebastian Dröge
fbbd70950a Fix a few more clippy warnings 2019-07-11 11:20:39 +03:00
Sebastian Dröge
caeff6f968 threadshare/udpsrc: Use MaybeUninit instead of mem::zeroed() 2019-07-10 17:20:45 +03:00
Sebastian Dröge
b4efa42d8f Fix various clippy warnings 2019-07-04 18:56:33 +03: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
Guillaume Desmottes
53e530f7db port all plugins to new register API
Rank is now an enum rather than a u32
2019-06-04 14:35:10 +05:30
ahamedsajeer.15
dc45b7f8ac Add build.rs that provides a version number, release date and other details 2019-06-03 11:11:29 +00:00
Sebastian Dröge
2fc89ced15 Fix various compiler warnings 2019-05-28 04:43:54 +02:00
Sebastian Dröge
fbee00caab Update for gstreamer gst_plugin_define! API changes 2019-05-27 20:31:39 +00:00
Sebastian Dröge
9bccc50add Update for gstreamer-rs API changes 2019-05-24 13:09:32 +02:00
Sebastian Dröge
129f6a28b0 Update for gstreamer-rs/glib/etc API changes and add more explicit Some() 2019-04-16 10:10:16 +03: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
Abdul Rehman
2f3139dea2 ts-udpsrc: Add retrieve-sender-address property
Fixes #41
2019-03-13 21:07:53 +05:00
Sebastian Dröge
aa325ea98d Fix various clippy warnings 2019-02-21 20:12:09 +02:00
Sebastian Dröge
01911b0ca7 ts-udpsrc: Fix build on Windows 2019-02-07 10:31:47 +02:00
Sebastian Dröge
a2582afed3 ts-udpsrc: Fix build on Windows
By disabling socket sharing there. This is blocked by PRs to mio/tokio
currently.
2019-02-07 10:31:47 +02:00
Sebastian Dröge
6286e496ba Fix build with GLib and GTK changes 2019-02-07 09:54:03 +02:00
Sebastian Dröge
9db02cb55e Fixes for gstreamer-rs API changes
Creating pad templates can return None now.
2019-01-29 17:33:06 +02:00
Sebastian Dröge
873d177322 threadshare: Update for GLib API changes 2019-01-16 17:30:26 +02:00
François Laignel
e930133bdf Update for gstreamer-rs MR 200
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/merge_requests/200
2019-01-12 18:00:04 +01:00
Sebastian Dröge
f374d7fedf Remove unneeded ObjectSubclass::new() functions where not needed 2018-12-19 13:23:02 +02:00
Sebastian Dröge
fb741f26f3 Update for glib property API changes 2018-12-18 11:23:45 +02:00
Sebastian Dröge
0792fe4f1a ts-appsrc: Fix deadlock during shutdown
The IO Context has to be alive longer than the other parts
of the state. Otherwise a deadlock can happen between shutting down
the IO context (thread join while the state lock is held) and stuff
happening on the IO context (which might take the state lock).
2018-12-13 17:13:40 +02:00
Sebastian Dröge
e64a9b4a1a Port threadshare plugin to new subclassing API 2018-12-06 13:03:04 +02:00
Sebastian Dröge
4d87c11293 Run everything through latest rustfmt again 2018-12-04 19:01:40 +02:00
Sebastian Dröge
3026e56cfb ts-udpsrc: Creating a gio::Socket from a raw fd/socket is unsafe
So put it into an unsafe block.
2018-12-03 13:02:35 +02:00
Sebastian Dröge
9750195caa ts-udpsrc: Dup the socket so that both tokio and GIO can take ownership of it
Otherwise both would be closing the same socket, which a) breaks the
second user of the socket if any and b) could on the second close cause
a completely unrelated socket to be closed.

Windows part of the code is untested.
2018-11-30 19:39:39 +02: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
32265412f3 Change all links/mentions from gst-plugin-rs to gst-plugins-rs 2018-11-26 11:52:09 +01:00
Sebastian Dröge
ab08cbd412 ts-udpsrc: Implement socket and used-socket properties like in udpsrc 2018-11-13 14:13:23 +02:00
Sebastian Dröge
73a7be5ef5 Run gst-plugin-threadshare through cargo fmt 2018-11-05 13:43:38 +02:00
Sebastian Dröge
6c32b702f0 Fix build with gst-plugin-rs API changes 2018-11-05 13:43:11 +02:00
Sebastian Dröge
132986cf71 threadshare: Fix deprecation warnings and move to released versions of tokio 2018-11-05 13:36:47 +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
LEE Dongjun
6827b9509e threadshare: Add TcpClient elements and unit test. 2018-11-05 13:36:47 +02:00
LEE Dongjun
df86b67117 threadshare: Rename udpsocket file to socket file 2018-11-05 13:36:47 +02:00
LEE Dongjun
1ac85c91e5 threadshare: Generalize UdpSocket to Socket. 2018-11-05 13:36:47 +02:00
Sebastian Dröge
ec3e0875a1 threadshare: Use downcast_ref() instead of downcast() 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
8cdb47e61e threadshare: Also set reuse address/port settings for non-multicast sockets
And share more code between unicast/multicast socket creation
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
c5d901609f threadshare: Try pushing pending items immediately if we did not schedule a future for it yet
It might not be necessary to first go through a future, we might
directly be able to push them now.
2018-11-05 13:36:47 +02:00
Sebastian Dröge
7ac9534322 threadshare: Don't drain the queue when trying to push pending items
Otherwise we'll have to collect all failed items and push them back.
Instead pop items one by one, and if one fails just push that single
item back to the front.

The previous code would've lost all items after the first one that
failed
2018-11-05 13:36:47 +02:00
Sebastian Dröge
51aa06d013 threadshare: Schedule the pending queue in queue/proxysink only on EOS or the first buffer/buffer list
We will get the custom sticky downstream event with the IO context only
after stream-start and others, so would potentially block the current
thread from another futures executor, which then panics. Instead let's
just queue up those events for the time being until a later time.
2018-11-05 13:36:47 +02:00
Sebastian Dröge
3a8ce35e60 threadshare: Revert "Push io-context sharing event before stream-start and anything else"
This reverts commit 083948e8ea1471f1d8a013a225200729cfcef2a9.

This has no effect because core is reordering events to have
stream-start and others always first.
2018-11-05 13:36:47 +02:00
Sebastian Dröge
135ec5ee7d threadshare: Push io-context sharing event before stream-start and anything else 2018-11-05 13:36:47 +02:00
Sebastian Dröge
0b54cdb8ea threadshare: Use default query handling
While this will still drop most queries, it at least implements some
sane default handling for CAPS/ACCEPT_CAPS queries.
2018-11-05 13:36:47 +02:00
Sebastian Dröge
be0403ce24 threadshare: Switch to gobject-subclass 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
30b2df753c threadshare: Set element flags correctly for sources and sinks
And let proxysink post EOS events
2018-11-05 13:36:20 +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
a9d979a988 threadshare: Use catch_panic_pad_function from gst-plugin crate 2018-11-05 13:36:20 +02:00
Sebastian Dröge
96bc778f72 threadshare: Add code for canceling pending futures 2018-11-05 13:36:20 +02:00
Sebastian Dröge
88933790e7 threadshare: Add FIXME comment for refactoring opportunities 2018-11-05 13:36:20 +02:00
Sebastian Dröge
82ab78fa3d threadshare: Minor appsrc refactoring 2018-11-05 13:36:20 +02:00
Sebastian Dröge
d52f1d49dd threadshare: Add a sample appsrc-like element plus test 2018-11-05 13:36:20 +02:00
Sebastian Dröge
f5b3e9481f threadshare: Run everything through rustfmt 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
13e706f678 threadshare: Fix queue time level calculation 2018-11-05 13:36:20 +02:00
Sebastian Dröge
6ebc8988b2 threadshare: Make sure to shutdown sockets/queues without any mutexes locked
And make sure that the IOContext stays alive until they are fully done.
2018-11-05 13:36:20 +02:00
Sebastian Dröge
b4d1145490 threadshare: Add initial implementation of a proxysrc/sink like element 2018-11-05 13:36:20 +02:00
Sebastian Dröge
c26299277e threadshare: Move DataQueue to its own module 2018-11-05 13:36:20 +02:00
Sebastian Dröge
811893ccf9 threadshare: Only take the current queue levels into account instead of the future ones
Otherwise we might never ever enqueue a single buffer if it is already
by itself going over the limits.
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
1e26ca6365 threadshare: Add a first version of a queue 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
7cd2945268 threadshare: Implement error handling for IO/data flow errors
Also create a proper stream id
2018-11-05 13:36:20 +02:00
Sebastian Dröge
212b00ef2f threadshare: Move buffer handling into a separate function 2018-11-05 13:36:20 +02:00
Sebastian Dröge
613706d446 threadshare: Implement propert event/query handling 2018-11-05 13:36:20 +02:00
Sebastian Dröge
e269e51524 threadshare: Refactor 2018-11-05 13:36:20 +02:00
Sebastian Dröge
f53efc6e6f threadshare: Implement throttling for the poll loop 2018-11-05 13:36:20 +02:00
Sebastian Dröge
6aa9f642ba threadshare: Allow running completely single-threaded 2018-11-05 13:36:20 +02:00
Sebastian Dröge
b939607693 threadshare: Stop using reactor::Background and implement it ourselves for now 2018-11-05 13:36:20 +02:00
Sebastian Dröge
299c69185e threadshare: WIP 2018-11-05 13:36:20 +02:00
Sebastian Dröge
0fe6fbc859 threadshare: Initial working version 2018-11-05 13:36:20 +02:00
Sebastian Dröge
1593c06595 threadshare: Initial commit 2018-11-05 13:36:20 +02:00