Skip to content

Instantly share code, notes, and snippets.

View ggarber's full-sized avatar

Gustavo Garcia ggarber

View GitHub Profile

The Subscriber has maxResolution and maxFrameRate properties:

  • maxResolution - Object containing a width and a height property. When set the Subscriber will try to use a resolution that falls within those values.
  • maxFrameRate - The maximum frame rate the Subscriber should use. This is an integer value.

These properties are used to limit the maximum quality of the stream for that specific subscriber and also to prioritize different subscribers in the same endpoint. In case the bandwidth available is not enough to send the video of all the subscribers at maximum quality they will be prioritized based on these properties (for example a subscriber with higher maxResolution/FrameRate will receive more bits when the available bandwidth is limited).

You can initialise these values by passing them to the session.subscribe method eg.

//Inside publisher
@Override
public void setInActive(Reason reason) {
super.setInActive(reason);
notifier.streamCreated(super.getSession(), super.getConnection(), this);
for (PublisherListener pl : this.getListeners()) {
pl.publisherDestroyed(this);
}
}
@ggarber
ggarber / cpython_json_cjson_pickle.py
Created June 7, 2012 08:22 — forked from juandebravo/cpython_json_cjson_pickle.py
cpython_json_cjson_ujson_pickle (encode+decode)
import time
import cPickle as pickle
import json
import cjson
import ujson
d = {
'foo': 'bar',
'food': 'barf',
'good': 'bars',
@ggarber
ggarber / main_re.py
Created February 8, 2012 14:28 — forked from rafeca/main_re.py
Cast CamelCase to "underscore_case"
import re
def _camel_to_underscore_case(name):
"""
>>> _camel_to_underscore_case('CamelCaseNames')
'camel_case_names'
"""
camel_boundry = '((?<=[a-z])[A-Z])'
return re.sub(camel_boundry, '_\\1', name).lower()
@ggarber
ggarber / main_re.py
Created February 8, 2012 09:23 — forked from juandebravo/main_re.py
Cast CamelCase to "underscore_case"
import re
def _camel_to_underscore_case(name):
"""
Translate 'CamelCaseNames' to 'camel_case_names'.
"""
camelcase_boundry = '((?<=[a-z])[A-Z])'
return re.sub(camelcase_boundry, '_\\1', name).lower()
def camel_to_underscore_case(obj, deep=True):