Commit graph

168 commits

Author SHA1 Message Date
Sebastian Dröge
3ac1a6b288 Handle receiving in the beginning without clock gracefully
We'll only have a clock once the source element is actually in Playing.
2019-07-19 13:00:27 +03:00
Sebastian Dröge
bbdfae8cdd Compare IP addresses in lowercase
Only really relevant for IPv6.
2019-07-19 12:55:18 +03:00
Sebastian Dröge
98c290602c Improve error reporting/handling
And minor refactoring.
2019-07-19 12:51:06 +03:00
Sebastian Dröge
d352a0c20d Print all found sources in the debug log 2019-07-19 12:15:08 +03:00
Sebastian Dröge
5e5007091e Always return 1 frame of latency except for timecode mode
This allows for some slack when receiving, as up to 1 frame difference between
receive times can easily happen because of capturing alone.

And return 5 frames maximum latency as that is the size of our internal
queue.
2019-07-19 11:37:33 +03:00
Sebastian Dröge
fa9f788190 Improve type-safety a bit by making the Receiver generic over the stream type 2019-07-19 11:34:20 +03:00
Sebastian Dröge
33370e42ad Collect observations for the timestamp/receive time mappings and smoothen them
This allows keeping audio/video more in sync with how the sender was
sending it, while also handling network jitter and clock drift in a
reasonable way.
2019-07-19 10:52:47 +03:00
Sebastian Dröge
66d4fd1d90 Move connecting and capturing to separate threads
This ensures that we'll be able to capture every frame even if
downstream of the source is blocking for a moment, and also allows us to
make all operations cancellable.
2019-07-18 15:44:31 +03:00
Sebastian Dröge
19d25d20a7 Implement cancellation of connection attempts 2019-07-17 12:12:58 +03:00
Sebastian Dröge
f27c2507c5 Refactor huge create() functions into multiple smaller functions
And don't hold any mutexes when unnecessary, especially not while trying
to receive a frame.
2019-07-17 11:44:53 +03:00
Sebastian Dröge
cd0726b037 Make RecvInstance reference counted and allow lock-less capturing 2019-07-17 11:01:40 +03:00
Sebastian Dröge
34858762f7 Consolidate element properties
stream-name is called ndi-name everywhere in the NDI SDK and documentation
ip is called ip-address everywhere

Rename loss-threshold to timeout and change it to be in milliseconds
instead of iterations.

Add connect-timeout for timeout during connection

Add bandwidth and receiver-ndi-name properties, and initialize the
latter with a reasonable default value.
2019-07-17 11:01:40 +03:00
Sebastian Dröge
8b00e80316 Add property for selecting between different timestamping modes 2019-07-17 11:01:40 +03:00
Sebastian Dröge
a4890d3295 Add timestamp/timecode into ReferenceTimestampMeta on every buffer 2019-07-16 16:03:15 +03:00
Sebastian Dröge
fabcc65460 Properly support interlaced video and signal it correctly in the caps and buffer flags 2019-07-16 13:07:50 +03:00
Sebastian Dröge
a500b5297b Simplify boolean expression 2019-07-16 12:49:31 +03:00
Sebastian Dröge
b91d23521f Remove unnecessary TODO comment 2019-07-16 12:49:31 +03:00
Sebastian Dröge
cd8bca11aa Run everything to rustfmt to give it a consistent indentation 2019-07-15 20:38:00 +03:00
Sebastian Dröge
4ebcd78acc Print frame timestamp/timecode in debug output 2019-07-15 20:38:00 +03:00
Sebastian Dröge
75eb959c80 Add support for all other video formats 2019-07-15 20:38:00 +03:00
Sebastian Dröge
5022ff412c Fix caps negotiation
We can't just fixate to any close to what we receive right now but only
support exactly the caps we receive. So check the format of each frame
and negotiate exactly those caps as needed when receiving frames.

Also re-negotiate if the caps are ever changing.
2019-07-15 20:13:12 +03:00
Sebastian Dröge
4443e03cd2 Remove wrong and unneeded latency query handling 2019-07-15 18:34:09 +03:00
Sebastian Dröge
2ad413773e Take the current running time as PTS for now and clean up timestamp/duration calculations
We might want to take the timestamp provided by the NDI SDK at a later
time but this needs to be done correctly.
2019-07-15 18:30:44 +03:00
Sebastian Dröge
32289047a5 Remove receiver/latency from Settings to State struct
And clean up usage of both.
2019-07-15 18:30:44 +03:00
Sebastian Dröge
9afe1d74b8 Set on_program to true by default in the Tally 2019-07-15 18:00:51 +03:00
Sebastian Dröge
25d7c9e74f Use glib::Type instead of element name or factory name for deciding between audio/video 2019-07-15 17:56:29 +03:00
Sebastian Dröge
71d8f7108c Remove unused FFI code 2019-07-11 23:37:35 +03:00
Sebastian Dröge
861d216eed Port audio/video source to the safe NDI SDK wrappers
This also fixes various memory unsafety issues.

