Commit graph

78 commits

Author SHA1 Message Date
Stéphane Cerveau a5cd1adc97 gst-examples: continue if webrtc deps are not satisfied
The WebRTC examples are disabled if one dependency is
not satisfied, especially libsoup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2261>
2022-05-14 09:49:33 +00:00
Sebastian Dröge d2ecce5862 webrtc: Update dependencies of the Rust examples
And also clean up code a bit while updating to new APIs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2016>
2022-03-24 12:05:29 +02:00
Nirbheek Chauhan 4ae903d383 webrtc_sendrecv.py: Link pads instead of elements
This was not a problem here because even if we end up accidentally
linking to the wrong pad, things will work out eventually as long as
one pad-added is emitted for each pad that is added.

But it will be a huge problem if someone copies this code and changes
something that requires different handling for different sorts of
pads. The resultant code will be racy. Let's not do this, it's a bad
example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2008>
2022-03-23 21:04:39 +00:00
Nirbheek Chauhan 0007fa38e0 webrtc-sendrecv: Fix create-answer caps negotiation
We need to parse the payload type map provided by the offer SDP and
set those values on the payloader, otherwise webrtcbin will create
a recvonly answer SDP and we won't send anything to the browser.

Fixed it for both C and Python sendrecv examples.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1864>
2022-03-18 08:16:46 +00:00
Nirbheek Chauhan 3c0d582b7c webrtc_sendrecv.py: Add picture-id-mode to rtpvp8pay
This doesn't just make TWCC stats perform better, it also fixes
stuttery video playback in Chrome.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1864>
2022-03-18 08:16:46 +00:00
Nirbheek Chauhan e0378f9913 webrtc_sendrecv.py: Print an error on unknown JSON message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1864>
2022-03-18 08:16:46 +00:00
Nirbheek Chauhan 90da0e1d1e webrtc_sendrecv.py: Add missing copyright headers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1864>
2022-03-18 08:16:46 +00:00
Nirbheek Chauhan 583408c312 webrtc_sendrecv.py: Implement all negotiation modes
Earlier, the example only supported one negotiation mode:
* Browser client is running, gstreamer starts a call and sends offer

Now these three modes are also supported:
* Browser client is running, gstreamer starts a call and sends an
  offer request
* gstreamer connects and waits for browser client to start a call and
  send an offer
* gstreamer connects and waits for browser client to start a call and
  send an offer request

The following features are still missing:
* Data channel support
* TWCC support + stats logging

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1864>
2022-03-18 08:16:46 +00:00
Nirbheek Chauhan 0b1438cc97 webrtc_sendrecv.py: Make it executable
Why wasn't it already. Tired of typing 'python webrtc_sendrecv.py'.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1864>
2022-03-18 08:16:45 +00:00
Nirbheek Chauhan 2294356d9b webrtc_sendrecv.py: Fix event loop usage for messages
Instead of creating a new loop, we should just be fetching the running
loop, then doing a blocking network call inside the callback, schedule
it on the event loop. This is what the C example does too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1864>
2022-03-18 08:16:45 +00:00
Nirbheek Chauhan ee4ca699a0 webrtc_sendrecv.py: Use default arg for server URL
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1864>
2022-03-18 08:16:45 +00:00
Nirbheek Chauhan 4de365b31c webrtc_sendrecv.py: Sync element props with C version
Also add indentation to make it easier to read

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1821>
2022-03-01 16:33:28 +00:00
Nirbheek Chauhan 5ca5a83e75 webrtc_sendrecv.py: Ensure that gst-python overrides are installed
Otherwise fetching of the offer will fail with a cryptic error:

```
Traceback (most recent call last):
  File "/../gstreamer/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py", line 56, in on_offer_created
    offer = reply['offer']
TypeError: 'Structure' object is not subscriptable
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1821>
2022-03-01 16:33:28 +00:00
Nirbheek Chauhan e9a02a7380 webrtc_sendrecv.py: Don't try to set state on a None pipe
```
ERROR peer '5762' not found
Traceback (most recent call last):
  File "/../gstreamer/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py", line 190, in <module>
    res = loop.run_until_complete(c.loop())
  File "/usr/lib64/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/../gstreamer/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py", line 155, in loop
    self.close_pipeline()
  File "/../gstreamer/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py", line 142, in close_pipeline
    self.pipe.set_state(Gst.State.NULL)
