repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Red5/red5-server-common | src/main/java/org/red5/server/stream/consumer/SlicedFileConsumer.java | SlicedFileConsumer.doWrites | public final void doWrites() {
QueuedMediaData[] slice = null;
writeLock.lock();
try {
slice = queue.toArray(new QueuedMediaData[0]);
if (queue.removeAll(Arrays.asList(slice))) {
log.debug("Queued writes transfered, count: {}", slice.length);
... | java | public final void doWrites() {
QueuedMediaData[] slice = null;
writeLock.lock();
try {
slice = queue.toArray(new QueuedMediaData[0]);
if (queue.removeAll(Arrays.asList(slice))) {
log.debug("Queued writes transfered, count: {}", slice.length);
... | [
"public",
"final",
"void",
"doWrites",
"(",
")",
"{",
"QueuedMediaData",
"[",
"]",
"slice",
"=",
"null",
";",
"writeLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"slice",
"=",
"queue",
".",
"toArray",
"(",
"new",
"QueuedMediaData",
"[",
"0",
"]",
")... | Write all the queued items to the writer. | [
"Write",
"all",
"the",
"queued",
"items",
"to",
"the",
"writer",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/consumer/SlicedFileConsumer.java#L531-L546 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/consumer/SlicedFileConsumer.java | SlicedFileConsumer.doWrites | public final void doWrites(QueuedMediaData[] slice) {
// empty the queue
for (QueuedMediaData queued : slice) {
int tmpTs = queued.getTimestamp();
if (lastWrittenTs <= tmpTs) {
if (queued.hasData()) {
// write the data
... | java | public final void doWrites(QueuedMediaData[] slice) {
// empty the queue
for (QueuedMediaData queued : slice) {
int tmpTs = queued.getTimestamp();
if (lastWrittenTs <= tmpTs) {
if (queued.hasData()) {
// write the data
... | [
"public",
"final",
"void",
"doWrites",
"(",
"QueuedMediaData",
"[",
"]",
"slice",
")",
"{",
"// empty the queue\r",
"for",
"(",
"QueuedMediaData",
"queued",
":",
"slice",
")",
"{",
"int",
"tmpTs",
"=",
"queued",
".",
"getTimestamp",
"(",
")",
";",
"if",
"(... | Write a slice of the queued items to the writer.
@param slice
set of queued data | [
"Write",
"a",
"slice",
"of",
"the",
"queued",
"items",
"to",
"the",
"writer",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/consumer/SlicedFileConsumer.java#L554-L577 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/consumer/SlicedFileConsumer.java | SlicedFileConsumer.setupOutputPath | public void setupOutputPath(String name) {
// get stream filename generator
IStreamFilenameGenerator generator = (IStreamFilenameGenerator) ScopeUtils.getScopeService(scope, IStreamFilenameGenerator.class, DefaultStreamFilenameGenerator.class);
// generate file path
String filePath =... | java | public void setupOutputPath(String name) {
// get stream filename generator
IStreamFilenameGenerator generator = (IStreamFilenameGenerator) ScopeUtils.getScopeService(scope, IStreamFilenameGenerator.class, DefaultStreamFilenameGenerator.class);
// generate file path
String filePath =... | [
"public",
"void",
"setupOutputPath",
"(",
"String",
"name",
")",
"{",
"// get stream filename generator\r",
"IStreamFilenameGenerator",
"generator",
"=",
"(",
"IStreamFilenameGenerator",
")",
"ScopeUtils",
".",
"getScopeService",
"(",
"scope",
",",
"IStreamFilenameGenerator... | Sets up the output file path for writing.
@param name output filename to use | [
"Sets",
"up",
"the",
"output",
"file",
"path",
"for",
"writing",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/consumer/SlicedFileConsumer.java#L682-L701 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/consumer/SlicedFileConsumer.java | SlicedFileConsumer.setVideoDecoderConfiguration | public void setVideoDecoderConfiguration(IRTMPEvent decoderConfig) {
if (decoderConfig instanceof IStreamData) {
IoBuffer data = ((IStreamData<?>) decoderConfig).getData().asReadOnlyBuffer();
videoConfigurationTag = ImmutableTag.build(decoderConfig.getDataType(), 0, data, 0);
... | java | public void setVideoDecoderConfiguration(IRTMPEvent decoderConfig) {
if (decoderConfig instanceof IStreamData) {
IoBuffer data = ((IStreamData<?>) decoderConfig).getData().asReadOnlyBuffer();
videoConfigurationTag = ImmutableTag.build(decoderConfig.getDataType(), 0, data, 0);
... | [
"public",
"void",
"setVideoDecoderConfiguration",
"(",
"IRTMPEvent",
"decoderConfig",
")",
"{",
"if",
"(",
"decoderConfig",
"instanceof",
"IStreamData",
")",
"{",
"IoBuffer",
"data",
"=",
"(",
"(",
"IStreamData",
"<",
"?",
">",
")",
"decoderConfig",
")",
".",
... | Sets a video decoder configuration; some codecs require this, such as AVC.
@param decoderConfig
video codec configuration | [
"Sets",
"a",
"video",
"decoder",
"configuration",
";",
"some",
"codecs",
"require",
"this",
"such",
"as",
"AVC",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/consumer/SlicedFileConsumer.java#L709-L714 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/consumer/SlicedFileConsumer.java | SlicedFileConsumer.setAudioDecoderConfiguration | public void setAudioDecoderConfiguration(IRTMPEvent decoderConfig) {
if (decoderConfig instanceof IStreamData) {
IoBuffer data = ((IStreamData<?>) decoderConfig).getData().asReadOnlyBuffer();
audioConfigurationTag = ImmutableTag.build(decoderConfig.getDataType(), 0, data, 0);
... | java | public void setAudioDecoderConfiguration(IRTMPEvent decoderConfig) {
if (decoderConfig instanceof IStreamData) {
IoBuffer data = ((IStreamData<?>) decoderConfig).getData().asReadOnlyBuffer();
audioConfigurationTag = ImmutableTag.build(decoderConfig.getDataType(), 0, data, 0);
... | [
"public",
"void",
"setAudioDecoderConfiguration",
"(",
"IRTMPEvent",
"decoderConfig",
")",
"{",
"if",
"(",
"decoderConfig",
"instanceof",
"IStreamData",
")",
"{",
"IoBuffer",
"data",
"=",
"(",
"(",
"IStreamData",
"<",
"?",
">",
")",
"decoderConfig",
")",
".",
... | Sets a audio decoder configuration; some codecs require this, such as AAC.
@param decoderConfig
audio codec configuration | [
"Sets",
"a",
"audio",
"decoder",
"configuration",
";",
"some",
"codecs",
"require",
"this",
"such",
"as",
"AAC",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/consumer/SlicedFileConsumer.java#L722-L727 | train |
Red5/red5-server-common | src/main/java/org/red5/server/Client.java | Client.disconnect | public void disconnect() {
if (disconnected.compareAndSet(false, true)) {
log.debug("Disconnect - id: {}", id);
if (connections != null && !connections.isEmpty()) {
log.debug("Closing {} scope connections", connections.size());
// close all connection... | java | public void disconnect() {
if (disconnected.compareAndSet(false, true)) {
log.debug("Disconnect - id: {}", id);
if (connections != null && !connections.isEmpty()) {
log.debug("Closing {} scope connections", connections.size());
// close all connection... | [
"public",
"void",
"disconnect",
"(",
")",
"{",
"if",
"(",
"disconnected",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Disconnect - id: {}\"",
",",
"id",
")",
";",
"if",
"(",
"connections",
"!=",
"null",
... | Disconnects client from Red5 application | [
"Disconnects",
"client",
"from",
"Red5",
"application"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Client.java#L139-L159 | train |
Red5/red5-server-common | src/main/java/org/red5/server/Client.java | Client.getConnections | public Set<IConnection> getConnections(IScope scope) {
if (scope == null) {
return getConnections();
}
Set<IClient> scopeClients = scope.getClients();
if (scopeClients.contains(this)) {
for (IClient cli : scopeClients) {
if (this.equals(cli)... | java | public Set<IConnection> getConnections(IScope scope) {
if (scope == null) {
return getConnections();
}
Set<IClient> scopeClients = scope.getClients();
if (scopeClients.contains(this)) {
for (IClient cli : scopeClients) {
if (this.equals(cli)... | [
"public",
"Set",
"<",
"IConnection",
">",
"getConnections",
"(",
"IScope",
"scope",
")",
"{",
"if",
"(",
"scope",
"==",
"null",
")",
"{",
"return",
"getConnections",
"(",
")",
";",
"}",
"Set",
"<",
"IClient",
">",
"scopeClients",
"=",
"scope",
".",
"ge... | Return client connections to given scope
@param scope
Scope
@return Set of connections for that scope | [
"Return",
"client",
"connections",
"to",
"given",
"scope"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Client.java#L177-L190 | train |
Red5/red5-server-common | src/main/java/org/red5/server/Client.java | Client.iterateScopeNameList | public List<String> iterateScopeNameList() {
log.debug("iterateScopeNameList called");
Collection<IScope> scopes = getScopes();
log.debug("Scopes: {}", scopes.size());
List<String> scopeNames = new ArrayList<String>(scopes.size());
for (IScope scope : scopes) {
... | java | public List<String> iterateScopeNameList() {
log.debug("iterateScopeNameList called");
Collection<IScope> scopes = getScopes();
log.debug("Scopes: {}", scopes.size());
List<String> scopeNames = new ArrayList<String>(scopes.size());
for (IScope scope : scopes) {
... | [
"public",
"List",
"<",
"String",
">",
"iterateScopeNameList",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"iterateScopeNameList called\"",
")",
";",
"Collection",
"<",
"IScope",
">",
"scopes",
"=",
"getScopes",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"Sc... | Iterate through the scopes and their attributes. Used by JMX
@return list of scope attributes | [
"Iterate",
"through",
"the",
"scopes",
"and",
"their",
"attributes",
".",
"Used",
"by",
"JMX"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Client.java#L227-L242 | train |
Red5/red5-server-common | src/main/java/org/red5/server/Client.java | Client.register | protected void register(IConnection conn) {
if (log.isDebugEnabled()) {
if (conn == null) {
log.debug("Register null connection, client id: {}", id);
} else {
log.debug("Register connection ({}:{}) client id: {}", conn.getRemoteAddress(), conn.getRemo... | java | protected void register(IConnection conn) {
if (log.isDebugEnabled()) {
if (conn == null) {
log.debug("Register null connection, client id: {}", id);
} else {
log.debug("Register connection ({}:{}) client id: {}", conn.getRemoteAddress(), conn.getRemo... | [
"protected",
"void",
"register",
"(",
"IConnection",
"conn",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"conn",
"==",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"\"Register null connection, client id: {}\"",
",",
"id... | Associate connection with client
@param conn
Connection object | [
"Associate",
"connection",
"with",
"client"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Client.java#L261-L280 | train |
Red5/red5-server-common | src/main/java/org/red5/server/Client.java | Client.unregister | protected void unregister(IConnection conn, boolean deleteIfNoConns) {
log.debug("Unregister connection ({}:{}) client id: {}", conn.getRemoteAddress(), conn.getRemotePort(), id);
// remove connection from connected scopes list
connections.remove(conn);
// If client is not connected ... | java | protected void unregister(IConnection conn, boolean deleteIfNoConns) {
log.debug("Unregister connection ({}:{}) client id: {}", conn.getRemoteAddress(), conn.getRemotePort(), id);
// remove connection from connected scopes list
connections.remove(conn);
// If client is not connected ... | [
"protected",
"void",
"unregister",
"(",
"IConnection",
"conn",
",",
"boolean",
"deleteIfNoConns",
")",
"{",
"log",
".",
"debug",
"(",
"\"Unregister connection ({}:{}) client id: {}\"",
",",
"conn",
".",
"getRemoteAddress",
"(",
")",
",",
"conn",
".",
"getRemotePort"... | Removes client-connection association for given connection
@param conn
Connection object
@param deleteIfNoConns
Whether to delete this client if it no longer has any connections | [
"Removes",
"client",
"-",
"connection",
"association",
"for",
"given",
"connection"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Client.java#L300-L309 | train |
Red5/red5-server-common | src/main/java/org/red5/server/Client.java | Client.removeInstance | private void removeInstance() {
// unregister client
ClientRegistry ref = registry.get();
if (ref != null) {
ref.removeClient(this);
} else {
log.warn("Client registry reference was not accessable, removal failed");
// TODO: attempt to lookup th... | java | private void removeInstance() {
// unregister client
ClientRegistry ref = registry.get();
if (ref != null) {
ref.removeClient(this);
} else {
log.warn("Client registry reference was not accessable, removal failed");
// TODO: attempt to lookup th... | [
"private",
"void",
"removeInstance",
"(",
")",
"{",
"// unregister client\r",
"ClientRegistry",
"ref",
"=",
"registry",
".",
"get",
"(",
")",
";",
"if",
"(",
"ref",
"!=",
"null",
")",
"{",
"ref",
".",
"removeClient",
"(",
"this",
")",
";",
"}",
"else",
... | Removes this instance from the client registry. | [
"Removes",
"this",
"instance",
"from",
"the",
"client",
"registry",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Client.java#L386-L395 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.addChildScope | public boolean addChildScope(IBasicScope scope) {
log.debug("Add child: {}", scope);
boolean added = false;
if (scope.isValid()) {
try {
if (!children.containsKey(scope)) {
log.debug("Adding child scope: {} to {}", scope, this);
... | java | public boolean addChildScope(IBasicScope scope) {
log.debug("Add child: {}", scope);
boolean added = false;
if (scope.isValid()) {
try {
if (!children.containsKey(scope)) {
log.debug("Adding child scope: {} to {}", scope, this);
... | [
"public",
"boolean",
"addChildScope",
"(",
"IBasicScope",
"scope",
")",
"{",
"log",
".",
"debug",
"(",
"\"Add child: {}\"",
",",
"scope",
")",
";",
"boolean",
"added",
"=",
"false",
";",
"if",
"(",
"scope",
".",
"isValid",
"(",
")",
")",
"{",
"try",
"{... | Add child scope to this scope
@param scope Child scope
@return true on success (if scope has handler and it accepts child scope addition), false otherwise | [
"Add",
"child",
"scope",
"to",
"this",
"scope"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L194-L222 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.connect | public boolean connect(IConnection conn, Object[] params) {
log.debug("Connect - scope: {} connection: {}", this, conn);
if (enabled) {
if (hasParent() && !parent.connect(conn, params)) {
log.debug("Connection to parent failed");
return false;
... | java | public boolean connect(IConnection conn, Object[] params) {
log.debug("Connect - scope: {} connection: {}", this, conn);
if (enabled) {
if (hasParent() && !parent.connect(conn, params)) {
log.debug("Connection to parent failed");
return false;
... | [
"public",
"boolean",
"connect",
"(",
"IConnection",
"conn",
",",
"Object",
"[",
"]",
"params",
")",
"{",
"log",
".",
"debug",
"(",
"\"Connect - scope: {} connection: {}\"",
",",
"this",
",",
"conn",
")",
";",
"if",
"(",
"enabled",
")",
"{",
"if",
"(",
"h... | Connect to scope with parameters. To successfully connect to scope it must have handler that will accept this connection with given set of parameters. Client associated with connection is added to scope clients set, connection is registered as scope event listener.
@param conn Connection object
@param params Parameter... | [
"Connect",
"to",
"scope",
"with",
"parameters",
".",
"To",
"successfully",
"connect",
"to",
"scope",
"it",
"must",
"have",
"handler",
"that",
"will",
"accept",
"this",
"connection",
"with",
"given",
"set",
"of",
"parameters",
".",
"Client",
"associated",
"with... | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L241-L287 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.createChildScope | public boolean createChildScope(String name) {
// quick lookup by name
log.debug("createChildScope: {}", name);
if (children.hasName(name)) {
log.debug("Scope: {} already exists, children: {}", name, children.getNames());
} else {
return addChildScope(new Bu... | java | public boolean createChildScope(String name) {
// quick lookup by name
log.debug("createChildScope: {}", name);
if (children.hasName(name)) {
log.debug("Scope: {} already exists, children: {}", name, children.getNames());
} else {
return addChildScope(new Bu... | [
"public",
"boolean",
"createChildScope",
"(",
"String",
"name",
")",
"{",
"// quick lookup by name\r",
"log",
".",
"debug",
"(",
"\"createChildScope: {}\"",
",",
"name",
")",
";",
"if",
"(",
"children",
".",
"hasName",
"(",
"name",
")",
")",
"{",
"log",
".",... | Create child scope of room type, with the given name.
@param name child scope name
@return true on success, false otherwise | [
"Create",
"child",
"scope",
"of",
"room",
"type",
"with",
"the",
"given",
"name",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L295-L304 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.disconnect | public void disconnect(IConnection conn) {
log.debug("Disconnect: {}", conn);
// call disconnect handlers in reverse order of connection. ie. roomDisconnect is called before appDisconnect.
final IClient client = conn.getClient();
if (client == null) {
// early bail out
... | java | public void disconnect(IConnection conn) {
log.debug("Disconnect: {}", conn);
// call disconnect handlers in reverse order of connection. ie. roomDisconnect is called before appDisconnect.
final IClient client = conn.getClient();
if (client == null) {
// early bail out
... | [
"public",
"void",
"disconnect",
"(",
"IConnection",
"conn",
")",
"{",
"log",
".",
"debug",
"(",
"\"Disconnect: {}\"",
",",
"conn",
")",
";",
"// call disconnect handlers in reverse order of connection. ie. roomDisconnect is called before appDisconnect.\r",
"final",
"IClient",
... | Disconnect connection from scope
@param conn Connection object | [
"Disconnect",
"connection",
"from",
"scope"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L334-L377 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getBroadcastScope | public IBroadcastScope getBroadcastScope(String name) {
return (IBroadcastScope) children.getBasicScope(ScopeType.BROADCAST, name);
} | java | public IBroadcastScope getBroadcastScope(String name) {
return (IBroadcastScope) children.getBasicScope(ScopeType.BROADCAST, name);
} | [
"public",
"IBroadcastScope",
"getBroadcastScope",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"IBroadcastScope",
")",
"children",
".",
"getBasicScope",
"(",
"ScopeType",
".",
"BROADCAST",
",",
"name",
")",
";",
"}"
] | Return the broadcast scope for a given name
@param name
name
@return broadcast scope or null if not found | [
"Return",
"the",
"broadcast",
"scope",
"for",
"a",
"given",
"name"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L444-L446 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getBasicScope | public IBasicScope getBasicScope(ScopeType type, String name) {
return children.getBasicScope(type, name);
} | java | public IBasicScope getBasicScope(ScopeType type, String name) {
return children.getBasicScope(type, name);
} | [
"public",
"IBasicScope",
"getBasicScope",
"(",
"ScopeType",
"type",
",",
"String",
"name",
")",
"{",
"return",
"children",
".",
"getBasicScope",
"(",
"type",
",",
"name",
")",
";",
"}"
] | Return base scope of given type with given name
@param type Scope type
@param name Scope name
@return Basic scope object | [
"Return",
"base",
"scope",
"of",
"given",
"type",
"with",
"given",
"name"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L455-L457 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getBasicScopeNames | public Set<String> getBasicScopeNames(ScopeType type) {
if (type != null) {
Set<String> names = new HashSet<String>();
for (IBasicScope child : children.keySet()) {
if (child.getType().equals(type)) {
names.add(child.getName());
}... | java | public Set<String> getBasicScopeNames(ScopeType type) {
if (type != null) {
Set<String> names = new HashSet<String>();
for (IBasicScope child : children.keySet()) {
if (child.getType().equals(type)) {
names.add(child.getName());
}... | [
"public",
"Set",
"<",
"String",
">",
"getBasicScopeNames",
"(",
"ScopeType",
"type",
")",
"{",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"Set",
"<",
"String",
">",
"names",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"IBa... | Return basic scope names matching given type
@param type Scope type
@return set of scope names | [
"Return",
"basic",
"scope",
"names",
"matching",
"given",
"type"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L465-L476 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getDepth | @Override
public int getDepth() {
if (depth == UNSET) {
if (hasParent()) {
depth = parent.getDepth() + 1;
} else {
depth = 0;
}
}
return depth;
} | java | @Override
public int getDepth() {
if (depth == UNSET) {
if (hasParent()) {
depth = parent.getDepth() + 1;
} else {
depth = 0;
}
}
return depth;
} | [
"@",
"Override",
"public",
"int",
"getDepth",
"(",
")",
"{",
"if",
"(",
"depth",
"==",
"UNSET",
")",
"{",
"if",
"(",
"hasParent",
"(",
")",
")",
"{",
"depth",
"=",
"parent",
".",
"getDepth",
"(",
")",
"+",
"1",
";",
"}",
"else",
"{",
"depth",
"... | return scope depth
@return Scope depth | [
"return",
"scope",
"depth"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L594-L604 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getHandler | public IScopeHandler getHandler() {
log.trace("getHandler from {}", name);
if (handler != null) {
return handler;
} else if (hasParent()) {
return getParent().getHandler();
} else {
return null;
}
} | java | public IScopeHandler getHandler() {
log.trace("getHandler from {}", name);
if (handler != null) {
return handler;
} else if (hasParent()) {
return getParent().getHandler();
} else {
return null;
}
} | [
"public",
"IScopeHandler",
"getHandler",
"(",
")",
"{",
"log",
".",
"trace",
"(",
"\"getHandler from {}\"",
",",
"name",
")",
";",
"if",
"(",
"handler",
"!=",
"null",
")",
"{",
"return",
"handler",
";",
"}",
"else",
"if",
"(",
"hasParent",
"(",
")",
")... | Return scope handler or parent's scope handler if this scope doesn't have one.
@return Scope handler (or parent's one) | [
"Return",
"scope",
"handler",
"or",
"parent",
"s",
"scope",
"handler",
"if",
"this",
"scope",
"doesn",
"t",
"have",
"one",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L611-L620 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getResource | public Resource getResource(String path) {
if (hasContext()) {
return context.getResource(path);
}
return getContext().getResource(getContextPath() + '/' + path);
} | java | public Resource getResource(String path) {
if (hasContext()) {
return context.getResource(path);
}
return getContext().getResource(getContextPath() + '/' + path);
} | [
"public",
"Resource",
"getResource",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"hasContext",
"(",
")",
")",
"{",
"return",
"context",
".",
"getResource",
"(",
"path",
")",
";",
"}",
"return",
"getContext",
"(",
")",
".",
"getResource",
"(",
"getContext... | Return resource located at given path
@param path Resource path
@return Resource | [
"Return",
"resource",
"located",
"at",
"given",
"path"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L667-L672 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getResources | public Resource[] getResources(String path) throws IOException {
if (hasContext()) {
return context.getResources(path);
}
return getContext().getResources(getContextPath() + '/' + path);
} | java | public Resource[] getResources(String path) throws IOException {
if (hasContext()) {
return context.getResources(path);
}
return getContext().getResources(getContextPath() + '/' + path);
} | [
"public",
"Resource",
"[",
"]",
"getResources",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"hasContext",
"(",
")",
")",
"{",
"return",
"context",
".",
"getResources",
"(",
"path",
")",
";",
"}",
"return",
"getContext",
"(",
")",... | Return array of resources from path string, usually used with pattern path
@param path Resources path
@return Resources
@throws IOException I/O exception | [
"Return",
"array",
"of",
"resources",
"from",
"path",
"string",
"usually",
"used",
"with",
"pattern",
"path"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L681-L686 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getScope | public IScope getScope(String name) {
IBasicScope child = children.getBasicScope(ScopeType.UNDEFINED, name);
log.debug("Child of {}: {}", this.name, child);
if (child != null) {
if (child instanceof IScope) {
return (IScope) child;
}
log... | java | public IScope getScope(String name) {
IBasicScope child = children.getBasicScope(ScopeType.UNDEFINED, name);
log.debug("Child of {}: {}", this.name, child);
if (child != null) {
if (child instanceof IScope) {
return (IScope) child;
}
log... | [
"public",
"IScope",
"getScope",
"(",
"String",
"name",
")",
"{",
"IBasicScope",
"child",
"=",
"children",
".",
"getBasicScope",
"(",
"ScopeType",
".",
"UNDEFINED",
",",
"name",
")",
";",
"log",
".",
"debug",
"(",
"\"Child of {}: {}\"",
",",
"this",
".",
"n... | Return child scope by name
@param name Scope name
@return Child scope with given name | [
"Return",
"child",
"scope",
"by",
"name"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L694-L704 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getServiceHandler | public Object getServiceHandler(String name) {
Map<String, Object> serviceHandlers = getServiceHandlers(false);
if (serviceHandlers == null) {
return null;
}
return serviceHandlers.get(name);
} | java | public Object getServiceHandler(String name) {
Map<String, Object> serviceHandlers = getServiceHandlers(false);
if (serviceHandlers == null) {
return null;
}
return serviceHandlers.get(name);
} | [
"public",
"Object",
"getServiceHandler",
"(",
"String",
"name",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"serviceHandlers",
"=",
"getServiceHandlers",
"(",
"false",
")",
";",
"if",
"(",
"serviceHandlers",
"==",
"null",
")",
"{",
"return",
"null",
... | Return service handler by name
@param name Handler name
@return Service handler with given name | [
"Return",
"service",
"handler",
"by",
"name"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L722-L728 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getServiceHandlerNames | @SuppressWarnings("unchecked")
public Set<String> getServiceHandlerNames() {
Map<String, Object> serviceHandlers = getServiceHandlers(false);
if (serviceHandlers == null) {
return Collections.EMPTY_SET;
}
return serviceHandlers.keySet();
} | java | @SuppressWarnings("unchecked")
public Set<String> getServiceHandlerNames() {
Map<String, Object> serviceHandlers = getServiceHandlers(false);
if (serviceHandlers == null) {
return Collections.EMPTY_SET;
}
return serviceHandlers.keySet();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Set",
"<",
"String",
">",
"getServiceHandlerNames",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"serviceHandlers",
"=",
"getServiceHandlers",
"(",
"false",
")",
";",
"if",
"(",
"serv... | Return set of service handler names. Removing entries from the set unregisters the corresponding service handler.
@return Set of service handler names | [
"Return",
"set",
"of",
"service",
"handler",
"names",
".",
"Removing",
"entries",
"from",
"the",
"set",
"unregisters",
"the",
"corresponding",
"service",
"handler",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L735-L742 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getServiceHandlers | protected Map<String, Object> getServiceHandlers(boolean allowCreate) {
if (serviceHandlers == null) {
if (allowCreate) {
serviceHandlers = new ConcurrentHashMap<String, Object>(3, 0.9f, 1);
}
}
return serviceHandlers;
} | java | protected Map<String, Object> getServiceHandlers(boolean allowCreate) {
if (serviceHandlers == null) {
if (allowCreate) {
serviceHandlers = new ConcurrentHashMap<String, Object>(3, 0.9f, 1);
}
}
return serviceHandlers;
} | [
"protected",
"Map",
"<",
"String",
",",
"Object",
">",
"getServiceHandlers",
"(",
"boolean",
"allowCreate",
")",
"{",
"if",
"(",
"serviceHandlers",
"==",
"null",
")",
"{",
"if",
"(",
"allowCreate",
")",
"{",
"serviceHandlers",
"=",
"new",
"ConcurrentHashMap",
... | Return map of service handlers and optionally created it if it doesn't exist.
@param allowCreate Should the map be created if it doesn't exist?
@return Map of service handlers | [
"Return",
"map",
"of",
"service",
"handlers",
"and",
"optionally",
"created",
"it",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L759-L766 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.hasChildScope | public boolean hasChildScope(ScopeType type, String name) {
log.debug("Has child scope? {} in {}", name, this);
return children.getBasicScope(type, name) != null;
} | java | public boolean hasChildScope(ScopeType type, String name) {
log.debug("Has child scope? {} in {}", name, this);
return children.getBasicScope(type, name) != null;
} | [
"public",
"boolean",
"hasChildScope",
"(",
"ScopeType",
"type",
",",
"String",
"name",
")",
"{",
"log",
".",
"debug",
"(",
"\"Has child scope? {} in {}\"",
",",
"name",
",",
"this",
")",
";",
"return",
"children",
".",
"getBasicScope",
"(",
"type",
",",
"nam... | Check whether scope has child scope with given name and type
@param type Child scope type
@param name Child scope name
@return true if scope has child node with given name and type, false otherwise | [
"Check",
"whether",
"scope",
"has",
"child",
"scope",
"with",
"given",
"name",
"and",
"type"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L818-L821 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.init | public void init() {
log.debug("Init scope: {} parent: {}", name, parent);
if (hasParent()) {
if (!parent.hasChildScope(name)) {
if (parent.addChildScope(this)) {
log.debug("Scope added to parent");
} else {
log.w... | java | public void init() {
log.debug("Init scope: {} parent: {}", name, parent);
if (hasParent()) {
if (!parent.hasChildScope(name)) {
if (parent.addChildScope(this)) {
log.debug("Scope added to parent");
} else {
log.w... | [
"public",
"void",
"init",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"Init scope: {} parent: {}\"",
",",
"name",
",",
"parent",
")",
";",
"if",
"(",
"hasParent",
"(",
")",
")",
"{",
"if",
"(",
"!",
"parent",
".",
"hasChildScope",
"(",
"name",
")",
")... | Initialization actions, start if autostart is set to true. | [
"Initialization",
"actions",
"start",
"if",
"autostart",
"is",
"set",
"to",
"true",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L854-L874 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.uninit | public void uninit() {
log.debug("Un-init scope");
for (IBasicScope child : children.keySet()) {
if (child instanceof Scope) {
((Scope) child).uninit();
}
}
stop();
setEnabled(false);
if (hasParent()) {
if (par... | java | public void uninit() {
log.debug("Un-init scope");
for (IBasicScope child : children.keySet()) {
if (child instanceof Scope) {
((Scope) child).uninit();
}
}
stop();
setEnabled(false);
if (hasParent()) {
if (par... | [
"public",
"void",
"uninit",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"Un-init scope\"",
")",
";",
"for",
"(",
"IBasicScope",
"child",
":",
"children",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"child",
"instanceof",
"Scope",
")",
"{",
"(",
"(",... | Uninitialize scope and unregister from parent. | [
"Uninitialize",
"scope",
"and",
"unregister",
"from",
"parent",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L879-L893 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.registerServiceHandler | public void registerServiceHandler(String name, Object handler) {
Map<String, Object> serviceHandlers = getServiceHandlers();
serviceHandlers.put(name, handler);
} | java | public void registerServiceHandler(String name, Object handler) {
Map<String, Object> serviceHandlers = getServiceHandlers();
serviceHandlers.put(name, handler);
} | [
"public",
"void",
"registerServiceHandler",
"(",
"String",
"name",
",",
"Object",
"handler",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"serviceHandlers",
"=",
"getServiceHandlers",
"(",
")",
";",
"serviceHandlers",
".",
"put",
"(",
"name",
",",
"ha... | Register service handler by name
@param name Service handler name
@param handler Service handler | [
"Register",
"service",
"handler",
"by",
"name"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L933-L936 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.removeChildScope | public void removeChildScope(IBasicScope scope) {
log.debug("removeChildScope: {}", scope);
if (children.containsKey(scope)) {
// remove from parent
children.remove(scope);
if (scope instanceof Scope) {
unregisterJMX();
}
}
... | java | public void removeChildScope(IBasicScope scope) {
log.debug("removeChildScope: {}", scope);
if (children.containsKey(scope)) {
// remove from parent
children.remove(scope);
if (scope instanceof Scope) {
unregisterJMX();
}
}
... | [
"public",
"void",
"removeChildScope",
"(",
"IBasicScope",
"scope",
")",
"{",
"log",
".",
"debug",
"(",
"\"removeChildScope: {}\"",
",",
"scope",
")",
";",
"if",
"(",
"children",
".",
"containsKey",
"(",
"scope",
")",
")",
"{",
"// remove from parent\r",
"child... | Removes child scope
@param scope Child scope to remove | [
"Removes",
"child",
"scope"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L943-L952 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.removeChildren | public void removeChildren() {
log.trace("removeChildren of {}", name);
for (IBasicScope child : children.keySet()) {
removeChildScope(child);
}
} | java | public void removeChildren() {
log.trace("removeChildren of {}", name);
for (IBasicScope child : children.keySet()) {
removeChildScope(child);
}
} | [
"public",
"void",
"removeChildren",
"(",
")",
"{",
"log",
".",
"trace",
"(",
"\"removeChildren of {}\"",
",",
"name",
")",
";",
"for",
"(",
"IBasicScope",
"child",
":",
"children",
".",
"keySet",
"(",
")",
")",
"{",
"removeChildScope",
"(",
"child",
")",
... | Removes all the child scopes | [
"Removes",
"all",
"the",
"child",
"scopes"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L957-L962 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.setHandler | public void setHandler(IScopeHandler handler) {
log.debug("setHandler: {} on {}", handler, name);
this.handler = handler;
if (handler instanceof IScopeAware) {
((IScopeAware) handler).setScope(this);
}
} | java | public void setHandler(IScopeHandler handler) {
log.debug("setHandler: {} on {}", handler, name);
this.handler = handler;
if (handler instanceof IScopeAware) {
((IScopeAware) handler).setScope(this);
}
} | [
"public",
"void",
"setHandler",
"(",
"IScopeHandler",
"handler",
")",
"{",
"log",
".",
"debug",
"(",
"\"setHandler: {} on {}\"",
",",
"handler",
",",
"name",
")",
";",
"this",
".",
"handler",
"=",
"handler",
";",
"if",
"(",
"handler",
"instanceof",
"IScopeAw... | Setter for scope event handler
@param handler
Event handler | [
"Setter",
"for",
"scope",
"event",
"handler"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L1016-L1022 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.setName | @Override
public final void setName(String name) {
log.debug("Set name: {}", name);
if (this.name == null && StringUtils.isNotBlank(name)) {
// reset of the name is no longer allowed
this.name = name;
// unregister from jmx
if (oName != null) {
... | java | @Override
public final void setName(String name) {
log.debug("Set name: {}", name);
if (this.name == null && StringUtils.isNotBlank(name)) {
// reset of the name is no longer allowed
this.name = name;
// unregister from jmx
if (oName != null) {
... | [
"@",
"Override",
"public",
"final",
"void",
"setName",
"(",
"String",
"name",
")",
"{",
"log",
".",
"debug",
"(",
"\"Set name: {}\"",
",",
"name",
")",
";",
"if",
"(",
"this",
".",
"name",
"==",
"null",
"&&",
"StringUtils",
".",
"isNotBlank",
"(",
"nam... | Setter for scope name
@param name
Scope name | [
"Setter",
"for",
"scope",
"name"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L1030-L1045 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.setPersistenceClass | public void setPersistenceClass(String persistenceClass) throws Exception {
this.persistenceClass = persistenceClass;
if (persistenceClass != null) {
store = PersistenceUtils.getPersistenceStore(this, persistenceClass);
}
} | java | public void setPersistenceClass(String persistenceClass) throws Exception {
this.persistenceClass = persistenceClass;
if (persistenceClass != null) {
store = PersistenceUtils.getPersistenceStore(this, persistenceClass);
}
} | [
"public",
"void",
"setPersistenceClass",
"(",
"String",
"persistenceClass",
")",
"throws",
"Exception",
"{",
"this",
".",
"persistenceClass",
"=",
"persistenceClass",
";",
"if",
"(",
"persistenceClass",
"!=",
"null",
")",
"{",
"store",
"=",
"PersistenceUtils",
"."... | Set scope persistence class
@param persistenceClass
Scope's persistence class
@throws Exception
Exception | [
"Set",
"scope",
"persistence",
"class"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L1066-L1071 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.unregisterServiceHandler | public void unregisterServiceHandler(String name) {
Map<String, Object> serviceHandlers = getServiceHandlers(false);
if (serviceHandlers != null) {
serviceHandlers.remove(name);
}
} | java | public void unregisterServiceHandler(String name) {
Map<String, Object> serviceHandlers = getServiceHandlers(false);
if (serviceHandlers != null) {
serviceHandlers.remove(name);
}
} | [
"public",
"void",
"unregisterServiceHandler",
"(",
"String",
"name",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"serviceHandlers",
"=",
"getServiceHandlers",
"(",
"false",
")",
";",
"if",
"(",
"serviceHandlers",
"!=",
"null",
")",
"{",
"serviceHandler... | Unregisters service handler by name
@param name
Service handler name | [
"Unregisters",
"service",
"handler",
"by",
"name"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L1144-L1149 | train |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getServer | public IServer getServer() {
if (hasParent()) {
final IScope parent = getParent();
if (parent instanceof Scope) {
return ((Scope) parent).getServer();
} else if (parent instanceof IGlobalScope) {
return ((IGlobalScope) parent).getServer()... | java | public IServer getServer() {
if (hasParent()) {
final IScope parent = getParent();
if (parent instanceof Scope) {
return ((Scope) parent).getServer();
} else if (parent instanceof IGlobalScope) {
return ((IGlobalScope) parent).getServer()... | [
"public",
"IServer",
"getServer",
"(",
")",
"{",
"if",
"(",
"hasParent",
"(",
")",
")",
"{",
"final",
"IScope",
"parent",
"=",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"instanceof",
"Scope",
")",
"{",
"return",
"(",
"(",
"Scope",
")",
"parent... | Return the server instance connected to this scope.
@return the server instance | [
"Return",
"the",
"server",
"instance",
"connected",
"to",
"this",
"scope",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L1156-L1166 | train |
Red5/red5-server-common | src/main/java/org/red5/server/messaging/PipeConnectionEvent.java | PipeConnectionEvent.setParamMap | public void setParamMap(Map<String, Object> paramMap) {
if (paramMap != null && !paramMap.isEmpty()) {
this.paramMap.putAll(paramMap);
}
} | java | public void setParamMap(Map<String, Object> paramMap) {
if (paramMap != null && !paramMap.isEmpty()) {
this.paramMap.putAll(paramMap);
}
} | [
"public",
"void",
"setParamMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"paramMap",
")",
"{",
"if",
"(",
"paramMap",
"!=",
"null",
"&&",
"!",
"paramMap",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"paramMap",
".",
"putAll",
"(",
"paramM... | Setter for event parameters map
@param paramMap
Event parameters as Map | [
"Setter",
"for",
"event",
"parameters",
"map"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/PipeConnectionEvent.java#L155-L159 | train |
Red5/red5-server-common | src/main/java/org/red5/server/messaging/PipeConnectionEvent.java | PipeConnectionEvent.build | public final static PipeConnectionEvent build(AbstractPipe source, EventType type, IConsumer consumer, Map<String, Object> paramMap) {
return new PipeConnectionEvent(source, type, consumer, paramMap);
} | java | public final static PipeConnectionEvent build(AbstractPipe source, EventType type, IConsumer consumer, Map<String, Object> paramMap) {
return new PipeConnectionEvent(source, type, consumer, paramMap);
} | [
"public",
"final",
"static",
"PipeConnectionEvent",
"build",
"(",
"AbstractPipe",
"source",
",",
"EventType",
"type",
",",
"IConsumer",
"consumer",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"paramMap",
")",
"{",
"return",
"new",
"PipeConnectionEvent",
"(",
... | Builds a PipeConnectionEvent with a source pipe and consumer.
@param source pipe that triggers this event
@param type event type
@param consumer the consumer
@param paramMap parameters map
@return event | [
"Builds",
"a",
"PipeConnectionEvent",
"with",
"a",
"source",
"pipe",
"and",
"consumer",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/PipeConnectionEvent.java#L189-L191 | train |
Red5/red5-server-common | src/main/java/org/red5/server/messaging/PipeConnectionEvent.java | PipeConnectionEvent.build | public final static PipeConnectionEvent build(AbstractPipe source, EventType type, IProvider provider, Map<String, Object> paramMap) {
return new PipeConnectionEvent(source, type, provider, paramMap);
} | java | public final static PipeConnectionEvent build(AbstractPipe source, EventType type, IProvider provider, Map<String, Object> paramMap) {
return new PipeConnectionEvent(source, type, provider, paramMap);
} | [
"public",
"final",
"static",
"PipeConnectionEvent",
"build",
"(",
"AbstractPipe",
"source",
",",
"EventType",
"type",
",",
"IProvider",
"provider",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"paramMap",
")",
"{",
"return",
"new",
"PipeConnectionEvent",
"(",
... | Builds a PipeConnectionEvent with a source pipe and provider.
@param source pipe that triggers this event
@param type event type
@param provider the provider
@param paramMap parameters map
@return event | [
"Builds",
"a",
"PipeConnectionEvent",
"with",
"a",
"source",
"pipe",
"and",
"provider",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/PipeConnectionEvent.java#L202-L204 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/remoting/RemotingClient.java | RemotingClient.setCredentials | public void setCredentials(String userid, String password) {
Map<String, String> data = new HashMap<String, String>();
data.put("userid", userid);
data.put("password", password);
RemotingHeader header = new RemotingHeader(RemotingHeader.CREDENTIALS, true, data);
headers.put(... | java | public void setCredentials(String userid, String password) {
Map<String, String> data = new HashMap<String, String>();
data.put("userid", userid);
data.put("password", password);
RemotingHeader header = new RemotingHeader(RemotingHeader.CREDENTIALS, true, data);
headers.put(... | [
"public",
"void",
"setCredentials",
"(",
"String",
"userid",
",",
"String",
"password",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"data",
".",
"put",
"(",
"\"u... | Send authentication data with each remoting request.
@param userid
User identifier
@param password
Password | [
"Send",
"authentication",
"data",
"with",
"each",
"remoting",
"request",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/remoting/RemotingClient.java#L265-L271 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/remoting/RemotingClient.java | RemotingClient.addHeader | public void addHeader(String name, boolean required, Object value) {
RemotingHeader header = new RemotingHeader(name, required, value);
headers.put(name, header);
} | java | public void addHeader(String name, boolean required, Object value) {
RemotingHeader header = new RemotingHeader(name, required, value);
headers.put(name, header);
} | [
"public",
"void",
"addHeader",
"(",
"String",
"name",
",",
"boolean",
"required",
",",
"Object",
"value",
")",
"{",
"RemotingHeader",
"header",
"=",
"new",
"RemotingHeader",
"(",
"name",
",",
"required",
",",
"value",
")",
";",
"headers",
".",
"put",
"(",
... | Send an additional header to the server.
@param name
Header name
@param required
Header required?
@param value
Header body | [
"Send",
"an",
"additional",
"header",
"to",
"the",
"server",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/remoting/RemotingClient.java#L290-L293 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/remoting/RemotingClient.java | RemotingClient.invokeMethod | public Object invokeMethod(String method, Object[] params) {
log.debug("invokeMethod url: {}", (url + appendToUrl));
IoBuffer resultBuffer = null;
IoBuffer data = encodeInvoke(method, params);
//setup POST
HttpPost post = null;
try {
post = new HttpPost... | java | public Object invokeMethod(String method, Object[] params) {
log.debug("invokeMethod url: {}", (url + appendToUrl));
IoBuffer resultBuffer = null;
IoBuffer data = encodeInvoke(method, params);
//setup POST
HttpPost post = null;
try {
post = new HttpPost... | [
"public",
"Object",
"invokeMethod",
"(",
"String",
"method",
",",
"Object",
"[",
"]",
"params",
")",
"{",
"log",
".",
"debug",
"(",
"\"invokeMethod url: {}\"",
",",
"(",
"url",
"+",
"appendToUrl",
")",
")",
";",
"IoBuffer",
"resultBuffer",
"=",
"null",
";"... | Invoke a method synchronously on the remoting server.
@param method
Method name
@param params
Parameters passed to method
@return the result of the method call | [
"Invoke",
"a",
"method",
"synchronously",
"on",
"the",
"remoting",
"server",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/remoting/RemotingClient.java#L314-L362 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/remoting/RemotingClient.java | RemotingClient.invokeMethod | public void invokeMethod(String method, Object[] methodParams, IRemotingCallback callback) {
try {
RemotingWorker worker = new RemotingWorker(this, method, methodParams, callback);
executor.execute(worker);
} catch (Exception err) {
log.warn("Exception invoking m... | java | public void invokeMethod(String method, Object[] methodParams, IRemotingCallback callback) {
try {
RemotingWorker worker = new RemotingWorker(this, method, methodParams, callback);
executor.execute(worker);
} catch (Exception err) {
log.warn("Exception invoking m... | [
"public",
"void",
"invokeMethod",
"(",
"String",
"method",
",",
"Object",
"[",
"]",
"methodParams",
",",
"IRemotingCallback",
"callback",
")",
"{",
"try",
"{",
"RemotingWorker",
"worker",
"=",
"new",
"RemotingWorker",
"(",
"this",
",",
"method",
",",
"methodPa... | Invoke a method asynchronously on the remoting server.
@param method
Method name
@param methodParams
Parameters passed to method
@param callback
Callback | [
"Invoke",
"a",
"method",
"asynchronously",
"on",
"the",
"remoting",
"server",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/remoting/RemotingClient.java#L374-L381 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java | RTMPProtocolDecoder.decodeBuffer | public List<Object> decodeBuffer(RTMPConnection conn, IoBuffer buffer) {
final int position = buffer.position();
//if (log.isTraceEnabled()) {
//log.trace("decodeBuffer: {}", Hex.encodeHexString(Arrays.copyOfRange(buffer.array(), position, buffer.limit())));
//}
// decod... | java | public List<Object> decodeBuffer(RTMPConnection conn, IoBuffer buffer) {
final int position = buffer.position();
//if (log.isTraceEnabled()) {
//log.trace("decodeBuffer: {}", Hex.encodeHexString(Arrays.copyOfRange(buffer.array(), position, buffer.limit())));
//}
// decod... | [
"public",
"List",
"<",
"Object",
">",
"decodeBuffer",
"(",
"RTMPConnection",
"conn",
",",
"IoBuffer",
"buffer",
")",
"{",
"final",
"int",
"position",
"=",
"buffer",
".",
"position",
"(",
")",
";",
"//if (log.isTraceEnabled()) {\r",
"//log.trace(\"decodeBuffer: {}\",... | Decode all available objects in buffer.
@param conn
RTMP connection
@param buffer
IoBuffer of data to be decoded
@return a list of decoded objects, may be empty if nothing could be decoded | [
"Decode",
"all",
"available",
"objects",
"in",
"buffer",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java#L102-L163 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java | RTMPProtocolDecoder.decode | public Object decode(RTMPConnection conn, RTMPDecodeState state, IoBuffer in) throws ProtocolException {
//if (log.isTraceEnabled()) {
//log.trace("Decoding for {}", conn.getSessionId());
//}
try {
final byte connectionState = conn.getStateCode();
switch... | java | public Object decode(RTMPConnection conn, RTMPDecodeState state, IoBuffer in) throws ProtocolException {
//if (log.isTraceEnabled()) {
//log.trace("Decoding for {}", conn.getSessionId());
//}
try {
final byte connectionState = conn.getStateCode();
switch... | [
"public",
"Object",
"decode",
"(",
"RTMPConnection",
"conn",
",",
"RTMPDecodeState",
"state",
",",
"IoBuffer",
"in",
")",
"throws",
"ProtocolException",
"{",
"//if (log.isTraceEnabled()) {\r",
"//log.trace(\"Decoding for {}\", conn.getSessionId());\r",
"//}\r",
"try",
"{",
... | Decodes the buffer data.
@param conn
RTMP connection
@param state
Stores state for the protocol, ProtocolState is just a marker interface
@param in
IoBuffer of data to be decoded
@return one of three possible values:
<pre>
1. null : the object could not be decoded, or some data was skipped, just continue
2. ProtocolS... | [
"Decodes",
"the",
"buffer",
"data",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java#L184-L212 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java | RTMPProtocolDecoder.decodeMessage | public IRTMPEvent decodeMessage(RTMPConnection conn, Header header, IoBuffer in) {
IRTMPEvent message;
byte dataType = header.getDataType();
switch (dataType) {
case TYPE_AUDIO_DATA:
message = decodeAudioData(in);
message.setSourceType(Constants.... | java | public IRTMPEvent decodeMessage(RTMPConnection conn, Header header, IoBuffer in) {
IRTMPEvent message;
byte dataType = header.getDataType();
switch (dataType) {
case TYPE_AUDIO_DATA:
message = decodeAudioData(in);
message.setSourceType(Constants.... | [
"public",
"IRTMPEvent",
"decodeMessage",
"(",
"RTMPConnection",
"conn",
",",
"Header",
"header",
",",
"IoBuffer",
"in",
")",
"{",
"IRTMPEvent",
"message",
";",
"byte",
"dataType",
"=",
"header",
".",
"getDataType",
"(",
")",
";",
"switch",
"(",
"dataType",
"... | Decodes RTMP message event.
@param conn
RTMP connection
@param header
RTMP header
@param in
Input IoBuffer
@return RTMP event | [
"Decodes",
"RTMP",
"message",
"event",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java#L499-L571 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java | RTMPProtocolDecoder.doDecodeSharedObject | protected void doDecodeSharedObject(SharedObjectMessage so, IoBuffer in, Input input) {
// Parse request body
Input amf3Input = new org.red5.io.amf3.Input(in);
while (in.hasRemaining()) {
final ISharedObjectEvent.Type type = SharedObjectTypeMapping.toType(in.get());
... | java | protected void doDecodeSharedObject(SharedObjectMessage so, IoBuffer in, Input input) {
// Parse request body
Input amf3Input = new org.red5.io.amf3.Input(in);
while (in.hasRemaining()) {
final ISharedObjectEvent.Type type = SharedObjectTypeMapping.toType(in.get());
... | [
"protected",
"void",
"doDecodeSharedObject",
"(",
"SharedObjectMessage",
"so",
",",
"IoBuffer",
"in",
",",
"Input",
"input",
")",
"{",
"// Parse request body\r",
"Input",
"amf3Input",
"=",
"new",
"org",
".",
"red5",
".",
"io",
".",
"amf3",
".",
"Input",
"(",
... | Perform the actual decoding of the shared object contents.
@param so
Shared object message
@param in
input buffer
@param input
Input object to be processed | [
"Perform",
"the",
"actual",
"decoding",
"of",
"the",
"shared",
"object",
"contents",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java#L669-L739 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java | RTMPProtocolDecoder.decodeAction | private Invoke decodeAction(Encoding encoding, IoBuffer in, Header header) {
// for response, the action string and invokeId is always encoded as AMF0 we use the first byte to decide which encoding to use
in.mark();
byte tmp = in.get();
in.reset();
Input input;
if (... | java | private Invoke decodeAction(Encoding encoding, IoBuffer in, Header header) {
// for response, the action string and invokeId is always encoded as AMF0 we use the first byte to decide which encoding to use
in.mark();
byte tmp = in.get();
in.reset();
Input input;
if (... | [
"private",
"Invoke",
"decodeAction",
"(",
"Encoding",
"encoding",
",",
"IoBuffer",
"in",
",",
"Header",
"header",
")",
"{",
"// for response, the action string and invokeId is always encoded as AMF0 we use the first byte to decide which encoding to use\r",
"in",
".",
"mark",
"(",... | Decode the 'action' for a supplied an Invoke.
@param encoding
AMF encoding
@param in
buffer
@param header
data header
@return notify | [
"Decode",
"the",
"action",
"for",
"a",
"supplied",
"an",
"Invoke",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java#L752-L796 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java | RTMPProtocolDecoder.decodePing | public Ping decodePing(IoBuffer in) {
Ping ping = null;
if (log.isTraceEnabled()) {
// gets the raw data as hex without changing the data or pointer
String hexDump = in.getHexDump();
log.trace("Ping dump: {}", hexDump);
}
// control type
... | java | public Ping decodePing(IoBuffer in) {
Ping ping = null;
if (log.isTraceEnabled()) {
// gets the raw data as hex without changing the data or pointer
String hexDump = in.getHexDump();
log.trace("Ping dump: {}", hexDump);
}
// control type
... | [
"public",
"Ping",
"decodePing",
"(",
"IoBuffer",
"in",
")",
"{",
"Ping",
"ping",
"=",
"null",
";",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"// gets the raw data as hex without changing the data or pointer\r",
"String",
"hexDump",
"=",
"in",
... | Decodes ping event.
@param in
IoBuffer
@return Ping event | [
"Decodes",
"ping",
"event",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java#L810-L840 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java | RTMPProtocolDecoder.isStreamCommand | @SuppressWarnings("unused")
private boolean isStreamCommand(String action) {
switch (StreamAction.getEnum(action)) {
case CREATE_STREAM:
case DELETE_STREAM:
case RELEASE_STREAM:
case PUBLISH:
case PLAY:
case PLAY2:
... | java | @SuppressWarnings("unused")
private boolean isStreamCommand(String action) {
switch (StreamAction.getEnum(action)) {
case CREATE_STREAM:
case DELETE_STREAM:
case RELEASE_STREAM:
case PUBLISH:
case PLAY:
case PLAY2:
... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"boolean",
"isStreamCommand",
"(",
"String",
"action",
")",
"{",
"switch",
"(",
"StreamAction",
".",
"getEnum",
"(",
"action",
")",
")",
"{",
"case",
"CREATE_STREAM",
":",
"case",
"DELETE_STREAM",
":"... | Checks if the passed action is a reserved stream method.
@param action
Action to check
@return true if passed action is a reserved stream method, false otherwise | [
"Checks",
"if",
"the",
"passed",
"action",
"is",
"a",
"reserved",
"stream",
"method",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java#L1092-L1112 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/Channel.java | Channel.write | public void write(IRTMPEvent event) {
if (!connection.isClosed()) {
final IClientStream stream = connection.getStreamByChannelId(id);
if (id > 3 && stream == null) {
log.warn("Non-existant stream for channel id: {}, session: {} discarding: {}", id, connection.getSessi... | java | public void write(IRTMPEvent event) {
if (!connection.isClosed()) {
final IClientStream stream = connection.getStreamByChannelId(id);
if (id > 3 && stream == null) {
log.warn("Non-existant stream for channel id: {}, session: {} discarding: {}", id, connection.getSessi... | [
"public",
"void",
"write",
"(",
"IRTMPEvent",
"event",
")",
"{",
"if",
"(",
"!",
"connection",
".",
"isClosed",
"(",
")",
")",
"{",
"final",
"IClientStream",
"stream",
"=",
"connection",
".",
"getStreamByChannelId",
"(",
"id",
")",
";",
"if",
"(",
"id",
... | Writes packet from event data to RTMP connection.
@param event
Event data | [
"Writes",
"packet",
"from",
"event",
"data",
"to",
"RTMP",
"connection",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/Channel.java#L103-L115 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/Channel.java | Channel.write | private void write(IRTMPEvent event, Number streamId) {
log.trace("write to stream id: {} channel: {}", streamId, id);
final Header header = new Header();
final Packet packet = new Packet(header, event);
// set the channel id
header.setChannelId(id);
int ts = event.... | java | private void write(IRTMPEvent event, Number streamId) {
log.trace("write to stream id: {} channel: {}", streamId, id);
final Header header = new Header();
final Packet packet = new Packet(header, event);
// set the channel id
header.setChannelId(id);
int ts = event.... | [
"private",
"void",
"write",
"(",
"IRTMPEvent",
"event",
",",
"Number",
"streamId",
")",
"{",
"log",
".",
"trace",
"(",
"\"write to stream id: {} channel: {}\"",
",",
"streamId",
",",
"id",
")",
";",
"final",
"Header",
"header",
"=",
"new",
"Header",
"(",
")"... | Writes packet from event data to RTMP connection and stream id.
@param event
Event data
@param streamId
Stream id | [
"Writes",
"packet",
"from",
"event",
"data",
"to",
"RTMP",
"connection",
"and",
"stream",
"id",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/Channel.java#L125-L140 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/Channel.java | Channel.discard | @SuppressWarnings("unused")
private void discard(IRTMPEvent event) {
if (event instanceof IStreamData<?>) {
log.debug("Discarding: {}", ((IStreamData<?>) event).toString());
IoBuffer data = ((IStreamData<?>) event).getData();
if (data != null) {
log.... | java | @SuppressWarnings("unused")
private void discard(IRTMPEvent event) {
if (event instanceof IStreamData<?>) {
log.debug("Discarding: {}", ((IStreamData<?>) event).toString());
IoBuffer data = ((IStreamData<?>) event).getData();
if (data != null) {
log.... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"void",
"discard",
"(",
"IRTMPEvent",
"event",
")",
"{",
"if",
"(",
"event",
"instanceof",
"IStreamData",
"<",
"?",
">",
")",
"{",
"log",
".",
"debug",
"(",
"\"Discarding: {}\"",
",",
"(",
"(",
... | Discard an event routed to this channel.
@param event | [
"Discard",
"an",
"event",
"routed",
"to",
"this",
"channel",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/Channel.java#L147-L159 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/Channel.java | Channel.sendStatus | public void sendStatus(Status status) {
if (connection != null) {
final boolean andReturn = !status.getCode().equals(StatusCodes.NS_DATA_START);
final Invoke event = new Invoke();
if (andReturn) {
final PendingCall call = new PendingCall(null, CALL_ON_STA... | java | public void sendStatus(Status status) {
if (connection != null) {
final boolean andReturn = !status.getCode().equals(StatusCodes.NS_DATA_START);
final Invoke event = new Invoke();
if (andReturn) {
final PendingCall call = new PendingCall(null, CALL_ON_STA... | [
"public",
"void",
"sendStatus",
"(",
"Status",
"status",
")",
"{",
"if",
"(",
"connection",
"!=",
"null",
")",
"{",
"final",
"boolean",
"andReturn",
"=",
"!",
"status",
".",
"getCode",
"(",
")",
".",
"equals",
"(",
"StatusCodes",
".",
"NS_DATA_START",
")... | Sends status notification.
@param status
Status | [
"Sends",
"status",
"notification",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/Channel.java#L167-L196 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/StreamService.java | StreamService.pause | public void pause(Boolean pausePlayback, int position) {
IConnection conn = Red5.getConnectionLocal();
if (conn instanceof IStreamCapableConnection) {
IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
Number streamId = conn.getStreamId();
ICl... | java | public void pause(Boolean pausePlayback, int position) {
IConnection conn = Red5.getConnectionLocal();
if (conn instanceof IStreamCapableConnection) {
IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
Number streamId = conn.getStreamId();
ICl... | [
"public",
"void",
"pause",
"(",
"Boolean",
"pausePlayback",
",",
"int",
"position",
")",
"{",
"IConnection",
"conn",
"=",
"Red5",
".",
"getConnectionLocal",
"(",
")",
";",
"if",
"(",
"conn",
"instanceof",
"IStreamCapableConnection",
")",
"{",
"IStreamCapableConn... | Pause at given position. Required as "pausePlayback" can be "null" if no flag is passed by the client
@param pausePlayback
Pause playback or not
@param position
Pause position | [
"Pause",
"at",
"given",
"position",
".",
"Required",
"as",
"pausePlayback",
"can",
"be",
"null",
"if",
"no",
"flag",
"is",
"passed",
"by",
"the",
"client"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/StreamService.java#L255-L274 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/StreamService.java | StreamService.play | public void play(String name, int start, int length, Object reset) {
if (reset instanceof Boolean) {
play(name, start, length, ((Boolean) reset).booleanValue());
} else {
if (reset instanceof Integer) {
int value = (Integer) reset;
switch (va... | java | public void play(String name, int start, int length, Object reset) {
if (reset instanceof Boolean) {
play(name, start, length, ((Boolean) reset).booleanValue());
} else {
if (reset instanceof Integer) {
int value = (Integer) reset;
switch (va... | [
"public",
"void",
"play",
"(",
"String",
"name",
",",
"int",
"start",
",",
"int",
"length",
",",
"Object",
"reset",
")",
"{",
"if",
"(",
"reset",
"instanceof",
"Boolean",
")",
"{",
"play",
"(",
"name",
",",
"start",
",",
"length",
",",
"(",
"(",
"B... | Plays back a stream based on the supplied name, from the specified position for the given length of time.
@param name
- The name of a recorded file, or the identifier for live data. If
@param start
- The start time, in seconds. Allowed values are -2, -1, 0, or a positive number. The default value is -2, which looks fo... | [
"Plays",
"back",
"a",
"stream",
"based",
"on",
"the",
"supplied",
"name",
"from",
"the",
"specified",
"position",
"for",
"the",
"given",
"length",
"of",
"time",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/StreamService.java#L294-L325 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/StreamService.java | StreamService.sendNSFailed | private void sendNSFailed(IConnection conn, String errorCode, String description, String name, Number streamId) {
StreamService.sendNetStreamStatus(conn, errorCode, description, name, Status.ERROR, streamId);
} | java | private void sendNSFailed(IConnection conn, String errorCode, String description, String name, Number streamId) {
StreamService.sendNetStreamStatus(conn, errorCode, description, name, Status.ERROR, streamId);
} | [
"private",
"void",
"sendNSFailed",
"(",
"IConnection",
"conn",
",",
"String",
"errorCode",
",",
"String",
"description",
",",
"String",
"name",
",",
"Number",
"streamId",
")",
"{",
"StreamService",
".",
"sendNetStreamStatus",
"(",
"conn",
",",
"errorCode",
",",
... | Send NetStream.Play.Failed to the client.
@param conn
@param errorCode
@param description
@param name
@param streamId | [
"Send",
"NetStream",
".",
"Play",
".",
"Failed",
"to",
"the",
"client",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/StreamService.java#L800-L802 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.initRC4Encryption | protected void initRC4Encryption(byte[] sharedSecret) {
log.debug("Shared secret: {}", Hex.encodeHexString(sharedSecret));
// create output cipher
log.debug("Outgoing public key [{}]: {}", outgoingPublicKey.length, Hex.encodeHexString(outgoingPublicKey));
byte[] rc4keyOut = new byte[... | java | protected void initRC4Encryption(byte[] sharedSecret) {
log.debug("Shared secret: {}", Hex.encodeHexString(sharedSecret));
// create output cipher
log.debug("Outgoing public key [{}]: {}", outgoingPublicKey.length, Hex.encodeHexString(outgoingPublicKey));
byte[] rc4keyOut = new byte[... | [
"protected",
"void",
"initRC4Encryption",
"(",
"byte",
"[",
"]",
"sharedSecret",
")",
"{",
"log",
".",
"debug",
"(",
"\"Shared secret: {}\"",
",",
"Hex",
".",
"encodeHexString",
"(",
"sharedSecret",
")",
")",
";",
"// create output cipher\r",
"log",
".",
"debug"... | Prepare the ciphers.
@param sharedSecret shared secret byte sequence | [
"Prepare",
"the",
"ciphers",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L213-L239 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.generateKeyPair | protected KeyPair generateKeyPair() {
KeyPair keyPair = null;
DHParameterSpec keySpec = new DHParameterSpec(DH_MODULUS, DH_BASE);
try {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH");
keyGen.initialize(keySpec);
keyPair = keyGen.generateKey... | java | protected KeyPair generateKeyPair() {
KeyPair keyPair = null;
DHParameterSpec keySpec = new DHParameterSpec(DH_MODULUS, DH_BASE);
try {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH");
keyGen.initialize(keySpec);
keyPair = keyGen.generateKey... | [
"protected",
"KeyPair",
"generateKeyPair",
"(",
")",
"{",
"KeyPair",
"keyPair",
"=",
"null",
";",
"DHParameterSpec",
"keySpec",
"=",
"new",
"DHParameterSpec",
"(",
"DH_MODULUS",
",",
"DH_BASE",
")",
";",
"try",
"{",
"KeyPairGenerator",
"keyGen",
"=",
"KeyPairGen... | Creates a Diffie-Hellman key pair.
@return dh keypair | [
"Creates",
"a",
"Diffie",
"-",
"Hellman",
"key",
"pair",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L246-L260 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.getPublicKey | protected byte[] getPublicKey(KeyPair keyPair) {
DHPublicKey incomingPublicKey = (DHPublicKey) keyPair.getPublic();
BigInteger dhY = incomingPublicKey.getY();
if (log.isDebugEnabled()) {
log.debug("Public key: {}", Hex.encodeHexString(BigIntegers.asUnsignedByteArray(dhY)));
... | java | protected byte[] getPublicKey(KeyPair keyPair) {
DHPublicKey incomingPublicKey = (DHPublicKey) keyPair.getPublic();
BigInteger dhY = incomingPublicKey.getY();
if (log.isDebugEnabled()) {
log.debug("Public key: {}", Hex.encodeHexString(BigIntegers.asUnsignedByteArray(dhY)));
... | [
"protected",
"byte",
"[",
"]",
"getPublicKey",
"(",
"KeyPair",
"keyPair",
")",
"{",
"DHPublicKey",
"incomingPublicKey",
"=",
"(",
"DHPublicKey",
")",
"keyPair",
".",
"getPublic",
"(",
")",
";",
"BigInteger",
"dhY",
"=",
"incomingPublicKey",
".",
"getY",
"(",
... | Returns the public key for a given key pair.
@param keyPair key pair
@return public key | [
"Returns",
"the",
"public",
"key",
"for",
"a",
"given",
"key",
"pair",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L268-L275 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.calculateDigest | public void calculateDigest(int digestPos, byte[] handshakeMessage, int handshakeOffset, byte[] key, int keyLen, byte[] digest, int digestOffset) {
if (log.isTraceEnabled()) {
log.trace("calculateDigest - digestPos: {} handshakeOffset: {} keyLen: {} digestOffset: {}", digestPos, handshakeOffset, k... | java | public void calculateDigest(int digestPos, byte[] handshakeMessage, int handshakeOffset, byte[] key, int keyLen, byte[] digest, int digestOffset) {
if (log.isTraceEnabled()) {
log.trace("calculateDigest - digestPos: {} handshakeOffset: {} keyLen: {} digestOffset: {}", digestPos, handshakeOffset, k... | [
"public",
"void",
"calculateDigest",
"(",
"int",
"digestPos",
",",
"byte",
"[",
"]",
"handshakeMessage",
",",
"int",
"handshakeOffset",
",",
"byte",
"[",
"]",
"key",
",",
"int",
"keyLen",
",",
"byte",
"[",
"]",
"digest",
",",
"int",
"digestOffset",
")",
... | Calculates the digest given the its offset in the handshake data.
@param digestPos digest position
@param handshakeMessage handshake message
@param handshakeOffset handshake message offset
@param key contains the key
@param keyLen the length of the key
@param digest contains the calculated digest
@param digestOffset d... | [
"Calculates",
"the",
"digest",
"given",
"the",
"its",
"offset",
"in",
"the",
"handshake",
"data",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L323-L335 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.verifyDigest | public boolean verifyDigest(int digestPos, byte[] handshakeMessage, byte[] key, int keyLen) {
if (log.isTraceEnabled()) {
log.trace("verifyDigest - digestPos: {} keyLen: {} handshake size: {} ", digestPos, keyLen, handshakeMessage.length);
}
byte[] calcDigest = new byte[DIGEST_LE... | java | public boolean verifyDigest(int digestPos, byte[] handshakeMessage, byte[] key, int keyLen) {
if (log.isTraceEnabled()) {
log.trace("verifyDigest - digestPos: {} keyLen: {} handshake size: {} ", digestPos, keyLen, handshakeMessage.length);
}
byte[] calcDigest = new byte[DIGEST_LE... | [
"public",
"boolean",
"verifyDigest",
"(",
"int",
"digestPos",
",",
"byte",
"[",
"]",
"handshakeMessage",
",",
"byte",
"[",
"]",
"key",
",",
"int",
"keyLen",
")",
"{",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"log",
".",
"trace",
"... | Verifies the digest.
@param digestPos digest position
@param handshakeMessage handshake message
@param key contains the key
@param keyLen the length of the key
@return true if valid and false otherwise | [
"Verifies",
"the",
"digest",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L346-L356 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.calculateHMAC_SHA256 | public void calculateHMAC_SHA256(byte[] message, int messageOffset, int messageLen, byte[] key, int keyLen, byte[] digest, int digestOffset) {
if (log.isTraceEnabled()) {
log.trace("calculateHMAC_SHA256 - messageOffset: {} messageLen: {}", messageOffset, messageLen);
log.trace("calcul... | java | public void calculateHMAC_SHA256(byte[] message, int messageOffset, int messageLen, byte[] key, int keyLen, byte[] digest, int digestOffset) {
if (log.isTraceEnabled()) {
log.trace("calculateHMAC_SHA256 - messageOffset: {} messageLen: {}", messageOffset, messageLen);
log.trace("calcul... | [
"public",
"void",
"calculateHMAC_SHA256",
"(",
"byte",
"[",
"]",
"message",
",",
"int",
"messageOffset",
",",
"int",
"messageLen",
",",
"byte",
"[",
"]",
"key",
",",
"int",
"keyLen",
",",
"byte",
"[",
"]",
"digest",
",",
"int",
"digestOffset",
")",
"{",
... | Calculates an HMAC SHA256 hash into the digest at the given offset.
@param message incoming bytes
@param messageOffset message offset
@param messageLen message length
@param key incoming key bytes
@param keyLen the length of the key
@param digest contains the calculated digest
@param digestOffset digest offset | [
"Calculates",
"an",
"HMAC",
"SHA256",
"hash",
"into",
"the",
"digest",
"at",
"the",
"given",
"offset",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L369-L391 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.calculateSwfVerification | public void calculateSwfVerification(byte[] handshakeMessage, byte[] swfHash, int swfSize) {
// SHA256 HMAC hash of decompressed SWF, key are the last 32 bytes of the server handshake
byte[] swfHashKey = new byte[DIGEST_LENGTH];
System.arraycopy(handshakeMessage, Constants.HANDSHAKE_SIZE - DI... | java | public void calculateSwfVerification(byte[] handshakeMessage, byte[] swfHash, int swfSize) {
// SHA256 HMAC hash of decompressed SWF, key are the last 32 bytes of the server handshake
byte[] swfHashKey = new byte[DIGEST_LENGTH];
System.arraycopy(handshakeMessage, Constants.HANDSHAKE_SIZE - DI... | [
"public",
"void",
"calculateSwfVerification",
"(",
"byte",
"[",
"]",
"handshakeMessage",
",",
"byte",
"[",
"]",
"swfHash",
",",
"int",
"swfSize",
")",
"{",
"// SHA256 HMAC hash of decompressed SWF, key are the last 32 bytes of the server handshake\r",
"byte",
"[",
"]",
"s... | Calculates the swf verification token.
@param handshakeMessage servers handshake bytes
@param swfHash hash of swf
@param swfSize size of swf | [
"Calculates",
"the",
"swf",
"verification",
"token",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L400-L417 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.getDHOffset | public int getDHOffset(int algorithm, byte[] handshake, int bufferOffset) {
switch (algorithm) {
case 1:
return getDHOffset2(handshake, bufferOffset);
default:
case 0:
return getDHOffset1(handshake, bufferOffset);
}
} | java | public int getDHOffset(int algorithm, byte[] handshake, int bufferOffset) {
switch (algorithm) {
case 1:
return getDHOffset2(handshake, bufferOffset);
default:
case 0:
return getDHOffset1(handshake, bufferOffset);
}
} | [
"public",
"int",
"getDHOffset",
"(",
"int",
"algorithm",
",",
"byte",
"[",
"]",
"handshake",
",",
"int",
"bufferOffset",
")",
"{",
"switch",
"(",
"algorithm",
")",
"{",
"case",
"1",
":",
"return",
"getDHOffset2",
"(",
"handshake",
",",
"bufferOffset",
")",... | Returns the DH offset from an array of bytes.
@param algorithm validation algorithm
@param handshake handshake sequence
@param bufferOffset buffer offset
@return DH offset | [
"Returns",
"the",
"DH",
"offset",
"from",
"an",
"array",
"of",
"bytes",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L427-L435 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.getDigestOffset | public int getDigestOffset(int algorithm, byte[] handshake, int bufferOffset) {
switch (algorithm) {
case 1:
return getDigestOffset2(handshake, bufferOffset);
default:
case 0:
return getDigestOffset1(handshake, bufferOffset);
}
... | java | public int getDigestOffset(int algorithm, byte[] handshake, int bufferOffset) {
switch (algorithm) {
case 1:
return getDigestOffset2(handshake, bufferOffset);
default:
case 0:
return getDigestOffset1(handshake, bufferOffset);
}
... | [
"public",
"int",
"getDigestOffset",
"(",
"int",
"algorithm",
",",
"byte",
"[",
"]",
"handshake",
",",
"int",
"bufferOffset",
")",
"{",
"switch",
"(",
"algorithm",
")",
"{",
"case",
"1",
":",
"return",
"getDigestOffset2",
"(",
"handshake",
",",
"bufferOffset"... | Returns the digest offset using current validation scheme.
@param algorithm validation algorithm
@param handshake handshake sequence
@param bufferOffset buffer offset
@return digest offset | [
"Returns",
"the",
"digest",
"offset",
"using",
"current",
"validation",
"scheme",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L491-L499 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.validHandshakeType | public final static boolean validHandshakeType(byte handshakeType) {
switch (handshakeType) {
case RTMPConnection.RTMP_NON_ENCRYPTED:
case RTMPConnection.RTMP_ENCRYPTED:
case RTMPConnection.RTMP_ENCRYPTED_XTEA:
case RTMPConnection.RTMP_ENCRYPTED_BLOWFISH:
... | java | public final static boolean validHandshakeType(byte handshakeType) {
switch (handshakeType) {
case RTMPConnection.RTMP_NON_ENCRYPTED:
case RTMPConnection.RTMP_ENCRYPTED:
case RTMPConnection.RTMP_ENCRYPTED_XTEA:
case RTMPConnection.RTMP_ENCRYPTED_BLOWFISH:
... | [
"public",
"final",
"static",
"boolean",
"validHandshakeType",
"(",
"byte",
"handshakeType",
")",
"{",
"switch",
"(",
"handshakeType",
")",
"{",
"case",
"RTMPConnection",
".",
"RTMP_NON_ENCRYPTED",
":",
"case",
"RTMPConnection",
".",
"RTMP_ENCRYPTED",
":",
"case",
... | Returns whether or not a given handshake type is valid.
@param handshakeType the type of handshake
@return true if valid and supported, false otherwise | [
"Returns",
"whether",
"or",
"not",
"a",
"given",
"handshake",
"type",
"is",
"valid",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L597-L607 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.useEncryption | public boolean useEncryption() {
switch (handshakeType) {
case RTMPConnection.RTMP_ENCRYPTED:
case RTMPConnection.RTMP_ENCRYPTED_XTEA:
case RTMPConnection.RTMP_ENCRYPTED_BLOWFISH:
return true;
}
return false;
} | java | public boolean useEncryption() {
switch (handshakeType) {
case RTMPConnection.RTMP_ENCRYPTED:
case RTMPConnection.RTMP_ENCRYPTED_XTEA:
case RTMPConnection.RTMP_ENCRYPTED_BLOWFISH:
return true;
}
return false;
} | [
"public",
"boolean",
"useEncryption",
"(",
")",
"{",
"switch",
"(",
"handshakeType",
")",
"{",
"case",
"RTMPConnection",
".",
"RTMP_ENCRYPTED",
":",
"case",
"RTMPConnection",
".",
"RTMP_ENCRYPTED_XTEA",
":",
"case",
"RTMPConnection",
".",
"RTMP_ENCRYPTED_BLOWFISH",
... | Whether or not encryptions is in use.
@return true if handshake type is an encrypted type, false otherwise | [
"Whether",
"or",
"not",
"encryptions",
"is",
"in",
"use",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L614-L622 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.setHandshakeType | public void setHandshakeType(byte handshakeType) {
if (log.isTraceEnabled()) {
if (handshakeType < HANDSHAKE_TYPES.length) {
log.trace("Setting handshake type: {}", HANDSHAKE_TYPES[handshakeType]);
} else {
log.trace("Invalid handshake type: {}", hand... | java | public void setHandshakeType(byte handshakeType) {
if (log.isTraceEnabled()) {
if (handshakeType < HANDSHAKE_TYPES.length) {
log.trace("Setting handshake type: {}", HANDSHAKE_TYPES[handshakeType]);
} else {
log.trace("Invalid handshake type: {}", hand... | [
"public",
"void",
"setHandshakeType",
"(",
"byte",
"handshakeType",
")",
"{",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"if",
"(",
"handshakeType",
"<",
"HANDSHAKE_TYPES",
".",
"length",
")",
"{",
"log",
".",
"trace",
"(",
"\"Setting han... | Sets the handshake type. Currently only two types are supported, plain and encrypted.
@param handshakeType handshake type | [
"Sets",
"the",
"handshake",
"type",
".",
"Currently",
"only",
"two",
"types",
"are",
"supported",
"plain",
"and",
"encrypted",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L629-L638 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.addBuffer | public void addBuffer(IoBuffer in) {
byte[] tmp = new byte[in.remaining()];
in.get(tmp);
if (log.isDebugEnabled()) {
log.debug("addBuffer - pos: {} limit: {} remain: {}", buffer.position(), buffer.limit(), buffer.remaining());
}
if (buffer.remaining() == 0) {
... | java | public void addBuffer(IoBuffer in) {
byte[] tmp = new byte[in.remaining()];
in.get(tmp);
if (log.isDebugEnabled()) {
log.debug("addBuffer - pos: {} limit: {} remain: {}", buffer.position(), buffer.limit(), buffer.remaining());
}
if (buffer.remaining() == 0) {
... | [
"public",
"void",
"addBuffer",
"(",
"IoBuffer",
"in",
")",
"{",
"byte",
"[",
"]",
"tmp",
"=",
"new",
"byte",
"[",
"in",
".",
"remaining",
"(",
")",
"]",
";",
"in",
".",
"get",
"(",
"tmp",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
... | Add a IoBuffer to the buffer.
@param in incoming IoBuffer | [
"Add",
"a",
"IoBuffer",
"to",
"the",
"buffer",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L699-L709 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.getBuffer | public byte[] getBuffer() {
buffer.flip();
byte[] tmp = new byte[buffer.remaining()];
buffer.get(tmp);
buffer.clear();
return tmp;
} | java | public byte[] getBuffer() {
buffer.flip();
byte[] tmp = new byte[buffer.remaining()];
buffer.get(tmp);
buffer.clear();
return tmp;
} | [
"public",
"byte",
"[",
"]",
"getBuffer",
"(",
")",
"{",
"buffer",
".",
"flip",
"(",
")",
";",
"byte",
"[",
"]",
"tmp",
"=",
"new",
"byte",
"[",
"buffer",
".",
"remaining",
"(",
")",
"]",
";",
"buffer",
".",
"get",
"(",
"tmp",
")",
";",
"buffer"... | Returns buffered byte array.
@return bytes | [
"Returns",
"buffered",
"byte",
"array",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L725-L731 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/PlaylistSubscriberStream.java | PlaylistSubscriberStream.moveToNext | private void moveToNext() {
if (controller != null) {
currentItemIndex = controller.nextItem(this, currentItemIndex);
} else {
currentItemIndex = defaultController.nextItem(this, currentItemIndex);
}
} | java | private void moveToNext() {
if (controller != null) {
currentItemIndex = controller.nextItem(this, currentItemIndex);
} else {
currentItemIndex = defaultController.nextItem(this, currentItemIndex);
}
} | [
"private",
"void",
"moveToNext",
"(",
")",
"{",
"if",
"(",
"controller",
"!=",
"null",
")",
"{",
"currentItemIndex",
"=",
"controller",
".",
"nextItem",
"(",
"this",
",",
"currentItemIndex",
")",
";",
"}",
"else",
"{",
"currentItemIndex",
"=",
"defaultContro... | Move the current item to the next in list. | [
"Move",
"the",
"current",
"item",
"to",
"the",
"next",
"in",
"list",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlaylistSubscriberStream.java#L595-L601 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/PlaylistSubscriberStream.java | PlaylistSubscriberStream.moveToPrevious | private void moveToPrevious() {
if (controller != null) {
currentItemIndex = controller.previousItem(this, currentItemIndex);
} else {
currentItemIndex = defaultController.previousItem(this, currentItemIndex);
}
} | java | private void moveToPrevious() {
if (controller != null) {
currentItemIndex = controller.previousItem(this, currentItemIndex);
} else {
currentItemIndex = defaultController.previousItem(this, currentItemIndex);
}
} | [
"private",
"void",
"moveToPrevious",
"(",
")",
"{",
"if",
"(",
"controller",
"!=",
"null",
")",
"{",
"currentItemIndex",
"=",
"controller",
".",
"previousItem",
"(",
"this",
",",
"currentItemIndex",
")",
";",
"}",
"else",
"{",
"currentItemIndex",
"=",
"defau... | Move the current item to the previous in list. | [
"Move",
"the",
"current",
"item",
"to",
"the",
"previous",
"in",
"list",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlaylistSubscriberStream.java#L606-L612 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/VideoCodecFactory.java | VideoCodecFactory.getVideoCodec | public static IVideoStreamCodec getVideoCodec(IoBuffer data) {
IVideoStreamCodec result = null;
//get the codec identifying byte
int codecId = data.get() & 0x0f;
try {
switch (codecId) {
case 2: //sorenson
result = (IVideoStreamCode... | java | public static IVideoStreamCodec getVideoCodec(IoBuffer data) {
IVideoStreamCodec result = null;
//get the codec identifying byte
int codecId = data.get() & 0x0f;
try {
switch (codecId) {
case 2: //sorenson
result = (IVideoStreamCode... | [
"public",
"static",
"IVideoStreamCodec",
"getVideoCodec",
"(",
"IoBuffer",
"data",
")",
"{",
"IVideoStreamCodec",
"result",
"=",
"null",
";",
"//get the codec identifying byte\r",
"int",
"codecId",
"=",
"data",
".",
"get",
"(",
")",
"&",
"0x0f",
";",
"try",
"{",... | Create and return new video codec applicable for byte buffer data
@param data
Byte buffer data
@return Video codec | [
"Create",
"and",
"return",
"new",
"video",
"codec",
"applicable",
"for",
"byte",
"buffer",
"data"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/VideoCodecFactory.java#L68-L110 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/DefaultStreamFilenameGenerator.java | DefaultStreamFilenameGenerator.getStreamDirectory | private String getStreamDirectory(IScope scope) {
final StringBuilder result = new StringBuilder();
final IScope app = ScopeUtils.findApplication(scope);
final String prefix = "streams/";
while (scope != null && scope != app) {
result.insert(0, scope.getName() + "/");
... | java | private String getStreamDirectory(IScope scope) {
final StringBuilder result = new StringBuilder();
final IScope app = ScopeUtils.findApplication(scope);
final String prefix = "streams/";
while (scope != null && scope != app) {
result.insert(0, scope.getName() + "/");
... | [
"private",
"String",
"getStreamDirectory",
"(",
"IScope",
"scope",
")",
"{",
"final",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"IScope",
"app",
"=",
"ScopeUtils",
".",
"findApplication",
"(",
"scope",
")",
";",
"final",
... | Generate stream directory based on relative scope path. The base directory is
<pre>
streams
</pre>
, e.g. a scope
<pre>
/application/one/two/
</pre>
will generate a directory
<pre>
/streams/one/two/
</pre>
inside the application.
@param scope
Scope
@return Directory based on relative scope path | [
"Generate",
"stream",
"directory",
"based",
"on",
"relative",
"scope",
"path",
".",
"The",
"base",
"directory",
"is"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/DefaultStreamFilenameGenerator.java#L58-L72 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/status/StatusObjectService.java | StatusObjectService.cacheStatusObjects | public void cacheStatusObjects() {
cachedStatusObjects = new HashMap<String, byte[]>();
String statusCode;
IoBuffer out = IoBuffer.allocate(256);
out.setAutoExpand(true);
for (String s : statusObjects.keySet()) {
statusCode = s;
StatusObject s... | java | public void cacheStatusObjects() {
cachedStatusObjects = new HashMap<String, byte[]>();
String statusCode;
IoBuffer out = IoBuffer.allocate(256);
out.setAutoExpand(true);
for (String s : statusObjects.keySet()) {
statusCode = s;
StatusObject s... | [
"public",
"void",
"cacheStatusObjects",
"(",
")",
"{",
"cachedStatusObjects",
"=",
"new",
"HashMap",
"<",
"String",
",",
"byte",
"[",
"]",
">",
"(",
")",
";",
"String",
"statusCode",
";",
"IoBuffer",
"out",
"=",
"IoBuffer",
".",
"allocate",
"(",
"256",
"... | Cache status objects | [
"Cache",
"status",
"objects"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/status/StatusObjectService.java#L122-L148 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/status/StatusObjectService.java | StatusObjectService.serializeStatusObject | public void serializeStatusObject(IoBuffer out, StatusObject statusObject) {
Map<?, ?> statusMap = new BeanMap(statusObject);
Output output = new Output(out);
Serializer.serialize(output, statusMap);
} | java | public void serializeStatusObject(IoBuffer out, StatusObject statusObject) {
Map<?, ?> statusMap = new BeanMap(statusObject);
Output output = new Output(out);
Serializer.serialize(output, statusMap);
} | [
"public",
"void",
"serializeStatusObject",
"(",
"IoBuffer",
"out",
",",
"StatusObject",
"statusObject",
")",
"{",
"Map",
"<",
"?",
",",
"?",
">",
"statusMap",
"=",
"new",
"BeanMap",
"(",
"statusObject",
")",
";",
"Output",
"output",
"=",
"new",
"Output",
"... | Serializes status object
@param out
Byte buffer for output object
@param statusObject
Status object to serialize | [
"Serializes",
"status",
"object"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/status/StatusObjectService.java#L158-L162 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/ReceivedMessageTask.java | ReceivedMessageTask.runDeadlockFuture | @SuppressWarnings("unchecked")
public void runDeadlockFuture(Runnable deadlockGuardTask) {
if (deadlockFuture == null) {
ThreadPoolTaskScheduler deadlockGuard = conn.getDeadlockGuardScheduler();
if (deadlockGuard != null) {
try {
deadlockFutu... | java | @SuppressWarnings("unchecked")
public void runDeadlockFuture(Runnable deadlockGuardTask) {
if (deadlockFuture == null) {
ThreadPoolTaskScheduler deadlockGuard = conn.getDeadlockGuardScheduler();
if (deadlockGuard != null) {
try {
deadlockFutu... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"runDeadlockFuture",
"(",
"Runnable",
"deadlockGuardTask",
")",
"{",
"if",
"(",
"deadlockFuture",
"==",
"null",
")",
"{",
"ThreadPoolTaskScheduler",
"deadlockGuard",
"=",
"conn",
".",
"getDeadlock... | Runs deadlock guard task
@param deadlockGuardTask
deadlock guard task | [
"Runs",
"deadlock",
"guard",
"task"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/ReceivedMessageTask.java#L91-L107 | train |
Red5/red5-server-common | src/main/java/org/red5/server/api/stream/support/DynamicPlayItem.java | DynamicPlayItem.build | public static DynamicPlayItem build(String name, long start, long length) {
DynamicPlayItem playItem = new DynamicPlayItem(name, start, length);
return playItem;
} | java | public static DynamicPlayItem build(String name, long start, long length) {
DynamicPlayItem playItem = new DynamicPlayItem(name, start, length);
return playItem;
} | [
"public",
"static",
"DynamicPlayItem",
"build",
"(",
"String",
"name",
",",
"long",
"start",
",",
"long",
"length",
")",
"{",
"DynamicPlayItem",
"playItem",
"=",
"new",
"DynamicPlayItem",
"(",
"name",
",",
"start",
",",
"length",
")",
";",
"return",
"playIte... | Builder for DynamicPlayItem
@param name
name
@param start
start
@param length
length
@return play item instance | [
"Builder",
"for",
"DynamicPlayItem"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/api/stream/support/DynamicPlayItem.java#L186-L189 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/AbstractStream.java | AbstractStream.getMetaData | public Notify getMetaData() {
Notify md = metaData.get();
if (md != null) {
try {
return md.duplicate();
} catch (Exception e) {
}
}
return md;
} | java | public Notify getMetaData() {
Notify md = metaData.get();
if (md != null) {
try {
return md.duplicate();
} catch (Exception e) {
}
}
return md;
} | [
"public",
"Notify",
"getMetaData",
"(",
")",
"{",
"Notify",
"md",
"=",
"metaData",
".",
"get",
"(",
")",
";",
"if",
"(",
"md",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"md",
".",
"duplicate",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e... | Returns a copy of the metadata for the associated stream, if it exists.
@return stream meta data | [
"Returns",
"a",
"copy",
"of",
"the",
"metadata",
"for",
"the",
"associated",
"stream",
"if",
"it",
"exists",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/AbstractStream.java#L143-L152 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/AbstractStream.java | AbstractStream.setState | public void setState(StreamState newState) {
StreamState oldState = state.get();
if (!oldState.equals(newState) && state.compareAndSet(oldState, newState)) {
fireStateChange(oldState, newState);
}
} | java | public void setState(StreamState newState) {
StreamState oldState = state.get();
if (!oldState.equals(newState) && state.compareAndSet(oldState, newState)) {
fireStateChange(oldState, newState);
}
} | [
"public",
"void",
"setState",
"(",
"StreamState",
"newState",
")",
"{",
"StreamState",
"oldState",
"=",
"state",
".",
"get",
"(",
")",
";",
"if",
"(",
"!",
"oldState",
".",
"equals",
"(",
"newState",
")",
"&&",
"state",
".",
"compareAndSet",
"(",
"oldSta... | Sets the stream state.
@param newState stream state | [
"Sets",
"the",
"stream",
"state",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/AbstractStream.java#L235-L240 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/AbstractStream.java | AbstractStream.getStreamAwareHandler | protected IStreamAwareScopeHandler getStreamAwareHandler() {
if (scope != null) {
IScopeHandler handler = scope.getHandler();
if (handler instanceof IStreamAwareScopeHandler) {
return (IStreamAwareScopeHandler) handler;
}
}
return null;
... | java | protected IStreamAwareScopeHandler getStreamAwareHandler() {
if (scope != null) {
IScopeHandler handler = scope.getHandler();
if (handler instanceof IStreamAwareScopeHandler) {
return (IStreamAwareScopeHandler) handler;
}
}
return null;
... | [
"protected",
"IStreamAwareScopeHandler",
"getStreamAwareHandler",
"(",
")",
"{",
"if",
"(",
"scope",
"!=",
"null",
")",
"{",
"IScopeHandler",
"handler",
"=",
"scope",
".",
"getHandler",
"(",
")",
";",
"if",
"(",
"handler",
"instanceof",
"IStreamAwareScopeHandler",... | Return stream aware scope handler or null if scope is null.
@return IStreamAwareScopeHandler implementation | [
"Return",
"stream",
"aware",
"scope",
"handler",
"or",
"null",
"if",
"scope",
"is",
"null",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/AbstractStream.java#L247-L255 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.encode | public IoBuffer encode(Object message) throws Exception {
if (message != null) {
try {
return encodePacket((Packet) message);
} catch (Exception e) {
log.error("Error encoding", e);
}
} else if (log.isDebugEnabled()) {
... | java | public IoBuffer encode(Object message) throws Exception {
if (message != null) {
try {
return encodePacket((Packet) message);
} catch (Exception e) {
log.error("Error encoding", e);
}
} else if (log.isDebugEnabled()) {
... | [
"public",
"IoBuffer",
"encode",
"(",
"Object",
"message",
")",
"throws",
"Exception",
"{",
"if",
"(",
"message",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"encodePacket",
"(",
"(",
"Packet",
")",
"message",
")",
";",
"}",
"catch",
"(",
"Exception",
... | Encodes object with given protocol state to byte buffer
@param message
Object to encode
@return IoBuffer with encoded data
@throws Exception
Any decoding exception | [
"Encodes",
"object",
"with",
"given",
"protocol",
"state",
"to",
"byte",
"buffer"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L108-L124 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.encodePacket | public IoBuffer encodePacket(Packet packet) {
IoBuffer out = null;
Header header = packet.getHeader();
int channelId = header.getChannelId();
//log.trace("Channel id: {}", channelId);
IRTMPEvent message = packet.getMessage();
if (message instanceof ChunkSize) {
... | java | public IoBuffer encodePacket(Packet packet) {
IoBuffer out = null;
Header header = packet.getHeader();
int channelId = header.getChannelId();
//log.trace("Channel id: {}", channelId);
IRTMPEvent message = packet.getMessage();
if (message instanceof ChunkSize) {
... | [
"public",
"IoBuffer",
"encodePacket",
"(",
"Packet",
"packet",
")",
"{",
"IoBuffer",
"out",
"=",
"null",
";",
"Header",
"header",
"=",
"packet",
".",
"getHeader",
"(",
")",
";",
"int",
"channelId",
"=",
"header",
".",
"getChannelId",
"(",
")",
";",
"//lo... | Encode packet.
@param packet
RTMP packet
@return Encoded data | [
"Encode",
"packet",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L133-L201 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.getHeaderType | private byte getHeaderType(final Header header, final Header lastHeader) {
//int lastFullTs = ((RTMPConnection) Red5.getConnectionLocal()).getState().getLastFullTimestampWritten(header.getChannelId());
if (lastHeader == null || header.getStreamId() != lastHeader.getStreamId() || header.getTimer() < la... | java | private byte getHeaderType(final Header header, final Header lastHeader) {
//int lastFullTs = ((RTMPConnection) Red5.getConnectionLocal()).getState().getLastFullTimestampWritten(header.getChannelId());
if (lastHeader == null || header.getStreamId() != lastHeader.getStreamId() || header.getTimer() < la... | [
"private",
"byte",
"getHeaderType",
"(",
"final",
"Header",
"header",
",",
"final",
"Header",
"lastHeader",
")",
"{",
"//int lastFullTs = ((RTMPConnection) Red5.getConnectionLocal()).getState().getLastFullTimestampWritten(header.getChannelId());\r",
"if",
"(",
"lastHeader",
"==",
... | Determine type of header to use.
@param header RTMP message header
@param lastHeader Previous header
@return Header type to use | [
"Determine",
"type",
"of",
"header",
"to",
"use",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L356-L370 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.calculateHeaderSize | private int calculateHeaderSize(final Header header, final Header lastHeader) {
final byte headerType = getHeaderType(header, lastHeader);
int channelIdAdd = 0;
int channelId = header.getChannelId();
if (channelId > 320) {
channelIdAdd = 2;
} else if (channelId ... | java | private int calculateHeaderSize(final Header header, final Header lastHeader) {
final byte headerType = getHeaderType(header, lastHeader);
int channelIdAdd = 0;
int channelId = header.getChannelId();
if (channelId > 320) {
channelIdAdd = 2;
} else if (channelId ... | [
"private",
"int",
"calculateHeaderSize",
"(",
"final",
"Header",
"header",
",",
"final",
"Header",
"lastHeader",
")",
"{",
"final",
"byte",
"headerType",
"=",
"getHeaderType",
"(",
"header",
",",
"lastHeader",
")",
";",
"int",
"channelIdAdd",
"=",
"0",
";",
... | Calculate number of bytes necessary to encode the header.
@param header
RTMP message header
@param lastHeader
Previous header
@return Calculated size | [
"Calculate",
"number",
"of",
"bytes",
"necessary",
"to",
"encode",
"the",
"header",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L381-L391 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.encodeHeader | public IoBuffer encodeHeader(Header header, Header lastHeader) {
final IoBuffer result = IoBuffer.allocate(calculateHeaderSize(header, lastHeader));
encodeHeader(header, lastHeader, result);
return result;
} | java | public IoBuffer encodeHeader(Header header, Header lastHeader) {
final IoBuffer result = IoBuffer.allocate(calculateHeaderSize(header, lastHeader));
encodeHeader(header, lastHeader, result);
return result;
} | [
"public",
"IoBuffer",
"encodeHeader",
"(",
"Header",
"header",
",",
"Header",
"lastHeader",
")",
"{",
"final",
"IoBuffer",
"result",
"=",
"IoBuffer",
".",
"allocate",
"(",
"calculateHeaderSize",
"(",
"header",
",",
"lastHeader",
")",
")",
";",
"encodeHeader",
... | Encode RTMP header.
@param header
RTMP message header
@param lastHeader
Previous header
@return Encoded header data | [
"Encode",
"RTMP",
"header",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L402-L406 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.encodeHeader | public void encodeHeader(Header header, Header lastHeader, IoBuffer buf) {
byte headerType = getHeaderType(header, lastHeader);
RTMPUtils.encodeHeaderByte(buf, headerType, header.getChannelId());
if (log.isTraceEnabled()) {
log.trace("{} lastHeader: {}", Header.HeaderType.values(... | java | public void encodeHeader(Header header, Header lastHeader, IoBuffer buf) {
byte headerType = getHeaderType(header, lastHeader);
RTMPUtils.encodeHeaderByte(buf, headerType, header.getChannelId());
if (log.isTraceEnabled()) {
log.trace("{} lastHeader: {}", Header.HeaderType.values(... | [
"public",
"void",
"encodeHeader",
"(",
"Header",
"header",
",",
"Header",
"lastHeader",
",",
"IoBuffer",
"buf",
")",
"{",
"byte",
"headerType",
"=",
"getHeaderType",
"(",
"header",
",",
"lastHeader",
")",
";",
"RTMPUtils",
".",
"encodeHeaderByte",
"(",
"buf",
... | Encode RTMP header into given IoBuffer.
@param header RTMP message header
@param lastHeader Previous header
@param buf Buffer for writing encoded header into | [
"Encode",
"RTMP",
"header",
"into",
"given",
"IoBuffer",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L415-L502 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.encodeServerBW | private IoBuffer encodeServerBW(ServerBW serverBW) {
final IoBuffer out = IoBuffer.allocate(4);
out.putInt(serverBW.getBandwidth());
return out;
} | java | private IoBuffer encodeServerBW(ServerBW serverBW) {
final IoBuffer out = IoBuffer.allocate(4);
out.putInt(serverBW.getBandwidth());
return out;
} | [
"private",
"IoBuffer",
"encodeServerBW",
"(",
"ServerBW",
"serverBW",
")",
"{",
"final",
"IoBuffer",
"out",
"=",
"IoBuffer",
".",
"allocate",
"(",
"4",
")",
";",
"out",
".",
"putInt",
"(",
"serverBW",
".",
"getBandwidth",
"(",
")",
")",
";",
"return",
"o... | Encode server-side bandwidth event.
@param serverBW
Server-side bandwidth event
@return Encoded event data | [
"Encode",
"server",
"-",
"side",
"bandwidth",
"event",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L605-L609 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.encodeClientBW | private IoBuffer encodeClientBW(ClientBW clientBW) {
final IoBuffer out = IoBuffer.allocate(5);
out.putInt(clientBW.getBandwidth());
out.put(clientBW.getLimitType());
return out;
} | java | private IoBuffer encodeClientBW(ClientBW clientBW) {
final IoBuffer out = IoBuffer.allocate(5);
out.putInt(clientBW.getBandwidth());
out.put(clientBW.getLimitType());
return out;
} | [
"private",
"IoBuffer",
"encodeClientBW",
"(",
"ClientBW",
"clientBW",
")",
"{",
"final",
"IoBuffer",
"out",
"=",
"IoBuffer",
".",
"allocate",
"(",
"5",
")",
";",
"out",
".",
"putInt",
"(",
"clientBW",
".",
"getBandwidth",
"(",
")",
")",
";",
"out",
".",
... | Encode client-side bandwidth event.
@param clientBW
Client-side bandwidth event
@return Encoded event data | [
"Encode",
"client",
"-",
"side",
"bandwidth",
"event",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L618-L623 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.encodeCommand | protected IoBuffer encodeCommand(Notify invoke) {
IoBuffer out = IoBuffer.allocate(1024);
out.setAutoExpand(true);
encodeCommand(out, invoke);
return out;
} | java | protected IoBuffer encodeCommand(Notify invoke) {
IoBuffer out = IoBuffer.allocate(1024);
out.setAutoExpand(true);
encodeCommand(out, invoke);
return out;
} | [
"protected",
"IoBuffer",
"encodeCommand",
"(",
"Notify",
"invoke",
")",
"{",
"IoBuffer",
"out",
"=",
"IoBuffer",
".",
"allocate",
"(",
"1024",
")",
";",
"out",
".",
"setAutoExpand",
"(",
"true",
")",
";",
"encodeCommand",
"(",
"out",
",",
"invoke",
")",
... | Encode notification event.
@param invoke
Notification event
@return Encoded event data | [
"Encode",
"notification",
"event",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L801-L806 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.generateErrorResult | protected StatusObject generateErrorResult(String code, Throwable error) {
// Construct error object to return
String message = "";
while (error != null && error.getCause() != null) {
error = error.getCause();
}
if (error != null && error.getMessage() != null) {... | java | protected StatusObject generateErrorResult(String code, Throwable error) {
// Construct error object to return
String message = "";
while (error != null && error.getCause() != null) {
error = error.getCause();
}
if (error != null && error.getMessage() != null) {... | [
"protected",
"StatusObject",
"generateErrorResult",
"(",
"String",
"code",
",",
"Throwable",
"error",
")",
"{",
"// Construct error object to return\r",
"String",
"message",
"=",
"\"\"",
";",
"while",
"(",
"error",
"!=",
"null",
"&&",
"error",
".",
"getCause",
"("... | Generate error object to return for given exception.
@param code
call
@param error
error
@return status object | [
"Generate",
"error",
"object",
"to",
"return",
"for",
"given",
"exception",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L976-L1005 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.encodeFlexMessage | public IoBuffer encodeFlexMessage(FlexMessage msg) {
IoBuffer out = IoBuffer.allocate(1024);
out.setAutoExpand(true);
// Unknown byte, always 0?
out.put((byte) 0);
encodeCommand(out, msg);
return out;
} | java | public IoBuffer encodeFlexMessage(FlexMessage msg) {
IoBuffer out = IoBuffer.allocate(1024);
out.setAutoExpand(true);
// Unknown byte, always 0?
out.put((byte) 0);
encodeCommand(out, msg);
return out;
} | [
"public",
"IoBuffer",
"encodeFlexMessage",
"(",
"FlexMessage",
"msg",
")",
"{",
"IoBuffer",
"out",
"=",
"IoBuffer",
".",
"allocate",
"(",
"1024",
")",
";",
"out",
".",
"setAutoExpand",
"(",
"true",
")",
";",
"// Unknown byte, always 0?\r",
"out",
".",
"put",
... | Encodes Flex message event.
@param msg
Flex message event
@return Encoded data | [
"Encodes",
"Flex",
"message",
"event",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L1014-L1021 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/bandwidth/ServerClientDetection.java | ServerClientDetection.resultReceived | public void resultReceived(IPendingServiceCall call) {
// if we aren't connection, skip any further testing
if (Call.STATUS_NOT_CONNECTED != call.getStatus()) {
// receive time using nanos
long now = System.nanoTime();
// increment received
int received = ... | java | public void resultReceived(IPendingServiceCall call) {
// if we aren't connection, skip any further testing
if (Call.STATUS_NOT_CONNECTED != call.getStatus()) {
// receive time using nanos
long now = System.nanoTime();
// increment received
int received = ... | [
"public",
"void",
"resultReceived",
"(",
"IPendingServiceCall",
"call",
")",
"{",
"// if we aren't connection, skip any further testing",
"if",
"(",
"Call",
".",
"STATUS_NOT_CONNECTED",
"!=",
"call",
".",
"getStatus",
"(",
")",
")",
"{",
"// receive time using nanos",
"... | Handle callback from service call. | [
"Handle",
"callback",
"from",
"service",
"call",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/bandwidth/ServerClientDetection.java#L106-L154 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/message/Packet.java | Packet.setData | public void setData(IoBuffer buffer) {
if (noCopy) {
log.trace("Using buffer reference");
this.data = buffer;
} else {
// try the backing array first if it exists
if (buffer.hasArray()) {
log.trace("Buffer has backing array, making a... | java | public void setData(IoBuffer buffer) {
if (noCopy) {
log.trace("Using buffer reference");
this.data = buffer;
} else {
// try the backing array first if it exists
if (buffer.hasArray()) {
log.trace("Buffer has backing array, making a... | [
"public",
"void",
"setData",
"(",
"IoBuffer",
"buffer",
")",
"{",
"if",
"(",
"noCopy",
")",
"{",
"log",
".",
"trace",
"(",
"\"Using buffer reference\"",
")",
";",
"this",
".",
"data",
"=",
"buffer",
";",
"}",
"else",
"{",
"// try the backing array first if i... | Setter for data
@param buffer
Packet data | [
"Setter",
"for",
"data"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/message/Packet.java#L136-L155 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/message/SharedObjectTypeMapping.java | SharedObjectTypeMapping.toByte | public static byte toByte(Type type) {
switch (type) {
case SERVER_CONNECT:
return 0x01;
case SERVER_DISCONNECT:
return 0x02;
case SERVER_SET_ATTRIBUTE:
return 0x03;
case CLIENT_UPDATE_DATA:
... | java | public static byte toByte(Type type) {
switch (type) {
case SERVER_CONNECT:
return 0x01;
case SERVER_DISCONNECT:
return 0x02;
case SERVER_SET_ATTRIBUTE:
return 0x03;
case CLIENT_UPDATE_DATA:
... | [
"public",
"static",
"byte",
"toByte",
"(",
"Type",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"SERVER_CONNECT",
":",
"return",
"0x01",
";",
"case",
"SERVER_DISCONNECT",
":",
"return",
"0x02",
";",
"case",
"SERVER_SET_ATTRIBUTE",
":",
"return"... | Convert SO event type to byte representation that RTMP uses
@param type
Event type
@return Byte representation of given event type | [
"Convert",
"SO",
"event",
"type",
"to",
"byte",
"representation",
"that",
"RTMP",
"uses"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/message/SharedObjectTypeMapping.java#L66-L96 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/consumer/ConnectionConsumer.java | ConnectionConsumer.sendChunkSize | private void sendChunkSize() {
if (chunkSizeSent.compareAndSet(false, true)) {
log.debug("Sending chunk size: {}", chunkSize);
ChunkSize chunkSizeMsg = new ChunkSize(chunkSize);
conn.getChannel((byte) 2).write(chunkSizeMsg);
}
} | java | private void sendChunkSize() {
if (chunkSizeSent.compareAndSet(false, true)) {
log.debug("Sending chunk size: {}", chunkSize);
ChunkSize chunkSizeMsg = new ChunkSize(chunkSize);
conn.getChannel((byte) 2).write(chunkSizeMsg);
}
} | [
"private",
"void",
"sendChunkSize",
"(",
")",
"{",
"if",
"(",
"chunkSizeSent",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Sending chunk size: {}\"",
",",
"chunkSize",
")",
";",
"ChunkSize",
"chunkSizeMsg",
"=... | Send the chunk size | [
"Send",
"the",
"chunk",
"size"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/consumer/ConnectionConsumer.java#L284-L290 | train |
Red5/red5-server-common | src/main/java/org/red5/server/stream/consumer/ConnectionConsumer.java | ConnectionConsumer.closeChannels | private void closeChannels() {
conn.closeChannel(video.getId());
conn.closeChannel(audio.getId());
conn.closeChannel(data.getId());
} | java | private void closeChannels() {
conn.closeChannel(video.getId());
conn.closeChannel(audio.getId());
conn.closeChannel(data.getId());
} | [
"private",
"void",
"closeChannels",
"(",
")",
"{",
"conn",
".",
"closeChannel",
"(",
"video",
".",
"getId",
"(",
")",
")",
";",
"conn",
".",
"closeChannel",
"(",
"audio",
".",
"getId",
"(",
")",
")",
";",
"conn",
".",
"closeChannel",
"(",
"data",
"."... | Close all the channels | [
"Close",
"all",
"the",
"channels"
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/consumer/ConnectionConsumer.java#L295-L299 | train |
Red5/red5-server-common | src/main/java/org/red5/server/net/servlet/ServletUtils.java | ServletUtils.copy | public static void copy(HttpServletRequest req, OutputStream output) throws IOException {
InputStream input = req.getInputStream();
int availableBytes = req.getContentLength();
log.debug("copy - available: {}", availableBytes);
if (availableBytes > 0) {
byte[] buf = new ... | java | public static void copy(HttpServletRequest req, OutputStream output) throws IOException {
InputStream input = req.getInputStream();
int availableBytes = req.getContentLength();
log.debug("copy - available: {}", availableBytes);
if (availableBytes > 0) {
byte[] buf = new ... | [
"public",
"static",
"void",
"copy",
"(",
"HttpServletRequest",
"req",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"InputStream",
"input",
"=",
"req",
".",
"getInputStream",
"(",
")",
";",
"int",
"availableBytes",
"=",
"req",
".",
"getCont... | Copies information from the http request to the output stream using the specified content length.
@param req
Request
@param output
Output stream
@throws java.io.IOException
on error | [
"Copies",
"information",
"from",
"the",
"http",
"request",
"to",
"the",
"output",
"stream",
"using",
"the",
"specified",
"content",
"length",
"."
] | 39ae73710c25bda86d70b13ef37ae707962217b9 | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/servlet/ServletUtils.java#L110-L126 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.