And add lots of FIXME comments for code that is currently wrong.
2019-07-11 23:37:35 +03:00
Sebastian Dröge
48f8c498fa Wrap unsafe NDI C API in safe wrappers 2019-07-11 23:25:30 +03:00
Sebastian Dröge
a0c918de71 Never send an empty buffer but simply retry
Sending an empty buffer will cause downstream to fail as it has the
wrong size.
2019-07-11 21:59:42 +03:00
Alfonso Rodríguez Pereira
13ce2da387
Merge pull request #27 from sdroege/plugin-version-helper
Use gst-plugin-version-helper crate to populate the plugin metadata
2019-07-11 11:09:36 +02:00
Alfonso Rodríguez Pereira
3742f8e776
Merge pull request #29 from sdroege/ndi-windows-linking
Use correct library name for linking on Windows
2019-07-11 11:07:23 +02:00
Alfonso Rodríguez Pereira
cc63b187b9
Merge pull request #33 from sdroege/no-custom-error
Never return gst::FlowError::CustomError outside the element
2019-07-11 11:06:47 +02:00
Alfonso Rodríguez Pereira
a355220254
Merge pull request #31 from sdroege/no-vec-from-raw-parts
Use slice::from_raw_parts instead of Vec::from_raw_parts and always free video frames
2019-07-11 11:05:33 +02:00
Alfonso Rodríguez Pereira
33fbc1c508
Merge pull request #30 from sdroege/sleep
Use NDIlib_find_wait_for_sources() instead of thread::sleep()
2019-07-11 11:05:10 +02:00
Sebastian Dröge
c483270f27 Never return gst::FlowError::CustomError outside the element
It's for internal-usage and must be converted to a normal error at the
boundary to the base classes.
2019-07-09 19:29:45 +03:00
Sebastian Dröge
b41d5839d4 Always free video frames with NDIlib_recv_free_video_v2() after last use
And not potentially before or not at all.
2019-07-09 19:27:55 +03:00
Sebastian Dröge
7b8070c55d Use slice::from_raw_parts instead of Vec::from_raw_parts
The latter must only be called on memory that was allocated by Rust for
a Vec and will cause crashes depending on the platform otherwise.

Also it would free the memory as if a Vec was allocated, which would
free memory that we don't own to begin with.
2019-07-09 19:27:55 +03:00
Sebastian Dröge
bd1f8cb7d1 Use NDIlib_find_wait_for_sources() instead of thread::sleep() 2019-07-09 19:27:14 +03:00
Sebastian Dröge
38e39d181e Use correct library name for linking on Windows 2019-07-09 19:26:18 +03:00
Sebastian Dröge
3acd848b5f Use gst-plugin-version-helper crate to populate the plugin metadata 2019-07-09 18:35:47 +03:00
Alfonso Rodríguez Pereira
def42b5514
Merge pull request #26 from teltek/feature_gst_v0.14.0
Update to the new version of the GStreamer Rust bindings, 0.14.0
2019-06-27 13:10:10 +02:00
rubenrua
28265f1151 Update to the new version of the GStreamer Rust bindings, 0.14.0
https://gstreamer.freedesktop.org/news/#2019-06-24T20:00:00Z
2019-06-25 18:20:50 +02:00
Ruben Gonzalez
2802a6fc97
Merge pull request #25 from o-reo/freeze_dependencies
freeze dependencies
2019-05-16 16:04:14 +02:00
o-reo
81cde09641 compile: freeze gstreamer-rs dependencies 2019-05-16 15:08:10 +02:00
Ruben Gonzalez
6cc722af25
Merge pull request #24 from o-reo/fix_element_register
fix element register due to gstreamer rs update
2019-04-26 11:00:38 +02:00
o-reo
c1eecbc5c4 fix element register due to gstreamer rs update 2019-04-23 16:17:29 +02:00
rubenrua
6dc39b2dea Fix rust fmt 2019-03-26 17:41:28 +01:00
Ruben Gonzalez
fb56cdc87c
Merge pull request #21 from o-reo/master
FIX changed return for gstreamer functions, fixed NDI frames memory leaks
2019-03-26 17:37:51 +01:00
Ruben Gonzalez
2794366186
Update license (fix #22)
Use the same GStreamer license
2019-03-18 18:24:37 +01:00