Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

36 use gstreamer webrtcbin instead of aiortc #40

Merged
merged 19 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
sudo apt install -y libgirepository1.0-dev
python -m pip install --upgrade pip
pip install .[dev]
- name: Lint with flake8
Expand All @@ -44,24 +45,8 @@ jobs:
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
sudo apt install -y libgirepository1.0-dev
python -m pip install --upgrade pip
pip install .[dev]
- name : Lint with mypy
run : mypy . -v

pytest:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Test with pytest
run: |
coverage run -m pytest
54 changes: 0 additions & 54 deletions .github/workflows/pytest.yml

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/git_hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ echo "-------> Flake8 passed!"
mypy .
echo "-------> Mypy passed!"

# Run pytest
coverage run -m pytest
8 changes: 5 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ include_package_data = True
package_dir=
=src
install_requires =
aiortc
numpy
pyee
websockets
pyee==11.0.1
websockets==11.0.3
PyGObject==3.42.2

[options.packages.find]
where=src
Expand All @@ -30,6 +30,7 @@ dev = black==23.3.0
pytest==7.3.1
coverage==7.2.5
mypy==1.0.0
pygobject-stubs==2.10.0

[options.entry_points]
console_scripts =
Expand All @@ -42,6 +43,7 @@ max-line-length = 128
extend-ignore = E203
max-complexity = 10


[coverage:run]
branch=True

Expand Down
29 changes: 0 additions & 29 deletions src/example/datachannel-cli/README.rst

This file was deleted.

123 changes: 0 additions & 123 deletions src/example/datachannel-cli/cli.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ This example shows how to use a single producer and multiple consumers.
* Starts the producer:

```bash
python producer.py
python producer.py [-vv]
```

* Starts any number of consumers:

```bash
python consumer.py
python consumer.py [-vv]
```
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
from aiortc import RTCDataChannel
import argparse
import asyncio
import logging
from gst_signalling import GstSession, GstSignallingConsumer
import os

from gi.repository import Gst

from gst_signalling import GstSignallingConsumer
from gst_signalling.gst_abstract_role import GstSession
from gst_signalling.utils import find_producer_peer_id_by_name


def on_data_channel_message(data_channel, data: str) -> None: # type: ignore[no-untyped-def]
logging.info(f"Message from DataChannel: {data}")
data_channel.send_string("pong")


def on_data_channel_callback(webrtc: Gst.Element, data_channel) -> None: # type: ignore[no-untyped-def]
data_channel.connect("on-message-string", on_data_channel_message)


def main(args: argparse.Namespace) -> None:
peer_id = find_producer_peer_id_by_name(
args.signaling_host, args.signaling_port, args.producer_name
Expand All @@ -22,12 +35,7 @@ def main(args: argparse.Namespace) -> None:
@consumer.on("new_session") # type: ignore[misc]
def on_new_session(session: GstSession) -> None:
pc = session.pc

@pc.on("datachannel") # type: ignore[misc]
def on_datachannel(channel: RTCDataChannel) -> None:
@channel.on("message") # type: ignore[misc]
def on_message(message: str) -> None:
print("received message:", message)
pc.connect("on-data-channel", on_data_channel_callback)

@consumer.on("close_session") # type: ignore[misc]
def on_close_session(session: GstSession) -> None:
Expand Down Expand Up @@ -65,5 +73,6 @@ async def run_consumer(consumer: GstSignallingConsumer) -> None:
logging.basicConfig(level=logging.INFO)
elif args.verbose > 1:
logging.basicConfig(level=logging.DEBUG)
os.environ["GST_DEBUG"] = "4"

main(args)
Loading
Loading