AttributeError: 'NoneType' object has no attribute 'set_state'
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1821>
2022-03-01 16:33:28 +00:00
Nirbheek Chauhan 78f8505b9a webrtc_sendrecv.py: Fix SSLError when connecting to websocket server
```
  File "/../gstreamer/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py", line 189, in <module>
    loop.run_until_complete(c.connect())
  File "/usr/lib64/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/../gstreamer/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py", line 40, in connect
    self.conn = await websockets.connect(self.server, ssl=sslctx)
  File "/home/nirbheek/.local/lib/python3.10/site-packages/websockets/legacy/client.py", line 650, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "/usr/lib64/python3.10/asyncio/tasks.py", line 445, in wait_for
    return fut.result()
  File "/home/nirbheek/.local/lib/python3.10/site-packages/websockets/legacy/client.py", line 654, in __await_impl__
    transport, protocol = await self._create_connection()
  File "/usr/lib64/python3.10/asyncio/base_events.py", line 1080, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/usr/lib64/python3.10/asyncio/base_events.py", line 1110, in _create_connection_transport
    await waiter
  File "/usr/lib64/python3.10/asyncio/sslproto.py", line 631, in _on_handshake_complete
    raise handshake_exc
  File "/usr/lib64/python3.10/asyncio/sslproto.py", line 676, in _process_write_backlog
    ssldata = self._sslpipe.do_handshake(
  File "/usr/lib64/python3.10/asyncio/sslproto.py", line 116, in do_handshake
    self._sslobj = self._context.wrap_bio(
  File "/usr/lib64/python3.10/ssl.py", line 526, in wrap_bio
    return self.sslobject_class._create(
  File "/usr/lib64/python3.10/ssl.py", line 865, in _create
    sslobj = context._wrap_bio(
ssl.SSLError: Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:801)
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1821>
2022-03-01 16:33:28 +00:00
Nirbheek Chauhan e453e43e5a webrtc_sendrecv.py: Fix deprecation warning with Python 3.10
asyncio.get_event_loop() will not implicitly create a new event loop
in a future version of Python, so we need to do that explicitly.

```
webrtc_sendrecv.py:188: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1821>
2022-03-01 16:33:28 +00:00
Nirbheek Chauhan 4c2fd7f104 webrtc_sendrecv.py: Fix styling errors
These are now enforced by the pre-commit python style hook.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1821>
2022-03-01 16:33:28 +00:00
Nirbheek Chauhan d6799b069a webrtc: Update Makefile for building webrtc-sendrecv
This now needs the RTP library.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1821>
2022-03-01 16:33:28 +00:00
Xavier Claessens 3d8372cc50 devenv: Add some missing GStreamer specific env variables
This should make "meson devenv" closer to what "gst-env.py" sets.

- GST_VALIDATE_SCENARIOS_PATH
- GST_VALIDATE_APPS_DIR
- GST_OMX_CONFIG_DIR
- GST_ENCODING_TARGET_PATH
- GST_PRESET_PATH
- GST_PLUGIN_SCANNER
- GST_PTP_HELPER
- _GI_OVERRIDES_PATH

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1768>
2022-02-25 20:35:26 +00:00
Matthew Waters 2f9ad38118 examples/docs: update android applications to the latest relevant sdk's and build tools
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1622>
2022-02-07 06:51:58 +00:00
Nirbheek Chauhan 1be6d6ccf5 meson: Add explicit check: kwarg to all run_command() calls
This is required since Meson 0.61.0, and causes a warning to be
emitted otherwise:

2c079d855e
https://github.com/mesonbuild/meson/issues/9300

This exposed a bunch of places where we had broken run_command()
calls, unnecessary run_command() calls, and places where check: true
should be used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1507>
2022-01-09 18:12:47 +05:30
Olivier Crête 27808444ea webrtc janus rust: Update extra dependencies
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1332>
2021-11-10 16:13:38 +00:00
Olivier Crête 5ab09323cd webrtc multiparty rust: Upgrade all other deps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1332>
2021-11-10 16:13:38 +00:00
Olivier Crête c592f75cdd webrtc sendrecv rust: Upgrade all other deps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1332>
2021-11-10 16:13:38 +00:00
Olivier Crête 26e8624c9b webrtc multiparty rust: Port to bindings 0.17 version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1332>
2021-11-10 16:13:38 +00:00
Olivier Crête 93032b2ecc webrtc sendrecv rust: Port to bindings 0.17 version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1332>
2021-11-10 16:13:38 +00:00
Tim-Philipp Müller 8dfab0b08c meson: update for meson.build_root() and .build_source() deprecation
-> use meson.project_build_root() or .global_build_root() instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1183>
2021-10-20 11:20:44 +00:00
Thibault Saunier 41ed155bdf Move files from gst-examples into the "subprojects/gst-examples/" subdir 2021-09-24 16:15:58 -03:00