Commit graph

1542 commits

Author SHA1 Message Date
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
20149c7293 threadshare: Rename udpsrc_benchmark.rs to benchmark.rs. 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
23b25b210b threadshare: Update to rand 0.5 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
8f9a42f486 threadshare: Switch back to main tokio now that the CurrentThread PR is merged 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
b56e1a9873 threadshare: Update udpsrc benchmark a bit 2018-11-05 13:36:47 +02:00
Sebastian Dröge
7939f95861 threadshare: Add very simple udpsrc/tonesrc benchmark application 2018-11-05 13:36:47 +02:00
Sebastian Dröge
eab6537094 threadshare: Add test for queue 2018-11-05 13:36:20 +02:00
Sebastian Dröge
3e82b5a14e threadshare: Add test for udpsrc 2018-11-05 13:36:20 +02:00
Sebastian Dröge
34acbcc6a1 threadshare: Add simple test for proxysrc/sink 2018-11-05 13:36:20 +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
28100d3a63 threadshare: Add test for single and multi-threaded appsrc 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