Skip to content

Instantly share code, notes, and snippets.

Working from home

Paul Gregoire mondain

Working from home
View GitHub Profile
mondain / sdp-offer.txt
Created Nov 30, 2020
SDP Offer from a browser to Red5 Pro Server for a participant
View sdp-offer.txt
Changes here would be setting mid 1 through 3 to `recvonly` in addition to the new video entry as mid 5.
type: offer, sdp: v=0
o=- 8815930240178044352 2 IN IP4
t=0 0
a=group:BUNDLE 0 1 2 3 4 5 6
a=msid-semantic: WMS ifOcH0OobeWoMmedB3ooL1Aj1OqEqe08YJE3
m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4
mondain / sdp-answer.txt
Created Nov 30, 2020
SDP Answer back from Red5 Pro Server for a participant
View sdp-answer.txt
Note that mid=5 is the extra video which would be fed by the server, similar to mid=1..3 for audio
type: answer, sdp: v=0
o=red5pro_6f1838 5138461613339 3 IN IP4
t=0 0
a=msid-semantic: WMS *
a=group:BUNDLE 0 1 2 3 4 5 6
m=audio 9 UDP/TLS/RTP/SAVPF 111
mondain / R5P SRT
Last active Oct 27, 2020
Red5 Pro Server SRT parameters
View R5P SRT

Configuration Options

When one configures SRT end-points using the provision style submission, the following parameters are available:

    "guid": "live/stream1",
    "context": "live",
    "name": "stream1",
mondain /
Created Aug 8, 2020
Save a series of raw yuv420p files from a video source
ffmpeg -y -r 1 -i $1 -an -s 640x480 -pixel_format yuv420p -f image2 image-%3d.raw
mondain /
Last active Mar 20, 2020
Red5 configuration for higher HTTP/WS loads

The following modifications to the conf/jee-container.xml should provide a higher availability level than the default configuration set.

For http and ws connections:

<bean name="httpConnector" class="org.red5.server.tomcat.TomcatConnector">
    <property name="protocol" value="org.apache.coyote.http11.Http11Nio2Protocol" />
    <property name="address" value="${}:${http.port}" />
    <property name="redirectPort" value="${https.port}" />
    <property name="connectionProperties">
mondain / j2c_string.c
Created Jan 14, 2020
JNI example of a java string into a c string
View j2c_string.c
/* Java String to C String */
static int jstr_to_cstr(JNIEnv *env, jstring jstr, char *cstr) {
jsize jlen, clen;
clen = env->GetStringUTFLength(jstr);
jlen = env->GetStringLength(jstr);
env->GetStringUTFRegion(jstr, 0, jlen, cstr);
if (env->ExceptionCheck()) {
return -EIO;
mondain /
Created Aug 27, 2019
Java GC with Red5

I did some reading and it looks like this particular OOM message simply means to add more memory for the heap; it essentially means one is running too lean. CPU runs hot trying to clear the garbage.

OutOfMemoryError: GC overhead limit exceeded

Excessive GC Time and OutOfMemoryError
The parallel collector will throw an OutOfMemoryError if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown. This feature is designed to prevent applications from running for an extended period of time while making little or no progress because the heap is too small. If necessary, this feature can be disabled by adding the option -XX:-UseGCOverheadLimit to the command line.
View gist:b9963d20c77b12fd79f40f878ab27fcf

When we run our Java based server on Linux on certain bare-metal servers we're seeing what may be some sort of file handle leak. To give more detail to this question, what would cause additional handles to be consumed outside of file access and socket creation? To get a total count we use lsof -i -n -p JAVA_APP_PID | wc -l to see the entire listing, we use lsof -i -n -p JAVA_APP_PID. On the listing there are entries like these that we don't recognize:

java     30464 mondain    0u      CHR             136,18      0t0       21 /dev/pts/18
java     30464 mondain    1u      CHR             136,18      0t0       21 /dev/pts/18
java     30464 mondain    2u      CHR             136,18      0t0       21 /dev/pts/18
java     30464 mondain  196u     unix 0x0000000000000000      0t0  5488165 type=STREAM
java     30464 mondain  200r     FIFO               0,10      0t0  5491231 pipe

Keybase proof

I hereby claim:

  • I am mondain on github.
  • I am mondain ( on keybase.
  • I have a public key ASAiorfzeX4Knscdu0yapQ0IXSAoqN6FxhPXBQa-b1XaEgo

To claim this, I am signing this object:

mondain / ens.sol
Created Jan 16, 2018
ENS contract for deed info
View ens.sol
pragma solidity ^0.4.0;
Temporary Hash Registrar
This is a simplified version of a hash registrar. It is purporsefully limited:
names cannot be six letters or shorter, new auctions will stop after 4 years.
You can’t perform that action at this time.