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

Upgrade GStreamer to 1.0 #34

Merged
merged 26 commits into from
Aug 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
72b6fd2
factoring tx steps out into functions
jonty-comp May 22, 2018
c48e4c7
remove references to old gobject/gst
jonty-comp May 22, 2018
e3641ea
Added test audio source and removed Gst import in Node
jonty-comp May 22, 2018
2304585
Updated TX class to Gst 1.0
jonty-comp May 22, 2018
1fb6acd
Finish refactoring tx class to Gst 1.0
jonty-comp May 22, 2018
c306138
remove unnecessary imports from tx class
jonty-comp May 22, 2018
5ea54cd
remove superfluous bus connect
jonty-comp May 22, 2018
f49fc87
add test sink for rx side
jonty-comp May 22, 2018
6155a32
initial refactoring of RX class; doesn't work yet
jonty-comp May 22, 2018
bcaceb1
RX now runs correctly
jonty-comp May 22, 2018
234815e
not much point formatting decibels as integers
jonty-comp May 22, 2018
5483c59
name conflict with def loop and self.loop
jonty-comp May 22, 2018
6adb356
Fix PCM by moving the level element up to right after the audiosrc
jonty-comp May 22, 2018
561b2bd
disable debug dotfile generation
jonty-comp May 22, 2018
1543d36
disable debug dotfile generation
jonty-comp May 22, 2018
25d35e7
Merge branch 'gst1.0' of github.com:jonty-comp/openob into gst1.0
jonty-comp May 22, 2018
37cf685
python 3 compat - mostly redis byte decoding
jonty-comp May 22, 2018
5fed5b9
Add .travis.yml and update changelog
jonty-comp Jul 9, 2018
150c5b5
fix travis.yml for system packages in virtualenv
jonty-comp Jul 9, 2018
9c21d99
Gst1.0 no longer messes with argv apparently
jonty-comp Jul 10, 2018
f3aacc6
Update documentation for gstreamer1.0 packages
jonty-comp Jul 10, 2018
82674f0
I can never spell receiving...
jonty-comp Jul 10, 2018
ba112b4
apparently there is a bug in the trusty opus library re. mono encoding
jonty-comp Jul 10, 2018
67a7ff6
Xenial has python 3.5
jonty-comp Jul 10, 2018
5f03751
remove direct dependencies from setup.py
jonty-comp Jul 10, 2018
74dc68a
We don't need python-gobject after all, that is a deprecated package
jonty-comp Jul 10, 2018
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
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
sudo: required
dist: xenial

language: python

addons:
apt:
packages:
- gstreamer1.0-plugins-base
- gstreamer1.0-plugins-good
- gir1.2-gstreamer-1.0
- python-gst-1.0
- python3-gst-1.0
- python-redis
- python3-redis
- python-gobject
- python-gi

services:
- redis-server

python:
- 2.7
- 3.5

virtualenv:
system_site_packages: true # Required as Travis runs python in a virtualenv, thus denying access to system GLib

install:
- python setup.py install

script:
- (openob 127.0.0.1 -v travis_1 travis tx 127.0.0.1 -a test 2>&1 | tee tx_log) &
- (tail -f -n0 tx_log &) | grep -q "Started mono audio transmission"
- (openob 127.0.0.1 -v travis_2 travis rx -a test 2>&1 | tee rx_log) &
- (tail -f -n0 rx_log &) | grep -q "Receiving mono audio transmission"
- sleep 10
- pkill openob
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 4.0.0-dev

* Upgraded GStreamer libraries to ^1.0
* Added Python 3 compatability

## 3.1

* Improved command line interface (Jonty Sewell)
Expand Down
12 changes: 5 additions & 7 deletions bin/openob
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/usr/bin/python
#!/usr/bin/env python

import sys
import argparse
import logging
# Thanks gst for messing with argv
argv = sys.argv
sys.argv = []

from openob.logger import LoggerFactory
from openob.node import Node
from openob.link_config import LinkConfig
from openob.audio_interface import AudioInterface
sys.argv = argv

