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

Rewrite RTSP server #372

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

Conversation

jakub-kovac
Copy link

The previous implementation of the RTSP server was unclear and difficult to fix, resulting in the last supported version of Live555 being from 2015.
This patchset rewrites the implementation to allow the use of the current version of Live555.

The interface with Ultragrid has been changed to a C++ class, with each instance serving as its own server. This is a change from the previous implementation where the rtsp_server struct was passed among methods.

- so that code can be established upon existing example in Live555.
- Result will look simmilar to this, but will be rebuild as series of
logical steps
- that will be base of rtsp server
- file originaly located in Live555 library source code at
testProgs/testOnDemandRTSPServer.cpp
copyright notice was added from original
file BasicRTSPOnlyServer.cpp
these features are not used needed by UltraGrid
MPEG-4 video is not deleted because it can serve as example of handling
subsessions
- basic structure for UltragridRTSPServer class
- make copying not possible because server can't be copied
- add typedef reference to name used in previous implementation
move inicialization logic from main() to constructor of new class
- copied announceURL function from Live555 library at testProgs/announceURL.cpp
- copied becase is functional and searchable for future modifications
- function handles displaying url, that server listens on, to comandline
move announceURL function to class so funcitonality is more clear
they will serve as container for various media transmitted by UG
- add basic structure for UltragridRTSPSubsessionCommon class
- add typedef reference to name used in previous implementation
- add definitions for all needed functions
- ServerMediaSubsession is chosen because it is common ancestor in
Live555's subsessions
function redirectStream changes destination adress and port
in UG module sender
- starts stream by changing destination adress and port to the ones got in
function getStreamParameters
- deletes stream by changing destination address and port to localhost
- inherits from UltragridRTSPSubsessionCommon because implementation of
needed functions (by ServerMediaSubsession) is the same - exept for SDP
Lines which are added later
- Factory method (createNew) is used because Live555 library needs
pointer to structure and all subsessions in Live555 library are created
this way
- Tell UG what modules shoud be notified when changing direction of media
stream
- MODULE_CLASS_SENDER - controls video stream
- MODULE_CLASS_AUDIO - controls audio stream
- MODULE_CLASS_NONE - only used as stop (like \0 in string)
Generate description of provided media according to SDP protocol defined
in RFC 8866 with modifications for RTSP protocol defined in RFC 2326
- if user don't specify port number default 8554 will be used
- Live555 does not have mechanism to tell if port is already in use
so user must specify available port
in previous version of rtsp_utils.h file the struct was named
differently so all references have to be renamed
replace MPEG-4 example with new subsessions made for UG
- serverStopFlag if set to 0 server is running when set to 1 it stops
- serverRunner built so it can be launched from pthread_create
- destructor cleans memory
they will be used by UG to interface with rtsp server
- basic structure of ultragrid_rtsp class
- it provides control of rtsp server
- new thread is created for rtsp server because control flow needs to be
given to Live555
- server stops by setting server_stop_flag to 1 - char is used because it
is needed by Live555 library
- because rtsp server does not need to know about threads two 'runner'
functions are used to separate server and threads
new implementation is built on version 2023.11.30 of Live555
- OPUS does not support mono
- RFC 7587 specifies that in SDP number of channels must be 2
- in previous implementation parameter audio_bps was used in
initialization of rtsp server but was not used internally
- it is kept in the process of creating new implementaion
(git commits) for reference with previous implementaion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant