[ANN] RTP / RTCP stack for Go

1,419 views
Skip to first unread message

Werner Dittmann

unread,
Dec 20, 2011, 9:33:35 AM12/20/11
to golan...@googlegroups.com
Dear all,

today I've checked-in a Go RTP / RTCP stack implementation. It is stored at GitHub:


Here a short :-) overview - more details in the real REDME at GitHub.

This Go package implements a RTP/RTCP stack for Go. The package is a
sub-package of the standard Go _net_ package and uses standard _net_ package
functions. 

## How to build

The `rtp` package directory contains a standard Makefile and also tests. 
On my system I currently use `6g version weekly.2011-12-1410879` where all tests PASS.

## How to use

This is a pure RTP / RTCP stack and it does not contain any media processing,
for example generating the payload for audio or video codecs.

The directory `src/cmd/rtpmain` contains an example Go program that performs a
RTP full duplex test on _localhost_ that shows how to setup a RTP session, an
output stream and how to send and receive RTP data and control events.

The software has a good beta status (IMHO) and should be ready to use for
smaller RTP applications. Standard point-to-point RTP applications should not
pose any problems.

RTCP reporting works without support from application. Just have a look
into the example program.

## The documentation

After you downloaded the code you may use standard _godoc_ to get a nice
formatted documentation. Just change into the `src` directory, run `godoc
-http=:6060 -path="."`, point your browser at _localhost:6060_, and select
`src` at the top of the page.

I've added some package global documentation and tried to document the
globally visible methods and functions.

Before you start hacking please have a look into the documentation first, in
particular the package documentation (doc.go).

Regards,
Werner

roger peppe

unread,
Dec 20, 2011, 10:11:27 AM12/20/11
to golan...@googlegroups.com
On 20 December 2011 14:33, Werner Dittmann <wern...@googlemail.com> wrote:
> Dear all,
>
> today I've checked-in a Go RTP / RTCP stack implementation. It is stored at
> GitHub:
>
> https://github.com/wernerd/GoRTP

it would be nice if it was possible to get this with:

goinstall github.com/wernerd/GoRTP/rtp

Message has been deleted

Werner Dittmann

unread,
Dec 20, 2011, 12:39:56 PM12/20/11
to golan...@googlegroups.com
Hmm - I never though of any direct installation from GitHub using goinstall. I need to read the goinstall manual :-) and then
try it.


Regards,
Werner

Werner Dittmann

unread,
Dec 20, 2011, 1:15:02 PM12/20/11
to golan...@googlegroups.com
gonistall doesn't work on my system (Linux, openSuse 12.1) . Checking the stuff shows:
- download was ok, sources in the download directory
- it seems that the command "gomake -f- install" does not work and install

When I perform the last two command manually:
- cd into the download source dir
- call "gomake install" (without -f- which causes gomake to hang) compiles and installs the package

What could be wrong here? I don't seen any hints in the goinstall doc except the statement. "Goinstall ignores Makefiles."
Thus I don't even understand the note shown above about the "TARG" in the Makefile.
So, what is goinstall doing? Are there any "Hello, world!" examples?

Thanks and regards,
Werner
Message has been deleted

Werner Dittmann

unread,
Dec 21, 2011, 3:12:33 AM12/21/11
to golan...@googlegroups.com
Thanks for the clarification. After some more checks I now have a better understanding how goinstall
works. The missing link was that goinstall also uses the full path when it installs the binaries. After I 
had that "Heureka!" moment the puzzle was complete :-) . And of course goinstall works on my system
as well.

Here's the TARG that I am referring to: 
https://github.com/wernerd/GoRTP/blob/master/src/pkg/net/rtp/Makefile#L3
 
The gomake application uses the TARG variable to specify the package import path.

The goinstall application uses the import path passed as a command line argument to specify both the location of the package source and the import path for the package.  The goinstall application ignores the Makefile.

Yes, I now can see why this makes sense - the Makefile  requires the same install path as used by goinstall. 
The problem I had: the documentation of goinstall is not very clear about that fact that goinstall does not use the standard
Go layout when it installs binaries. The documentation is quite clear where goinstall stores the sources - IMHO it would be
a good idea to add a short statement where goinstall installs the binaries and/or give a short example (currently this 
location can be determined if one looks at the import statements, but this may by easily overlooked ;-) ).

To minimize confusion, TARG should match the goinstall path.  More specifically, use "TARG=github.com/wernerd/GoRTP/src/pkg/net/rtp".

I like Rog's suggestion of shortening the path to "github.com/wernerd/GoRTP/rtp". 

True - would make life easier.  
However, this would break my Goclipse development environment (Go plugin for Eclipse) which requires 
this "src/pkg/..." layout. AFAIK the Goclipse developer followed the Go directory layout rules how to structure
sources and binaries and implmented compile/link and other useful features based on that structure.

Thus, for the time being, I will stay with this structure :-) .

Are there any "Hello, world!" examples?

Here's a simple example: https://github.com/bradfitz/gomemcache

roger peppe

unread,
Dec 21, 2011, 9:13:11 AM12/21/11
to golan...@googlegroups.com

you could add a symbolic link rtp->src/pkg/net/rtp

Werner Dittmann

unread,
Dec 21, 2011, 12:33:50 PM12/21/11
to golan...@googlegroups.com
done - checked in - tested - works :-) 


Werner Dittmann

unread,
Dec 26, 2011, 8:53:35 AM12/26/11
to golan...@googlegroups.com
GoRTP - just an update:

GoRTP is now tagged as V1.0.0RC2 :-) . 

I've added some more features to RTCP handling,  error handling, etc. Please have a look at
the updated README at GitHub. 

As proposed I've also simplified installation using goinstall (see posts below). 
Compiled and tested with weekly-2011-12-22. Not yet tested with the new go command
but it may work, given the correct set-up.

Maxim Pimenov

unread,
Jan 13, 2012, 9:10:52 AM1/13/12
to wern...@googlemail.com, golang-nuts
Hello, Werner.

Please note that your current implementation suffers from data races. Your accesses to hash maps from different goroutines are not synchronized.
Here is an excerpt from the log obtained by running GoRTP/cmd/rtpmain/rtpmain.go under ThreadSanitizer [1]:

WARNING: Possible data race during read of size 1 at 0xf84004b4c0: {{{
   T13 (L{}):
    #0  net/rtp..NewDataPacket .../GoRTP/src/pkg/net/rtp/session.go:251
    #1  main.sendLocalToRemote .../GoRTP/src/cmd/rtpmain/rtpmain.go:56
    #2  runtime.goexit ~/go/src/pkg/runtime/proc.c:266
  Concurrent write(s) happened at (OR AFTER) these points:
   T8 (L{}):
    #0  net/rtp..WriteCtrl .../GoRTP/src/pkg/net/rtp/session.go:609
    #1  net/rtp..WriteCtrl .../GoRTP/src/pkg/net/rtp/session.go:609
    #2  net/rtp..rtcpService .../GoRTP/src/pkg/net/rtp/session.go:627
    #3  runtime.goexit ~/go/src/pkg/runtime/proc.c:266
   Race verifier data: 0x44b393,0x44cd30
}}}


The full log is attached to this email. There may me several off-by-one errors
but I hope the stack traces are readable.



log.txt

Matt Kane's Brain

unread,
Jan 13, 2012, 2:42:42 PM1/13/12
to golan...@googlegroups.com
Totally writing an RTPMIDI forwarder.

--
matt kane's brain
http://hydrogenproject.com

Reply all
Reply to author
Forward
0 new messages