parser = argparse.ArgumentParser(prog='openob', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-v', '--verbose', action='store_const', help='Increase logging verbosity', const=logging.DEBUG, default=logging.INFO)
Expand All @@ -21,7 +19,7 @@ subparsers = parser.add_subparsers(help="The link mode to operate in on this end

parser_tx = subparsers.add_parser('tx', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser_tx.add_argument('receiver_host', type=str, help="The receiver for this transmitter. The machine at this address must be running an rx-mode Manager for this link name")
parser_tx.add_argument('-a', '--audio_input', type=str, choices=['auto', 'alsa', 'jack'], default='auto', help="The audio source type for this end of the link")
parser_tx.add_argument('-a', '--audio_input', type=str, choices=['auto', 'alsa', 'jack', 'test'], default='auto', help="The audio source type for this end of the link")
parser_tx_alsa = parser_tx.add_argument_group('alsa', 'Options when using ALSA source type')
parser_tx_alsa.add_argument('-d', '--alsa_device', type=str, default='hw:0', help="The ALSA device to connect to for input")
parser_tx_jack = parser_tx.add_argument_group('jack', 'Options when using JACK source type')
Expand All @@ -45,7 +43,7 @@ parser_tx_opus.add_argument('--framesize', type=int, default=20, help="Opus fram
parser_tx.set_defaults(mode='tx', fec=True, dtx=False, multicast=False)

parser_rx = subparsers.add_parser('rx', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser_rx.add_argument('-a', '--audio_output', type=str, choices=['auto', 'alsa', 'jack'], default='auto', help="The audio output type for this end of the link")
parser_rx.add_argument('-a', '--audio_output', type=str, choices=['auto', 'alsa', 'jack', 'test'], default='auto', help="The audio output type for this end of the link")
parser_rx_alsa = parser_rx.add_argument_group('alsa', 'Options when using ALSA output type')
parser_rx_alsa.add_argument('-d', '--alsa_device', type=str, default='hw:0', help="The ALSA device to connect to for input")
parser_rx_jack = parser_rx.add_argument_group('jack', 'Options when using JACK output type')
Expand Down
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
# built documents.
#
# The short X.Y version.
version = '3.0'
version = '4.0'
# The full version, including alpha/beta/rc tags.
release = '3.0 alpha2'
release = '4.0.0-dev'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 0 additions & 4 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ OpenOB can be used for:

It can be used on a variety of network connections (including over the internet and mobile links such as 3G), with operating bitrates as low as 16kbps in compressed mode, and support for fully lossless operation in linear PCM mode.

.. WARNING::
This is the documentation for the currently-unreleased/unstable OpenOB 3 refactoring. If you are using the 2.3 version from PyPi some documentation may be incorrect or misleading.


Documentation Index
===================

Expand Down
4 changes: 2 additions & 2 deletions doc/source/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Architecture

OpenOB is a peer to peer audio streaming system with a central configuration server.

The program itself is a set of Python classes wrapping the PyGST bindings for the GStreamer media framework, which itself performs the audio encoding/decoding and transmission.
The program itself is a set of Python classes wrapping the Python GObject bindings for the GStreamer media framework, which itself performs the audio encoding/decoding and transmission.

An OpenOB *link* is comprised of a receiver and transmitter pair.

Expand Down Expand Up @@ -51,7 +51,7 @@ The following is a recommended set of specifications that are known to run OpenO
- Dual-core Intel Atom, i3 or better @ 1.2GHz or better
- 512MB RAM (2GB if you want a desktop environment)
- 100Mbps NIC
- Debian Wheezy (7.0)
- Debian Jessie (8.0)

OpenOB has been known to run on systems with significantly lower specifications.

Expand Down
14 changes: 8 additions & 6 deletions doc/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,27 @@ OpenOB relies on the GStreamer media framework for the underlying audio transpor

Additionally, OpenOB needs some Python extensions, and on the configuration server, we must also install the Redis server used for configuration management.

On Debian you can install the prerequisites with the following command:
On Debian Stretch / Ubuntu Xenial you can install the prerequisites with the following command:

.. code-block:: bash

sudo apt-get install python-gst0.10 python-setuptools gstreamer0.10-plugins-base gstreamer0.10-plugins-bad gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-tools python-gobject python-gobject-2 gstreamer0.10-alsa python-argparse python-redis
sudo apt install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gir1.2-gstreamer-1.0 python-gst-1.0 python-redis python-gi python-setuptools

This should also work on Ubuntu. Your GStreamer implementation must be recent enough to support Opus; this is supported in Ubuntu 13.04 and Debian Wheezy or newer. In order to ensure compatibility, it is recommended that both ends of the link use the same version of GStreamer, which is most easily achieved by running the same operating system version on each end and installing the distribution's packages as detailed above.
If you wish to use Python 3, you must install `python3-redis`, `python3-gst-1.0` and `python3-setuptools` instead of the Python 2 equivalents.
The GStreamer Opus plugin has graduated from the 'bad' plugins repository to the 'base' repository as of 2015. Older distributions may require the `gstreamer1.0-plugins-bad` package installed.
In order to ensure compatibility, it is recommended that both ends of the link use the same version of GStreamer, which is most easily achieved by running the same operating system version on each end and installing the distribution's packages as detailed above.

On one machine, which for this tutorial we'll assume is also our receiver, we'll install Redis:

.. code-block:: bash

[user@rx-host] $ sudo apt-get install redis-server
[user@rx-host] $ sudo apt install redis-server

We also need to make sure Redis binds itself to be accessible to remote machines, not just localhost. You can edit ``/etc/redis/redis.conf`` yourself or run the following to instantly make this adjustment

.. code-block:: bash

[user@rx-host] $ sudo sed -i.bak ‘s/bind 127.*/bind 0.0.0.0/’ /etc/redis/redis.conf && sudo service redis restart
[user@rx-host] $ sudo sed -i.bak ‘s/bind 127.*/bind 0.0.0.0/’ /etc/redis/redis.conf && sudo service redis-server restart

Installing OpenOB
-----------------
Expand All @@ -44,7 +46,7 @@ Now we can install OpenOB itself. You can install from git for the bleeding edge

.. code-block:: bash

sudo easy_install OpenOB
sudo pip install OpenOB

Networking
----------
Expand Down
2 changes: 1 addition & 1 deletion openob/link_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, link_name, redis_host):
self.redis = None
while True:
try:
self.redis = redis.StrictRedis(self.redis_host)
self.redis = redis.StrictRedis(host=self.redis_host, charset="utf-8", decode_responses=True)
break
except Exception as e:
self.logger.error(
Expand Down
8 changes: 0 additions & 8 deletions openob/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from openob.rtp.tx import RTPTransmitter
from openob.rtp.rx import RTPReceiver
from openob.link_config import LinkConfig
from gst import ElementNotFoundError


class Node(object):

Expand Down Expand Up @@ -50,9 +48,6 @@ def run_link(self, link_config, audio_interface):
link_logger.debug("Got caps from transmitter, setting config")
link_config.set("caps", caps)
transmitter.loop()
except ElementNotFoundError as e:
link_logger.critical("GStreamer element missing: %s - will now exit" % e)
sys.exit(1)
except Exception as e:
link_logger.exception("Transmitter crashed for some reason! Restarting...")
time.sleep(0.5)
Expand All @@ -65,9 +60,6 @@ def run_link(self, link_config, audio_interface):
receiver = RTPReceiver(self.node_name, link_config, audio_interface)
receiver.run()
receiver.loop()
except ElementNotFoundError as e:
link_logger.critical("GStreamer element missing: %s - will now exit" % e)
sys.exit(1)
except Exception as e:
link_logger.exception("Receiver crashed for some reason! Restarting...")
time.sleep(0.1)
Expand Down
Loading