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/net/servlet/ServletUtils.java
ServletUtils.getRemoteAddresses
public static List<String> getRemoteAddresses(HttpServletRequest request) { List<String> addresses = new ArrayList<String>(); addresses.add(request.getRemoteHost()); if (!request.getRemoteAddr().equals(request.getRemoteHost())) { // Store both remote host and remote address addresses.add(request.getRemoteAddr()); } final String forwardedFor = request.getHeader("X-Forwarded-For"); if (forwardedFor != null) { // Also store address this request was forwarded for. final String[] parts = forwardedFor.split(","); for (String part : parts) { addresses.add(part); } } final String httpVia = request.getHeader("Via"); if (httpVia != null) { // Also store address this request was forwarded for. final String[] parts = httpVia.split(","); for (String part : parts) { addresses.add(part); } } return Collections.unmodifiableList(addresses); }
java
public static List<String> getRemoteAddresses(HttpServletRequest request) { List<String> addresses = new ArrayList<String>(); addresses.add(request.getRemoteHost()); if (!request.getRemoteAddr().equals(request.getRemoteHost())) { // Store both remote host and remote address addresses.add(request.getRemoteAddr()); } final String forwardedFor = request.getHeader("X-Forwarded-For"); if (forwardedFor != null) { // Also store address this request was forwarded for. final String[] parts = forwardedFor.split(","); for (String part : parts) { addresses.add(part); } } final String httpVia = request.getHeader("Via"); if (httpVia != null) { // Also store address this request was forwarded for. final String[] parts = httpVia.split(","); for (String part : parts) { addresses.add(part); } } return Collections.unmodifiableList(addresses); }
[ "public", "static", "List", "<", "String", ">", "getRemoteAddresses", "(", "HttpServletRequest", "request", ")", "{", "List", "<", "String", ">", "addresses", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "addresses", ".", "add", "(", "reques...
Return all remote addresses that were involved in the passed request. @param request request @return remote addresses
[ "Return", "all", "remote", "addresses", "that", "were", "involved", "in", "the", "passed", "request", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/servlet/ServletUtils.java#L165-L189
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/event/Invoke.java
Invoke.duplicate
@Override public Invoke duplicate() throws IOException, ClassNotFoundException { Invoke result = new Invoke(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); writeExternal(oos); oos.close(); byte[] buf = baos.toByteArray(); baos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(buf); ObjectInputStream ois = new ObjectInputStream(bais); result.readExternal(ois); ois.close(); bais.close(); return result; }
java
@Override public Invoke duplicate() throws IOException, ClassNotFoundException { Invoke result = new Invoke(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); writeExternal(oos); oos.close(); byte[] buf = baos.toByteArray(); baos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(buf); ObjectInputStream ois = new ObjectInputStream(bais); result.readExternal(ois); ois.close(); bais.close(); return result; }
[ "@", "Override", "public", "Invoke", "duplicate", "(", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "Invoke", "result", "=", "new", "Invoke", "(", ")", ";", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";",...
Duplicate this Invoke message to future injection. Serialize to memory and deserialize, safe way. @return duplicated Invoke event
[ "Duplicate", "this", "Invoke", "message", "to", "future", "injection", ".", "Serialize", "to", "memory", "and", "deserialize", "safe", "way", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/event/Invoke.java#L104-L119
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/ReceivedMessageTaskQueue.java
ReceivedMessageTaskQueue.addTask
public void addTask(ReceivedMessageTask task) { tasks.add(task); Packet packet = task.getPacket(); // don't run the deadlock guard if timeout is <= 0 if (packet.getExpirationTime() > 0L) { // run a deadlock guard so hanging tasks will be interrupted task.runDeadlockFuture(new DeadlockGuard(task)); } if (listener != null) { listener.onTaskAdded(this); } }
java
public void addTask(ReceivedMessageTask task) { tasks.add(task); Packet packet = task.getPacket(); // don't run the deadlock guard if timeout is <= 0 if (packet.getExpirationTime() > 0L) { // run a deadlock guard so hanging tasks will be interrupted task.runDeadlockFuture(new DeadlockGuard(task)); } if (listener != null) { listener.onTaskAdded(this); } }
[ "public", "void", "addTask", "(", "ReceivedMessageTask", "task", ")", "{", "tasks", ".", "add", "(", "task", ")", ";", "Packet", "packet", "=", "task", ".", "getPacket", "(", ")", ";", "// don't run the deadlock guard if timeout is <= 0", "if", "(", "packet", ...
Adds new task to the end of the queue. @param task received message task
[ "Adds", "new", "task", "to", "the", "end", "of", "the", "queue", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/ReceivedMessageTaskQueue.java#L63-L74
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/ReceivedMessageTaskQueue.java
ReceivedMessageTaskQueue.removeTask
public void removeTask(ReceivedMessageTask task) { if (tasks.remove(task)) { task.cancelDeadlockFuture(); if (listener != null) { listener.onTaskRemoved(this); } } }
java
public void removeTask(ReceivedMessageTask task) { if (tasks.remove(task)) { task.cancelDeadlockFuture(); if (listener != null) { listener.onTaskRemoved(this); } } }
[ "public", "void", "removeTask", "(", "ReceivedMessageTask", "task", ")", "{", "if", "(", "tasks", ".", "remove", "(", "task", ")", ")", "{", "task", ".", "cancelDeadlockFuture", "(", ")", ";", "if", "(", "listener", "!=", "null", ")", "{", "listener", ...
Removes the specified task from the queue. @param task received message task
[ "Removes", "the", "specified", "task", "from", "the", "queue", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/ReceivedMessageTaskQueue.java#L82-L89
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/ReceivedMessageTaskQueue.java
ReceivedMessageTaskQueue.getTaskToProcess
public ReceivedMessageTask getTaskToProcess() { ReceivedMessageTask task = tasks.peek(); if (task != null && task.setProcessing()) { return task; } return null; }
java
public ReceivedMessageTask getTaskToProcess() { ReceivedMessageTask task = tasks.peek(); if (task != null && task.setProcessing()) { return task; } return null; }
[ "public", "ReceivedMessageTask", "getTaskToProcess", "(", ")", "{", "ReceivedMessageTask", "task", "=", "tasks", ".", "peek", "(", ")", ";", "if", "(", "task", "!=", "null", "&&", "task", ".", "setProcessing", "(", ")", ")", "{", "return", "task", ";", "...
Gets first task from queue if it can be processed. If first task is already in process it returns null. @return task that can be processed or null otherwise
[ "Gets", "first", "task", "from", "queue", "if", "it", "can", "be", "processed", ".", "If", "first", "task", "is", "already", "in", "process", "it", "returns", "null", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/ReceivedMessageTaskQueue.java#L96-L102
train
Red5/red5-server-common
src/main/java/org/red5/server/api/stream/support/SimplePlayItem.java
SimplePlayItem.build
public static SimplePlayItem build(String name, long start, long length) { SimplePlayItem playItem = new SimplePlayItem(name, start, length); return playItem; }
java
public static SimplePlayItem build(String name, long start, long length) { SimplePlayItem playItem = new SimplePlayItem(name, start, length); return playItem; }
[ "public", "static", "SimplePlayItem", "build", "(", "String", "name", ",", "long", "start", ",", "long", "length", ")", "{", "SimplePlayItem", "playItem", "=", "new", "SimplePlayItem", "(", "name", ",", "start", ",", "length", ")", ";", "return", "playItem",...
Builder for SimplePlayItem @param name name @param start start @param length length @return play item instance
[ "Builder", "for", "SimplePlayItem" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/api/stream/support/SimplePlayItem.java#L192-L195
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/BaseRTMPHandler.java
BaseRTMPHandler.getHostname
protected String getHostname(String url) { if (log.isDebugEnabled()) { log.debug("getHostname - url: {}", url); } String[] parts = url.split("/"); if (parts.length == 2) { return ""; } else { String host = parts[2]; // strip out default port in case the client added the port explicitly if (host.endsWith(":1935")) { // remove default port from connection string return host.substring(0, host.length() - 5); } return host; } }
java
protected String getHostname(String url) { if (log.isDebugEnabled()) { log.debug("getHostname - url: {}", url); } String[] parts = url.split("/"); if (parts.length == 2) { return ""; } else { String host = parts[2]; // strip out default port in case the client added the port explicitly if (host.endsWith(":1935")) { // remove default port from connection string return host.substring(0, host.length() - 5); } return host; } }
[ "protected", "String", "getHostname", "(", "String", "url", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"getHostname - url: {}\"", ",", "url", ")", ";", "}", "String", "[", "]", "parts", "=", "url"...
Return hostname for URL. @param url URL @return Hostname from that URL
[ "Return", "hostname", "for", "URL", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/BaseRTMPHandler.java#L208-L224
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/BaseRTMPHandler.java
BaseRTMPHandler.handlePendingCallResult
protected void handlePendingCallResult(RTMPConnection conn, Invoke invoke) { final IServiceCall call = invoke.getCall(); final IPendingServiceCall pendingCall = conn.retrievePendingCall(invoke.getTransactionId()); if (pendingCall != null) { // The client sent a response to a previously made call. Object[] args = call.getArguments(); if (args != null && args.length > 0) { // TODO: can a client return multiple results? pendingCall.setResult(args[0]); } Set<IPendingServiceCallback> callbacks = pendingCall.getCallbacks(); if (!callbacks.isEmpty()) { HashSet<IPendingServiceCallback> tmp = new HashSet<>(); tmp.addAll(callbacks); for (IPendingServiceCallback callback : tmp) { try { callback.resultReceived(pendingCall); } catch (Exception e) { log.error("Error while executing callback {}", callback, e); } } } } }
java
protected void handlePendingCallResult(RTMPConnection conn, Invoke invoke) { final IServiceCall call = invoke.getCall(); final IPendingServiceCall pendingCall = conn.retrievePendingCall(invoke.getTransactionId()); if (pendingCall != null) { // The client sent a response to a previously made call. Object[] args = call.getArguments(); if (args != null && args.length > 0) { // TODO: can a client return multiple results? pendingCall.setResult(args[0]); } Set<IPendingServiceCallback> callbacks = pendingCall.getCallbacks(); if (!callbacks.isEmpty()) { HashSet<IPendingServiceCallback> tmp = new HashSet<>(); tmp.addAll(callbacks); for (IPendingServiceCallback callback : tmp) { try { callback.resultReceived(pendingCall); } catch (Exception e) { log.error("Error while executing callback {}", callback, e); } } } } }
[ "protected", "void", "handlePendingCallResult", "(", "RTMPConnection", "conn", ",", "Invoke", "invoke", ")", "{", "final", "IServiceCall", "call", "=", "invoke", ".", "getCall", "(", ")", ";", "final", "IPendingServiceCall", "pendingCall", "=", "conn", ".", "ret...
Handler for pending call result. Dispatches results to all pending call handlers. @param conn Connection @param invoke Pending call result event context
[ "Handler", "for", "pending", "call", "result", ".", "Dispatches", "results", "to", "all", "pending", "call", "handlers", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/BaseRTMPHandler.java#L234-L257
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/BaseRTMPHandler.java
BaseRTMPHandler.onStreamBytesRead
protected void onStreamBytesRead(RTMPConnection conn, Channel channel, Header source, BytesRead streamBytesRead) { conn.receivedBytesRead(streamBytesRead.getBytesRead()); }
java
protected void onStreamBytesRead(RTMPConnection conn, Channel channel, Header source, BytesRead streamBytesRead) { conn.receivedBytesRead(streamBytesRead.getBytesRead()); }
[ "protected", "void", "onStreamBytesRead", "(", "RTMPConnection", "conn", ",", "Channel", "channel", ",", "Header", "source", ",", "BytesRead", "streamBytesRead", ")", "{", "conn", ".", "receivedBytesRead", "(", "streamBytesRead", ".", "getBytesRead", "(", ")", ")"...
Stream bytes read event handler. @param conn Connection @param channel Channel @param source Header @param streamBytesRead Bytes read event context
[ "Stream", "bytes", "read", "event", "handler", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/BaseRTMPHandler.java#L341-L343
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.close
public void close() { //log.debug("Stream close: {}", publishedName); if (closed.compareAndSet(false, true)) { if (livePipe != null) { livePipe.unsubscribe((IProvider) this); } // if we have a recording listener, inform that this stream is done if (recordingListener != null) { sendRecordStopNotify(); notifyRecordingStop(); // inform the listener to finish and close recordingListener.get().stop(); } sendPublishStopNotify(); // TODO: can we send the client something to make sure he stops sending data? if (connMsgOut != null) { connMsgOut.unsubscribe(this); } notifyBroadcastClose(); // clear the listener after all the notifications have been sent if (recordingListener != null) { recordingListener.clear(); } // clear listeners if (!listeners.isEmpty()) { listeners.clear(); } // deregister with jmx unregisterJMX(); setState(StreamState.CLOSED); } }
java
public void close() { //log.debug("Stream close: {}", publishedName); if (closed.compareAndSet(false, true)) { if (livePipe != null) { livePipe.unsubscribe((IProvider) this); } // if we have a recording listener, inform that this stream is done if (recordingListener != null) { sendRecordStopNotify(); notifyRecordingStop(); // inform the listener to finish and close recordingListener.get().stop(); } sendPublishStopNotify(); // TODO: can we send the client something to make sure he stops sending data? if (connMsgOut != null) { connMsgOut.unsubscribe(this); } notifyBroadcastClose(); // clear the listener after all the notifications have been sent if (recordingListener != null) { recordingListener.clear(); } // clear listeners if (!listeners.isEmpty()) { listeners.clear(); } // deregister with jmx unregisterJMX(); setState(StreamState.CLOSED); } }
[ "public", "void", "close", "(", ")", "{", "//log.debug(\"Stream close: {}\", publishedName);\r", "if", "(", "closed", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "if", "(", "livePipe", "!=", "null", ")", "{", "livePipe", ".", "unsubscribe",...
Closes stream, unsubscribes provides, sends stoppage notifications and broadcast close notification.
[ "Closes", "stream", "unsubscribes", "provides", "sends", "stoppage", "notifications", "and", "broadcast", "close", "notification", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L205-L236
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.setPublishedName
public void setPublishedName(String name) { //log.debug("setPublishedName: {}", name); // a publish name of "false" is a special case, used when stopping a stream if (StringUtils.isNotEmpty(name) && !"false".equals(name)) { this.publishedName = name; registerJMX(); } }
java
public void setPublishedName(String name) { //log.debug("setPublishedName: {}", name); // a publish name of "false" is a special case, used when stopping a stream if (StringUtils.isNotEmpty(name) && !"false".equals(name)) { this.publishedName = name; registerJMX(); } }
[ "public", "void", "setPublishedName", "(", "String", "name", ")", "{", "//log.debug(\"setPublishedName: {}\", name);\r", "// a publish name of \"false\" is a special case, used when stopping a stream\r", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "name", ")", "&&", "!", ...
Setter for stream published name @param name Name that used for publishing. Set at client side when begin to broadcast with NetStream#publish.
[ "Setter", "for", "stream", "published", "name" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L423-L430
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.notifyBroadcastClose
private void notifyBroadcastClose() { final IStreamAwareScopeHandler handler = getStreamAwareHandler(); if (handler != null) { try { handler.streamBroadcastClose(this); } catch (Throwable t) { log.error("Error in notifyBroadcastClose", t); } } }
java
private void notifyBroadcastClose() { final IStreamAwareScopeHandler handler = getStreamAwareHandler(); if (handler != null) { try { handler.streamBroadcastClose(this); } catch (Throwable t) { log.error("Error in notifyBroadcastClose", t); } } }
[ "private", "void", "notifyBroadcastClose", "(", ")", "{", "final", "IStreamAwareScopeHandler", "handler", "=", "getStreamAwareHandler", "(", ")", ";", "if", "(", "handler", "!=", "null", ")", "{", "try", "{", "handler", ".", "streamBroadcastClose", "(", "this", ...
Notifies handler on stream broadcast close
[ "Notifies", "handler", "on", "stream", "broadcast", "close" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L495-L504
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.notifyRecordingStop
private void notifyRecordingStop() { IStreamAwareScopeHandler handler = getStreamAwareHandler(); if (handler != null) { try { handler.streamRecordStop(this); } catch (Throwable t) { log.error("Error in notifyRecordingStop", t); } } }
java
private void notifyRecordingStop() { IStreamAwareScopeHandler handler = getStreamAwareHandler(); if (handler != null) { try { handler.streamRecordStop(this); } catch (Throwable t) { log.error("Error in notifyRecordingStop", t); } } }
[ "private", "void", "notifyRecordingStop", "(", ")", "{", "IStreamAwareScopeHandler", "handler", "=", "getStreamAwareHandler", "(", ")", ";", "if", "(", "handler", "!=", "null", ")", "{", "try", "{", "handler", ".", "streamRecordStop", "(", "this", ")", ";", ...
Notifies handler on stream recording stop
[ "Notifies", "handler", "on", "stream", "recording", "stop" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L509-L518
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.notifyBroadcastStart
private void notifyBroadcastStart() { IStreamAwareScopeHandler handler = getStreamAwareHandler(); if (handler != null) { try { handler.streamBroadcastStart(this); } catch (Throwable t) { log.error("Error in notifyBroadcastStart", t); } } // send metadata for creation and start dates IoBuffer buf = IoBuffer.allocate(256); buf.setAutoExpand(true); Output out = new Output(buf); out.writeString("onMetaData"); Map<Object, Object> params = new HashMap<>(); Calendar cal = GregorianCalendar.getInstance(); cal.setTimeInMillis(creationTime); params.put("creationdate", ZonedDateTime.ofInstant(cal.toInstant(), ZoneId.of("UTC")).format(DateTimeFormatter.ISO_INSTANT)); cal.setTimeInMillis(startTime); params.put("startdate", ZonedDateTime.ofInstant(cal.toInstant(), ZoneId.of("UTC")).format(DateTimeFormatter.ISO_INSTANT)); if (log.isDebugEnabled()) { log.debug("Params: {}", params); } out.writeMap(params); buf.flip(); Notify notify = new Notify(buf); notify.setAction("onMetaData"); notify.setHeader(new Header()); notify.getHeader().setDataType(Notify.TYPE_STREAM_METADATA); notify.getHeader().setStreamId(0); notify.setTimestamp(0); dispatchEvent(notify); }
java
private void notifyBroadcastStart() { IStreamAwareScopeHandler handler = getStreamAwareHandler(); if (handler != null) { try { handler.streamBroadcastStart(this); } catch (Throwable t) { log.error("Error in notifyBroadcastStart", t); } } // send metadata for creation and start dates IoBuffer buf = IoBuffer.allocate(256); buf.setAutoExpand(true); Output out = new Output(buf); out.writeString("onMetaData"); Map<Object, Object> params = new HashMap<>(); Calendar cal = GregorianCalendar.getInstance(); cal.setTimeInMillis(creationTime); params.put("creationdate", ZonedDateTime.ofInstant(cal.toInstant(), ZoneId.of("UTC")).format(DateTimeFormatter.ISO_INSTANT)); cal.setTimeInMillis(startTime); params.put("startdate", ZonedDateTime.ofInstant(cal.toInstant(), ZoneId.of("UTC")).format(DateTimeFormatter.ISO_INSTANT)); if (log.isDebugEnabled()) { log.debug("Params: {}", params); } out.writeMap(params); buf.flip(); Notify notify = new Notify(buf); notify.setAction("onMetaData"); notify.setHeader(new Header()); notify.getHeader().setDataType(Notify.TYPE_STREAM_METADATA); notify.getHeader().setStreamId(0); notify.setTimestamp(0); dispatchEvent(notify); }
[ "private", "void", "notifyBroadcastStart", "(", ")", "{", "IStreamAwareScopeHandler", "handler", "=", "getStreamAwareHandler", "(", ")", ";", "if", "(", "handler", "!=", "null", ")", "{", "try", "{", "handler", ".", "streamBroadcastStart", "(", "this", ")", ";...
Notifies handler on stream broadcast start
[ "Notifies", "handler", "on", "stream", "broadcast", "start" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L523-L555
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.notifyChunkSize
private void notifyChunkSize() { if (chunkSize > 0 && livePipe != null) { OOBControlMessage setChunkSize = new OOBControlMessage(); setChunkSize.setTarget("ConnectionConsumer"); setChunkSize.setServiceName("chunkSize"); if (setChunkSize.getServiceParamMap() == null) { setChunkSize.setServiceParamMap(new HashMap<String, Object>()); } setChunkSize.getServiceParamMap().put("chunkSize", chunkSize); livePipe.sendOOBControlMessage(getProvider(), setChunkSize); } }
java
private void notifyChunkSize() { if (chunkSize > 0 && livePipe != null) { OOBControlMessage setChunkSize = new OOBControlMessage(); setChunkSize.setTarget("ConnectionConsumer"); setChunkSize.setServiceName("chunkSize"); if (setChunkSize.getServiceParamMap() == null) { setChunkSize.setServiceParamMap(new HashMap<String, Object>()); } setChunkSize.getServiceParamMap().put("chunkSize", chunkSize); livePipe.sendOOBControlMessage(getProvider(), setChunkSize); } }
[ "private", "void", "notifyChunkSize", "(", ")", "{", "if", "(", "chunkSize", ">", "0", "&&", "livePipe", "!=", "null", ")", "{", "OOBControlMessage", "setChunkSize", "=", "new", "OOBControlMessage", "(", ")", ";", "setChunkSize", ".", "setTarget", "(", "\"Co...
Send OOB control message with chunk size
[ "Send", "OOB", "control", "message", "with", "chunk", "size" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L560-L571
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.onOOBControlMessage
public void onOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg) { String target = oobCtrlMsg.getTarget(); if ("ClientBroadcastStream".equals(target)) { String serviceName = oobCtrlMsg.getServiceName(); if ("chunkSize".equals(serviceName)) { chunkSize = (Integer) oobCtrlMsg.getServiceParamMap().get("chunkSize"); notifyChunkSize(); } else { log.debug("Unhandled OOB control message for service: {}", serviceName); } } else { log.debug("Unhandled OOB control message to target: {}", target); } }
java
public void onOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg) { String target = oobCtrlMsg.getTarget(); if ("ClientBroadcastStream".equals(target)) { String serviceName = oobCtrlMsg.getServiceName(); if ("chunkSize".equals(serviceName)) { chunkSize = (Integer) oobCtrlMsg.getServiceParamMap().get("chunkSize"); notifyChunkSize(); } else { log.debug("Unhandled OOB control message for service: {}", serviceName); } } else { log.debug("Unhandled OOB control message to target: {}", target); } }
[ "public", "void", "onOOBControlMessage", "(", "IMessageComponent", "source", ",", "IPipe", "pipe", ",", "OOBControlMessage", "oobCtrlMsg", ")", "{", "String", "target", "=", "oobCtrlMsg", ".", "getTarget", "(", ")", ";", "if", "(", "\"ClientBroadcastStream\"", "."...
Out-of-band control message handler @param source OOB message source @param pipe Pipe that used to send OOB message @param oobCtrlMsg Out-of-band control message
[ "Out", "-", "of", "-", "band", "control", "message", "handler" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L583-L596
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.saveAs
public void saveAs(String name, boolean isAppend) throws IOException { //log.debug("SaveAs - name: {} append: {}", name, isAppend); // get connection to check if client is still streaming IStreamCapableConnection conn = getConnection(); if (conn == null) { throw new IOException("Stream is no longer connected"); } // one recording listener at a time via this entry point if (recordingListener == null) { // XXX Paul: Revisit this section to allow for implementation of custom IRecordingListener //IRecordingListener listener = (IRecordingListener) ScopeUtils.getScopeService(conn.getScope(), IRecordingListener.class, RecordingListener.class, false); // create a recording listener IRecordingListener listener = new RecordingListener(); //log.debug("Created: {}", listener); // initialize the listener if (listener.init(conn, name, isAppend)) { // get decoder info if it exists for the stream IStreamCodecInfo codecInfo = getCodecInfo(); //log.debug("Codec info: {}", codecInfo); if (codecInfo instanceof StreamCodecInfo) { StreamCodecInfo info = (StreamCodecInfo) codecInfo; IVideoStreamCodec videoCodec = info.getVideoCodec(); //log.debug("Video codec: {}", videoCodec); if (videoCodec != null) { //check for decoder configuration to send IoBuffer config = videoCodec.getDecoderConfiguration(); if (config != null) { //log.debug("Decoder configuration is available for {}", videoCodec.getName()); VideoData videoConf = new VideoData(config.asReadOnlyBuffer()); try { //log.debug("Setting decoder configuration for recording"); listener.getFileConsumer().setVideoDecoderConfiguration(videoConf); } finally { videoConf.release(); } } } else { log.debug("Could not initialize stream output, videoCodec is null."); } IAudioStreamCodec audioCodec = info.getAudioCodec(); //log.debug("Audio codec: {}", audioCodec); if (audioCodec != null) { //check for decoder configuration to send IoBuffer config = audioCodec.getDecoderConfiguration(); if (config != null) { //log.debug("Decoder configuration is available for {}", audioCodec.getName()); AudioData audioConf = new AudioData(config.asReadOnlyBuffer()); try { //log.debug("Setting decoder configuration for recording"); listener.getFileConsumer().setAudioDecoderConfiguration(audioConf); } finally { audioConf.release(); } } } else { log.debug("No decoder configuration available, audioCodec is null."); } } // set as primary listener recordingListener = new WeakReference<IRecordingListener>(listener); // add as a listener addStreamListener(listener); // start the listener thread listener.start(); } else { log.warn("Recording listener failed to initialize for stream: {}", name); } } else { log.debug("Recording listener already exists for stream: {} auto record enabled: {}", name, automaticRecording); } }
java
public void saveAs(String name, boolean isAppend) throws IOException { //log.debug("SaveAs - name: {} append: {}", name, isAppend); // get connection to check if client is still streaming IStreamCapableConnection conn = getConnection(); if (conn == null) { throw new IOException("Stream is no longer connected"); } // one recording listener at a time via this entry point if (recordingListener == null) { // XXX Paul: Revisit this section to allow for implementation of custom IRecordingListener //IRecordingListener listener = (IRecordingListener) ScopeUtils.getScopeService(conn.getScope(), IRecordingListener.class, RecordingListener.class, false); // create a recording listener IRecordingListener listener = new RecordingListener(); //log.debug("Created: {}", listener); // initialize the listener if (listener.init(conn, name, isAppend)) { // get decoder info if it exists for the stream IStreamCodecInfo codecInfo = getCodecInfo(); //log.debug("Codec info: {}", codecInfo); if (codecInfo instanceof StreamCodecInfo) { StreamCodecInfo info = (StreamCodecInfo) codecInfo; IVideoStreamCodec videoCodec = info.getVideoCodec(); //log.debug("Video codec: {}", videoCodec); if (videoCodec != null) { //check for decoder configuration to send IoBuffer config = videoCodec.getDecoderConfiguration(); if (config != null) { //log.debug("Decoder configuration is available for {}", videoCodec.getName()); VideoData videoConf = new VideoData(config.asReadOnlyBuffer()); try { //log.debug("Setting decoder configuration for recording"); listener.getFileConsumer().setVideoDecoderConfiguration(videoConf); } finally { videoConf.release(); } } } else { log.debug("Could not initialize stream output, videoCodec is null."); } IAudioStreamCodec audioCodec = info.getAudioCodec(); //log.debug("Audio codec: {}", audioCodec); if (audioCodec != null) { //check for decoder configuration to send IoBuffer config = audioCodec.getDecoderConfiguration(); if (config != null) { //log.debug("Decoder configuration is available for {}", audioCodec.getName()); AudioData audioConf = new AudioData(config.asReadOnlyBuffer()); try { //log.debug("Setting decoder configuration for recording"); listener.getFileConsumer().setAudioDecoderConfiguration(audioConf); } finally { audioConf.release(); } } } else { log.debug("No decoder configuration available, audioCodec is null."); } } // set as primary listener recordingListener = new WeakReference<IRecordingListener>(listener); // add as a listener addStreamListener(listener); // start the listener thread listener.start(); } else { log.warn("Recording listener failed to initialize for stream: {}", name); } } else { log.debug("Recording listener already exists for stream: {} auto record enabled: {}", name, automaticRecording); } }
[ "public", "void", "saveAs", "(", "String", "name", ",", "boolean", "isAppend", ")", "throws", "IOException", "{", "//log.debug(\"SaveAs - name: {} append: {}\", name, isAppend);\r", "// get connection to check if client is still streaming\r", "IStreamCapableConnection", "conn", "="...
Save broadcasted stream. @param name Stream name @param isAppend Append mode @throws IOException File could not be created/written to
[ "Save", "broadcasted", "stream", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L666-L736
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.sendPublishStartNotify
private void sendPublishStartNotify() { Status publishStatus = new Status(StatusCodes.NS_PUBLISH_START); publishStatus.setClientid(getStreamId()); publishStatus.setDetails(getPublishedName()); StatusMessage startMsg = new StatusMessage(); startMsg.setBody(publishStatus); pushMessage(startMsg); setState(StreamState.PUBLISHING); }
java
private void sendPublishStartNotify() { Status publishStatus = new Status(StatusCodes.NS_PUBLISH_START); publishStatus.setClientid(getStreamId()); publishStatus.setDetails(getPublishedName()); StatusMessage startMsg = new StatusMessage(); startMsg.setBody(publishStatus); pushMessage(startMsg); setState(StreamState.PUBLISHING); }
[ "private", "void", "sendPublishStartNotify", "(", ")", "{", "Status", "publishStatus", "=", "new", "Status", "(", "StatusCodes", ".", "NS_PUBLISH_START", ")", ";", "publishStatus", ".", "setClientid", "(", "getStreamId", "(", ")", ")", ";", "publishStatus", ".",...
Sends publish start notifications
[ "Sends", "publish", "start", "notifications" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L741-L750
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.sendPublishStopNotify
private void sendPublishStopNotify() { Status stopStatus = new Status(StatusCodes.NS_UNPUBLISHED_SUCCESS); stopStatus.setClientid(getStreamId()); stopStatus.setDetails(getPublishedName()); StatusMessage stopMsg = new StatusMessage(); stopMsg.setBody(stopStatus); pushMessage(stopMsg); setState(StreamState.STOPPED); }
java
private void sendPublishStopNotify() { Status stopStatus = new Status(StatusCodes.NS_UNPUBLISHED_SUCCESS); stopStatus.setClientid(getStreamId()); stopStatus.setDetails(getPublishedName()); StatusMessage stopMsg = new StatusMessage(); stopMsg.setBody(stopStatus); pushMessage(stopMsg); setState(StreamState.STOPPED); }
[ "private", "void", "sendPublishStopNotify", "(", ")", "{", "Status", "stopStatus", "=", "new", "Status", "(", "StatusCodes", ".", "NS_UNPUBLISHED_SUCCESS", ")", ";", "stopStatus", ".", "setClientid", "(", "getStreamId", "(", ")", ")", ";", "stopStatus", ".", "...
Sends publish stop notifications
[ "Sends", "publish", "stop", "notifications" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L755-L764
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.sendRecordFailedNotify
private void sendRecordFailedNotify(String reason) { Status failedStatus = new Status(StatusCodes.NS_RECORD_FAILED); failedStatus.setLevel(Status.ERROR); failedStatus.setClientid(getStreamId()); failedStatus.setDetails(getPublishedName()); failedStatus.setDesciption(reason); StatusMessage failedMsg = new StatusMessage(); failedMsg.setBody(failedStatus); pushMessage(failedMsg); }
java
private void sendRecordFailedNotify(String reason) { Status failedStatus = new Status(StatusCodes.NS_RECORD_FAILED); failedStatus.setLevel(Status.ERROR); failedStatus.setClientid(getStreamId()); failedStatus.setDetails(getPublishedName()); failedStatus.setDesciption(reason); StatusMessage failedMsg = new StatusMessage(); failedMsg.setBody(failedStatus); pushMessage(failedMsg); }
[ "private", "void", "sendRecordFailedNotify", "(", "String", "reason", ")", "{", "Status", "failedStatus", "=", "new", "Status", "(", "StatusCodes", ".", "NS_RECORD_FAILED", ")", ";", "failedStatus", ".", "setLevel", "(", "Status", ".", "ERROR", ")", ";", "fail...
Sends record failed notifications
[ "Sends", "record", "failed", "notifications" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L769-L779
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.sendRecordStartNotify
private void sendRecordStartNotify() { Status recordStatus = new Status(StatusCodes.NS_RECORD_START); recordStatus.setClientid(getStreamId()); recordStatus.setDetails(getPublishedName()); StatusMessage startMsg = new StatusMessage(); startMsg.setBody(recordStatus); pushMessage(startMsg); }
java
private void sendRecordStartNotify() { Status recordStatus = new Status(StatusCodes.NS_RECORD_START); recordStatus.setClientid(getStreamId()); recordStatus.setDetails(getPublishedName()); StatusMessage startMsg = new StatusMessage(); startMsg.setBody(recordStatus); pushMessage(startMsg); }
[ "private", "void", "sendRecordStartNotify", "(", ")", "{", "Status", "recordStatus", "=", "new", "Status", "(", "StatusCodes", ".", "NS_RECORD_START", ")", ";", "recordStatus", ".", "setClientid", "(", "getStreamId", "(", ")", ")", ";", "recordStatus", ".", "s...
Sends record start notifications
[ "Sends", "record", "start", "notifications" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L784-L792
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.sendRecordStopNotify
private void sendRecordStopNotify() { Status stopStatus = new Status(StatusCodes.NS_RECORD_STOP); stopStatus.setClientid(getStreamId()); stopStatus.setDetails(getPublishedName()); StatusMessage stopMsg = new StatusMessage(); stopMsg.setBody(stopStatus); pushMessage(stopMsg); }
java
private void sendRecordStopNotify() { Status stopStatus = new Status(StatusCodes.NS_RECORD_STOP); stopStatus.setClientid(getStreamId()); stopStatus.setDetails(getPublishedName()); StatusMessage stopMsg = new StatusMessage(); stopMsg.setBody(stopStatus); pushMessage(stopMsg); }
[ "private", "void", "sendRecordStopNotify", "(", ")", "{", "Status", "stopStatus", "=", "new", "Status", "(", "StatusCodes", ".", "NS_RECORD_STOP", ")", ";", "stopStatus", ".", "setClientid", "(", "getStreamId", "(", ")", ")", ";", "stopStatus", ".", "setDetail...
Sends record stop notifications
[ "Sends", "record", "stop", "notifications" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L797-L805
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.pushMessage
protected void pushMessage(StatusMessage msg) { if (connMsgOut != null) { try { connMsgOut.pushMessage(msg); } catch (IOException err) { log.error("Error while pushing message: {}", msg, err); } } else { log.warn("Consumer message output is null"); } }
java
protected void pushMessage(StatusMessage msg) { if (connMsgOut != null) { try { connMsgOut.pushMessage(msg); } catch (IOException err) { log.error("Error while pushing message: {}", msg, err); } } else { log.warn("Consumer message output is null"); } }
[ "protected", "void", "pushMessage", "(", "StatusMessage", "msg", ")", "{", "if", "(", "connMsgOut", "!=", "null", ")", "{", "try", "{", "connMsgOut", ".", "pushMessage", "(", "msg", ")", ";", "}", "catch", "(", "IOException", "err", ")", "{", "log", "....
Pushes a message out to a consumer. @param msg StatusMessage
[ "Pushes", "a", "message", "out", "to", "a", "consumer", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L813-L823
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.start
public void start() { //log.info("Stream start: {}", publishedName); checkVideoCodec = true; checkAudioCodec = true; firstPacketTime = -1; latestTimeStamp = -1; bytesReceived = 0; IConsumerService consumerManager = (IConsumerService) getScope().getContext().getBean(IConsumerService.KEY); connMsgOut = consumerManager.getConsumerOutput(this); if (connMsgOut != null && connMsgOut.subscribe(this, null)) { // technically this would be a 'start' time startTime = System.currentTimeMillis(); } else { log.warn("Subscribe failed"); } setState(StreamState.STARTED); }
java
public void start() { //log.info("Stream start: {}", publishedName); checkVideoCodec = true; checkAudioCodec = true; firstPacketTime = -1; latestTimeStamp = -1; bytesReceived = 0; IConsumerService consumerManager = (IConsumerService) getScope().getContext().getBean(IConsumerService.KEY); connMsgOut = consumerManager.getConsumerOutput(this); if (connMsgOut != null && connMsgOut.subscribe(this, null)) { // technically this would be a 'start' time startTime = System.currentTimeMillis(); } else { log.warn("Subscribe failed"); } setState(StreamState.STARTED); }
[ "public", "void", "start", "(", ")", "{", "//log.info(\"Stream start: {}\", publishedName);\r", "checkVideoCodec", "=", "true", ";", "checkAudioCodec", "=", "true", ";", "firstPacketTime", "=", "-", "1", ";", "latestTimeStamp", "=", "-", "1", ";", "bytesReceived", ...
Starts stream, creates pipes, connects
[ "Starts", "stream", "creates", "pipes", "connects" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L868-L884
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/ClientBroadcastStream.java
ClientBroadcastStream.stopRecording
public void stopRecording() { IRecordingListener listener = null; if (recordingListener != null && (listener = recordingListener.get()).isRecording()) { sendRecordStopNotify(); notifyRecordingStop(); // remove the listener removeStreamListener(listener); // stop the recording listener listener.stop(); // clear and null-out the thread local recordingListener.clear(); recordingListener = null; } }
java
public void stopRecording() { IRecordingListener listener = null; if (recordingListener != null && (listener = recordingListener.get()).isRecording()) { sendRecordStopNotify(); notifyRecordingStop(); // remove the listener removeStreamListener(listener); // stop the recording listener listener.stop(); // clear and null-out the thread local recordingListener.clear(); recordingListener = null; } }
[ "public", "void", "stopRecording", "(", ")", "{", "IRecordingListener", "listener", "=", "null", ";", "if", "(", "recordingListener", "!=", "null", "&&", "(", "listener", "=", "recordingListener", ".", "get", "(", ")", ")", ".", "isRecording", "(", ")", ")...
Stops any currently active recording.
[ "Stops", "any", "currently", "active", "recording", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L913-L926
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/RecordingListener.java
RecordingListener.processQueue
private void processQueue() { CachedEvent cachedEvent; try { IRTMPEvent event = null; RTMPMessage message = null; // get first event in the queue cachedEvent = queue.poll(); if (cachedEvent != null) { // get the data type final byte dataType = cachedEvent.getDataType(); // get the data IoBuffer buffer = cachedEvent.getData(); // get the current size of the buffer / data int bufferLimit = buffer.limit(); if (bufferLimit > 0) { // create new RTMP message and push to the consumer switch (dataType) { case Constants.TYPE_AGGREGATE: event = new Aggregate(buffer); event.setTimestamp(cachedEvent.getTimestamp()); message = RTMPMessage.build(event); break; case Constants.TYPE_AUDIO_DATA: event = new AudioData(buffer); event.setTimestamp(cachedEvent.getTimestamp()); message = RTMPMessage.build(event); break; case Constants.TYPE_VIDEO_DATA: event = new VideoData(buffer); event.setTimestamp(cachedEvent.getTimestamp()); message = RTMPMessage.build(event); break; default: event = new Notify(buffer); event.setTimestamp(cachedEvent.getTimestamp()); message = RTMPMessage.build(event); break; } // push it down to the recorder recordingConsumer.pushMessage(null, message); } else if (bufferLimit == 0 && dataType == Constants.TYPE_AUDIO_DATA) { log.debug("Stream data size was 0, sending empty audio message"); // allow for 0 byte audio packets event = new AudioData(IoBuffer.allocate(0)); event.setTimestamp(cachedEvent.getTimestamp()); message = RTMPMessage.build(event); // push it down to the recorder recordingConsumer.pushMessage(null, message); } else { log.debug("Stream data size was 0, recording pipe will not be notified"); } } } catch (Exception e) { log.warn("Exception while pushing to consumer", e); } }
java
private void processQueue() { CachedEvent cachedEvent; try { IRTMPEvent event = null; RTMPMessage message = null; // get first event in the queue cachedEvent = queue.poll(); if (cachedEvent != null) { // get the data type final byte dataType = cachedEvent.getDataType(); // get the data IoBuffer buffer = cachedEvent.getData(); // get the current size of the buffer / data int bufferLimit = buffer.limit(); if (bufferLimit > 0) { // create new RTMP message and push to the consumer switch (dataType) { case Constants.TYPE_AGGREGATE: event = new Aggregate(buffer); event.setTimestamp(cachedEvent.getTimestamp()); message = RTMPMessage.build(event); break; case Constants.TYPE_AUDIO_DATA: event = new AudioData(buffer); event.setTimestamp(cachedEvent.getTimestamp()); message = RTMPMessage.build(event); break; case Constants.TYPE_VIDEO_DATA: event = new VideoData(buffer); event.setTimestamp(cachedEvent.getTimestamp()); message = RTMPMessage.build(event); break; default: event = new Notify(buffer); event.setTimestamp(cachedEvent.getTimestamp()); message = RTMPMessage.build(event); break; } // push it down to the recorder recordingConsumer.pushMessage(null, message); } else if (bufferLimit == 0 && dataType == Constants.TYPE_AUDIO_DATA) { log.debug("Stream data size was 0, sending empty audio message"); // allow for 0 byte audio packets event = new AudioData(IoBuffer.allocate(0)); event.setTimestamp(cachedEvent.getTimestamp()); message = RTMPMessage.build(event); // push it down to the recorder recordingConsumer.pushMessage(null, message); } else { log.debug("Stream data size was 0, recording pipe will not be notified"); } } } catch (Exception e) { log.warn("Exception while pushing to consumer", e); } }
[ "private", "void", "processQueue", "(", ")", "{", "CachedEvent", "cachedEvent", ";", "try", "{", "IRTMPEvent", "event", "=", "null", ";", "RTMPMessage", "message", "=", "null", ";", "// get first event in the queue\r", "cachedEvent", "=", "queue", ".", "poll", "...
Process the queued items.
[ "Process", "the", "queued", "items", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/RecordingListener.java#L279-L334
train
Red5/red5-server-common
src/main/java/org/red5/server/Server.java
Server.getKey
protected String getKey(String hostName, String contextPath) { return String.format("%s/%s", (hostName == null ? EMPTY : hostName), (contextPath == null ? EMPTY : contextPath)); }
java
protected String getKey(String hostName, String contextPath) { return String.format("%s/%s", (hostName == null ? EMPTY : hostName), (contextPath == null ? EMPTY : contextPath)); }
[ "protected", "String", "getKey", "(", "String", "hostName", ",", "String", "contextPath", ")", "{", "return", "String", ".", "format", "(", "\"%s/%s\"", ",", "(", "hostName", "==", "null", "?", "EMPTY", ":", "hostName", ")", ",", "(", "contextPath", "==", ...
Return scope key. Scope key consists of host name concatenated with context path by slash symbol @param hostName Host name @param contextPath Context path @return Scope key as string
[ "Return", "scope", "key", ".", "Scope", "key", "consists", "of", "host", "name", "concatenated", "with", "context", "path", "by", "slash", "symbol" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Server.java#L118-L120
train
Red5/red5-server-common
src/main/java/org/red5/server/Server.java
Server.lookupGlobal
public IGlobalScope lookupGlobal(String hostName, String contextPath) { log.trace("{}", this); log.debug("Lookup global scope - host name: {} context path: {}", hostName, contextPath); // Init mappings key String key = getKey(hostName, contextPath); // If context path contains slashes get complex key and look for it in mappings while (contextPath.indexOf(SLASH) != -1) { key = getKey(hostName, contextPath); log.trace("Check: {}", key); String globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } final int slashIndex = contextPath.lastIndexOf(SLASH); // Context path is substring from the beginning and till last slash index contextPath = contextPath.substring(0, slashIndex); } // Get global scope key key = getKey(hostName, contextPath); log.trace("Check host and path: {}", key); // Look up for global scope switching keys if still not found String globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(EMPTY, contextPath); log.trace("Check wildcard host with path: {}", key); globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(hostName, EMPTY); log.trace("Check host with no path: {}", key); globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(EMPTY, EMPTY); log.trace("Check default host, default path: {}", key); return getGlobal(mapping.get(key)); }
java
public IGlobalScope lookupGlobal(String hostName, String contextPath) { log.trace("{}", this); log.debug("Lookup global scope - host name: {} context path: {}", hostName, contextPath); // Init mappings key String key = getKey(hostName, contextPath); // If context path contains slashes get complex key and look for it in mappings while (contextPath.indexOf(SLASH) != -1) { key = getKey(hostName, contextPath); log.trace("Check: {}", key); String globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } final int slashIndex = contextPath.lastIndexOf(SLASH); // Context path is substring from the beginning and till last slash index contextPath = contextPath.substring(0, slashIndex); } // Get global scope key key = getKey(hostName, contextPath); log.trace("Check host and path: {}", key); // Look up for global scope switching keys if still not found String globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(EMPTY, contextPath); log.trace("Check wildcard host with path: {}", key); globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(hostName, EMPTY); log.trace("Check host with no path: {}", key); globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(EMPTY, EMPTY); log.trace("Check default host, default path: {}", key); return getGlobal(mapping.get(key)); }
[ "public", "IGlobalScope", "lookupGlobal", "(", "String", "hostName", ",", "String", "contextPath", ")", "{", "log", ".", "trace", "(", "\"{}\"", ",", "this", ")", ";", "log", ".", "debug", "(", "\"Lookup global scope - host name: {} context path: {}\"", ",", "host...
Does global scope lookup for host name and context path @param hostName Host name @param contextPath Context path @return Global scope
[ "Does", "global", "scope", "lookup", "for", "host", "name", "and", "context", "path" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Server.java#L131-L171
train
Red5/red5-server-common
src/main/java/org/red5/server/Server.java
Server.getGlobal
public IGlobalScope getGlobal(String name) { if (name == null) { return null; } return globals.get(name); }
java
public IGlobalScope getGlobal(String name) { if (name == null) { return null; } return globals.get(name); }
[ "public", "IGlobalScope", "getGlobal", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "null", ";", "}", "return", "globals", ".", "get", "(", "name", ")", ";", "}" ]
Return global scope by name @param name Global scope name @return Global scope
[ "Return", "global", "scope", "by", "name" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Server.java#L180-L185
train
Red5/red5-server-common
src/main/java/org/red5/server/Server.java
Server.registerGlobal
public void registerGlobal(IGlobalScope scope) { log.trace("Registering global scope: {}", scope.getName(), scope); globals.put(scope.getName(), scope); }
java
public void registerGlobal(IGlobalScope scope) { log.trace("Registering global scope: {}", scope.getName(), scope); globals.put(scope.getName(), scope); }
[ "public", "void", "registerGlobal", "(", "IGlobalScope", "scope", ")", "{", "log", ".", "trace", "(", "\"Registering global scope: {}\"", ",", "scope", ".", "getName", "(", ")", ",", "scope", ")", ";", "globals", ".", "put", "(", "scope", ".", "getName", "...
Register global scope @param scope Global scope to register
[ "Register", "global", "scope" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Server.java#L193-L196
train
Red5/red5-server-common
src/main/java/org/red5/server/Server.java
Server.removeMapping
public boolean removeMapping(String hostName, String contextPath) { log.info("Remove mapping host: {} context: {}", hostName, contextPath); final String key = getKey(hostName, contextPath); log.debug("Remove mapping: {}", key); return (mapping.remove(key) != null); }
java
public boolean removeMapping(String hostName, String contextPath) { log.info("Remove mapping host: {} context: {}", hostName, contextPath); final String key = getKey(hostName, contextPath); log.debug("Remove mapping: {}", key); return (mapping.remove(key) != null); }
[ "public", "boolean", "removeMapping", "(", "String", "hostName", ",", "String", "contextPath", ")", "{", "log", ".", "info", "(", "\"Remove mapping host: {} context: {}\"", ",", "hostName", ",", "contextPath", ")", ";", "final", "String", "key", "=", "getKey", "...
Remove mapping with given key @param hostName Host name @param contextPath Context path @return true if mapping was removed, false if key doesn't exist
[ "Remove", "mapping", "with", "given", "key" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Server.java#L225-L230
train
Red5/red5-server-common
src/main/java/org/red5/server/so/ClientSharedObject.java
ClientSharedObject.connect
public void connect(IConnection conn) { if (conn instanceof RTMPConnection) { if (!isConnected()) { source = conn; SharedObjectMessage msg = new SharedObjectMessage(name, 0, isPersistent()); msg.addEvent(new SharedObjectEvent(Type.SERVER_CONNECT, null, null)); Channel c = ((RTMPConnection) conn).getChannel(3); c.write(msg); } else { throw new UnsupportedOperationException("Already connected"); } } else { throw new UnsupportedOperationException("Only RTMP connections are supported"); } }
java
public void connect(IConnection conn) { if (conn instanceof RTMPConnection) { if (!isConnected()) { source = conn; SharedObjectMessage msg = new SharedObjectMessage(name, 0, isPersistent()); msg.addEvent(new SharedObjectEvent(Type.SERVER_CONNECT, null, null)); Channel c = ((RTMPConnection) conn).getChannel(3); c.write(msg); } else { throw new UnsupportedOperationException("Already connected"); } } else { throw new UnsupportedOperationException("Only RTMP connections are supported"); } }
[ "public", "void", "connect", "(", "IConnection", "conn", ")", "{", "if", "(", "conn", "instanceof", "RTMPConnection", ")", "{", "if", "(", "!", "isConnected", "(", ")", ")", "{", "source", "=", "conn", ";", "SharedObjectMessage", "msg", "=", "new", "Shar...
Connect the shared object using the passed connection. @param conn Attach SO to given connection
[ "Connect", "the", "shared", "object", "using", "the", "passed", "connection", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/ClientSharedObject.java#L91-L105
train
Red5/red5-server-common
src/main/java/org/red5/server/so/ClientSharedObject.java
ClientSharedObject.notifyUpdate
protected void notifyUpdate(String key, Object value) { for (ISharedObjectListener listener : listeners) { listener.onSharedObjectUpdate(this, key, value); } }
java
protected void notifyUpdate(String key, Object value) { for (ISharedObjectListener listener : listeners) { listener.onSharedObjectUpdate(this, key, value); } }
[ "protected", "void", "notifyUpdate", "(", "String", "key", ",", "Object", "value", ")", "{", "for", "(", "ISharedObjectListener", "listener", ":", "listeners", ")", "{", "listener", ".", "onSharedObjectUpdate", "(", "this", ",", "key", ",", "value", ")", ";"...
Notify listeners on update @param key Updated attribute key @param value Updated attribute value
[ "Notify", "listeners", "on", "update" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/ClientSharedObject.java#L211-L215
train
Red5/red5-server-common
src/main/java/org/red5/server/so/ClientSharedObject.java
ClientSharedObject.notifyUpdate
protected void notifyUpdate(String key, Map<String, Object> value) { if (value.size() == 1) { Map.Entry<String, Object> entry = value.entrySet().iterator().next(); notifyUpdate(entry.getKey(), entry.getValue()); return; } for (ISharedObjectListener listener : listeners) { listener.onSharedObjectUpdate(this, key, value); } }
java
protected void notifyUpdate(String key, Map<String, Object> value) { if (value.size() == 1) { Map.Entry<String, Object> entry = value.entrySet().iterator().next(); notifyUpdate(entry.getKey(), entry.getValue()); return; } for (ISharedObjectListener listener : listeners) { listener.onSharedObjectUpdate(this, key, value); } }
[ "protected", "void", "notifyUpdate", "(", "String", "key", ",", "Map", "<", "String", ",", "Object", ">", "value", ")", "{", "if", "(", "value", ".", "size", "(", ")", "==", "1", ")", "{", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "...
Notify listeners on map attribute update @param key Updated attribute key @param value Updated attribute value
[ "Notify", "listeners", "on", "map", "attribute", "update" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/ClientSharedObject.java#L225-L234
train
Red5/red5-server-common
src/main/java/org/red5/server/so/ClientSharedObject.java
ClientSharedObject.notifySendMessage
protected void notifySendMessage(String method, List<?> params) { for (ISharedObjectListener listener : listeners) { listener.onSharedObjectSend(this, method, params); } }
java
protected void notifySendMessage(String method, List<?> params) { for (ISharedObjectListener listener : listeners) { listener.onSharedObjectSend(this, method, params); } }
[ "protected", "void", "notifySendMessage", "(", "String", "method", ",", "List", "<", "?", ">", "params", ")", "{", "for", "(", "ISharedObjectListener", "listener", ":", "listeners", ")", "{", "listener", ".", "onSharedObjectSend", "(", "this", ",", "method", ...
Broadcast send event to listeners @param method Method name @param params Params
[ "Broadcast", "send", "event", "to", "listeners" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/ClientSharedObject.java#L265-L269
train
Red5/red5-server-common
src/main/java/org/red5/server/service/ServiceInvoker.java
ServiceInvoker.getServiceHandler
private Object getServiceHandler(IScope scope, String serviceName) { // get application scope handler first Object service = scope.getHandler(); if (serviceName == null || serviceName.equals("")) { // no service requested, return application scope handler log.trace("No service requested, return application scope handler: {}", service); return service; } // search service resolver that knows about service name for (IServiceResolver resolver : serviceResolvers) { service = resolver.resolveService(scope, serviceName); if (service != null) { return service; } } // requested service does not exist return null; }
java
private Object getServiceHandler(IScope scope, String serviceName) { // get application scope handler first Object service = scope.getHandler(); if (serviceName == null || serviceName.equals("")) { // no service requested, return application scope handler log.trace("No service requested, return application scope handler: {}", service); return service; } // search service resolver that knows about service name for (IServiceResolver resolver : serviceResolvers) { service = resolver.resolveService(scope, serviceName); if (service != null) { return service; } } // requested service does not exist return null; }
[ "private", "Object", "getServiceHandler", "(", "IScope", "scope", ",", "String", "serviceName", ")", "{", "// get application scope handler first\r", "Object", "service", "=", "scope", ".", "getHandler", "(", ")", ";", "if", "(", "serviceName", "==", "null", "||",...
Lookup a handler for the passed service name in the given scope. @param scope Scope @param serviceName Service name @return Service handler
[ "Lookup", "a", "handler", "for", "the", "passed", "service", "name", "in", "the", "given", "scope", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/service/ServiceInvoker.java#L79-L96
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/RTMPHandler.java
RTMPHandler.sendSOCreationFailed
private void sendSOCreationFailed(RTMPConnection conn, SharedObjectMessage message) { log.debug("sendSOCreationFailed - message: {} conn: {}", message, conn); // reset the object so we can re-use it message.reset(); // add the error event message.addEvent(new SharedObjectEvent(ISharedObjectEvent.Type.CLIENT_STATUS, "error", SO_CREATION_FAILED)); if (conn.isChannelUsed(3)) { // XXX Paul: I dont like this direct write stuff, need to move to event-based conn.getChannel(3).write(message); } else { log.warn("Channel is not in-use and cannot handle SO event: {}", message, new Exception("SO event handling failure")); // XXX Paul: I dont like this direct write stuff, need to move to event-based conn.getChannel(3).write(message); } }
java
private void sendSOCreationFailed(RTMPConnection conn, SharedObjectMessage message) { log.debug("sendSOCreationFailed - message: {} conn: {}", message, conn); // reset the object so we can re-use it message.reset(); // add the error event message.addEvent(new SharedObjectEvent(ISharedObjectEvent.Type.CLIENT_STATUS, "error", SO_CREATION_FAILED)); if (conn.isChannelUsed(3)) { // XXX Paul: I dont like this direct write stuff, need to move to event-based conn.getChannel(3).write(message); } else { log.warn("Channel is not in-use and cannot handle SO event: {}", message, new Exception("SO event handling failure")); // XXX Paul: I dont like this direct write stuff, need to move to event-based conn.getChannel(3).write(message); } }
[ "private", "void", "sendSOCreationFailed", "(", "RTMPConnection", "conn", ",", "SharedObjectMessage", "message", ")", "{", "log", ".", "debug", "(", "\"sendSOCreationFailed - message: {} conn: {}\"", ",", "message", ",", "conn", ")", ";", "// reset the object so we can re...
Create and send SO message stating that a SO could not be created. @param conn @param message Shared object message that incurred the failure
[ "Create", "and", "send", "SO", "message", "stating", "that", "a", "SO", "could", "not", "be", "created", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandler.java#L547-L561
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/DeferredResult.java
DeferredResult.setResult
public void setResult(Object result) { if (resultSent) { throw new RuntimeException("You can only set the result once."); } this.resultSent = true; Channel channel = this.channel.get(); if (channel == null) { log.warn("The client is no longer connected."); return; } call.setResult(result); Invoke reply = new Invoke(); reply.setCall(call); reply.setTransactionId(transactionId); channel.write(reply); channel.getConnection().unregisterDeferredResult(this); }
java
public void setResult(Object result) { if (resultSent) { throw new RuntimeException("You can only set the result once."); } this.resultSent = true; Channel channel = this.channel.get(); if (channel == null) { log.warn("The client is no longer connected."); return; } call.setResult(result); Invoke reply = new Invoke(); reply.setCall(call); reply.setTransactionId(transactionId); channel.write(reply); channel.getConnection().unregisterDeferredResult(this); }
[ "public", "void", "setResult", "(", "Object", "result", ")", "{", "if", "(", "resultSent", ")", "{", "throw", "new", "RuntimeException", "(", "\"You can only set the result once.\"", ")", ";", "}", "this", ".", "resultSent", "=", "true", ";", "Channel", "chann...
Set the result of a method call and send to the caller. @param result deferred result of the method call
[ "Set", "the", "result", "of", "a", "method", "call", "and", "send", "to", "the", "caller", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/DeferredResult.java#L66-L82
train
Red5/red5-server-common
src/main/java/org/red5/server/messaging/InMemoryPushPushPipe.java
InMemoryPushPushPipe.pushMessage
public void pushMessage(IMessage message) throws IOException { if (log.isDebugEnabled()) { log.debug("pushMessage: {} to {} consumers", message, consumers.size()); } for (IConsumer consumer : consumers) { try { ((IPushableConsumer) consumer).pushMessage(this, message); } catch (Throwable t) { if (t instanceof IOException) { throw (IOException) t; } log.error("Exception pushing message to consumer", t); } } }
java
public void pushMessage(IMessage message) throws IOException { if (log.isDebugEnabled()) { log.debug("pushMessage: {} to {} consumers", message, consumers.size()); } for (IConsumer consumer : consumers) { try { ((IPushableConsumer) consumer).pushMessage(this, message); } catch (Throwable t) { if (t instanceof IOException) { throw (IOException) t; } log.error("Exception pushing message to consumer", t); } } }
[ "public", "void", "pushMessage", "(", "IMessage", "message", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"pushMessage: {} to {} consumers\"", ",", "message", ",", "consumers", ".",...
Pushes a message out to all the PushableConsumers. @param message the message to be pushed to consumers @throws IOException In case IOException of some sort is occurred
[ "Pushes", "a", "message", "out", "to", "all", "the", "PushableConsumers", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/InMemoryPushPushPipe.java#L94-L109
train
Red5/red5-server-common
src/main/java/org/red5/server/messaging/AbstractPipe.java
AbstractPipe.subscribe
public boolean subscribe(IConsumer consumer, Map<String, Object> paramMap) { // pipe is possibly used by dozens of threads at once (like many subscribers for one server stream) boolean success = consumers.addIfAbsent(consumer); // if consumer is listener object register it as listener and consumer has just been added if (success && consumer instanceof IPipeConnectionListener) { listeners.addIfAbsent((IPipeConnectionListener) consumer); } return success; }
java
public boolean subscribe(IConsumer consumer, Map<String, Object> paramMap) { // pipe is possibly used by dozens of threads at once (like many subscribers for one server stream) boolean success = consumers.addIfAbsent(consumer); // if consumer is listener object register it as listener and consumer has just been added if (success && consumer instanceof IPipeConnectionListener) { listeners.addIfAbsent((IPipeConnectionListener) consumer); } return success; }
[ "public", "boolean", "subscribe", "(", "IConsumer", "consumer", ",", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "// pipe is possibly used by dozens of threads at once (like many subscribers for one server stream)", "boolean", "success", "=", "consumers", ...
Connect consumer to this pipe. Doesn't allow to connect one consumer twice. Does register event listeners if instance of IPipeConnectionListener is given. @param consumer Consumer @param paramMap Parameters passed with connection, used in concrete pipe implementations @return true if consumer was added, false otherwise
[ "Connect", "consumer", "to", "this", "pipe", ".", "Doesn", "t", "allow", "to", "connect", "one", "consumer", "twice", ".", "Does", "register", "event", "listeners", "if", "instance", "of", "IPipeConnectionListener", "is", "given", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L73-L81
train
Red5/red5-server-common
src/main/java/org/red5/server/messaging/AbstractPipe.java
AbstractPipe.subscribe
public boolean subscribe(IProvider provider, Map<String, Object> paramMap) { boolean success = providers.addIfAbsent(provider); // register event listener if given and just added if (success && provider instanceof IPipeConnectionListener) { listeners.addIfAbsent((IPipeConnectionListener) provider); } return success; }
java
public boolean subscribe(IProvider provider, Map<String, Object> paramMap) { boolean success = providers.addIfAbsent(provider); // register event listener if given and just added if (success && provider instanceof IPipeConnectionListener) { listeners.addIfAbsent((IPipeConnectionListener) provider); } return success; }
[ "public", "boolean", "subscribe", "(", "IProvider", "provider", ",", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "boolean", "success", "=", "providers", ".", "addIfAbsent", "(", "provider", ")", ";", "// register event listener if given and jus...
Connect provider to this pipe. Doesn't allow to connect one provider twice. Does register event listeners if instance of IPipeConnectionListener is given. @param provider Provider @param paramMap Parameters passed with connection, used in concrete pipe implementations @return true if provider was added, false otherwise
[ "Connect", "provider", "to", "this", "pipe", ".", "Doesn", "t", "allow", "to", "connect", "one", "provider", "twice", ".", "Does", "register", "event", "listeners", "if", "instance", "of", "IPipeConnectionListener", "is", "given", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L92-L99
train
Red5/red5-server-common
src/main/java/org/red5/server/messaging/AbstractPipe.java
AbstractPipe.unsubscribe
@SuppressWarnings("unlikely-arg-type") public boolean unsubscribe(IProvider provider) { if (providers.remove(provider)) { fireProviderConnectionEvent(provider, PipeConnectionEvent.EventType.PROVIDER_DISCONNECT, null); listeners.remove(provider); return true; } return false; }
java
@SuppressWarnings("unlikely-arg-type") public boolean unsubscribe(IProvider provider) { if (providers.remove(provider)) { fireProviderConnectionEvent(provider, PipeConnectionEvent.EventType.PROVIDER_DISCONNECT, null); listeners.remove(provider); return true; } return false; }
[ "@", "SuppressWarnings", "(", "\"unlikely-arg-type\"", ")", "public", "boolean", "unsubscribe", "(", "IProvider", "provider", ")", "{", "if", "(", "providers", ".", "remove", "(", "provider", ")", ")", "{", "fireProviderConnectionEvent", "(", "provider", ",", "P...
Disconnects provider from this pipe. Fires pipe connection event. @param provider Provider that should be removed @return true on success, false otherwise
[ "Disconnects", "provider", "from", "this", "pipe", ".", "Fires", "pipe", "connection", "event", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L108-L116
train
Red5/red5-server-common
src/main/java/org/red5/server/messaging/AbstractPipe.java
AbstractPipe.unsubscribe
@SuppressWarnings("unlikely-arg-type") public boolean unsubscribe(IConsumer consumer) { if (consumers.remove(consumer)) { fireConsumerConnectionEvent(consumer, PipeConnectionEvent.EventType.CONSUMER_DISCONNECT, null); listeners.remove(consumer); return true; } return false; }
java
@SuppressWarnings("unlikely-arg-type") public boolean unsubscribe(IConsumer consumer) { if (consumers.remove(consumer)) { fireConsumerConnectionEvent(consumer, PipeConnectionEvent.EventType.CONSUMER_DISCONNECT, null); listeners.remove(consumer); return true; } return false; }
[ "@", "SuppressWarnings", "(", "\"unlikely-arg-type\"", ")", "public", "boolean", "unsubscribe", "(", "IConsumer", "consumer", ")", "{", "if", "(", "consumers", ".", "remove", "(", "consumer", ")", ")", "{", "fireConsumerConnectionEvent", "(", "consumer", ",", "P...
Disconnects consumer from this pipe. Fires pipe connection event. @param consumer Consumer that should be removed @return true on success, false otherwise
[ "Disconnects", "consumer", "from", "this", "pipe", ".", "Fires", "pipe", "connection", "event", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L125-L133
train
Red5/red5-server-common
src/main/java/org/red5/server/messaging/AbstractPipe.java
AbstractPipe.fireConsumerConnectionEvent
protected void fireConsumerConnectionEvent(IConsumer consumer, PipeConnectionEvent.EventType type, Map<String, Object> paramMap) { firePipeConnectionEvent(PipeConnectionEvent.build(this, type, consumer, paramMap)); }
java
protected void fireConsumerConnectionEvent(IConsumer consumer, PipeConnectionEvent.EventType type, Map<String, Object> paramMap) { firePipeConnectionEvent(PipeConnectionEvent.build(this, type, consumer, paramMap)); }
[ "protected", "void", "fireConsumerConnectionEvent", "(", "IConsumer", "consumer", ",", "PipeConnectionEvent", ".", "EventType", "type", ",", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "firePipeConnectionEvent", "(", "PipeConnectionEvent", ".", "...
Broadcast consumer connection event @param consumer Consumer that has connected @param type Event type @param paramMap Parameters passed with connection
[ "Broadcast", "consumer", "connection", "event" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L239-L241
train
Red5/red5-server-common
src/main/java/org/red5/server/messaging/AbstractPipe.java
AbstractPipe.fireProviderConnectionEvent
protected void fireProviderConnectionEvent(IProvider provider, PipeConnectionEvent.EventType type, Map<String, Object> paramMap) { firePipeConnectionEvent(PipeConnectionEvent.build(this, type, provider, paramMap)); }
java
protected void fireProviderConnectionEvent(IProvider provider, PipeConnectionEvent.EventType type, Map<String, Object> paramMap) { firePipeConnectionEvent(PipeConnectionEvent.build(this, type, provider, paramMap)); }
[ "protected", "void", "fireProviderConnectionEvent", "(", "IProvider", "provider", ",", "PipeConnectionEvent", ".", "EventType", "type", ",", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "firePipeConnectionEvent", "(", "PipeConnectionEvent", ".", "...
Broadcast provider connection event @param provider Provider that has connected @param type Event type @param paramMap Parameters passed with connection
[ "Broadcast", "provider", "connection", "event" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L253-L255
train
Red5/red5-server-common
src/main/java/org/red5/server/messaging/AbstractPipe.java
AbstractPipe.firePipeConnectionEvent
protected void firePipeConnectionEvent(PipeConnectionEvent event) { for (IPipeConnectionListener element : listeners) { try { element.onPipeConnectionEvent(event); } catch (Throwable t) { log.error("Exception when handling pipe connection event", t); } } if (taskExecutor == null) { taskExecutor = Executors.newCachedThreadPool(new CustomizableThreadFactory("Pipe-")); } // Run all of event's tasks for (Runnable task : event.getTaskList()) { try { taskExecutor.execute(task); } catch (Throwable t) { log.warn("Exception executing pipe task {}", t); } } // Clear event's tasks list event.getTaskList().clear(); }
java
protected void firePipeConnectionEvent(PipeConnectionEvent event) { for (IPipeConnectionListener element : listeners) { try { element.onPipeConnectionEvent(event); } catch (Throwable t) { log.error("Exception when handling pipe connection event", t); } } if (taskExecutor == null) { taskExecutor = Executors.newCachedThreadPool(new CustomizableThreadFactory("Pipe-")); } // Run all of event's tasks for (Runnable task : event.getTaskList()) { try { taskExecutor.execute(task); } catch (Throwable t) { log.warn("Exception executing pipe task {}", t); } } // Clear event's tasks list event.getTaskList().clear(); }
[ "protected", "void", "firePipeConnectionEvent", "(", "PipeConnectionEvent", "event", ")", "{", "for", "(", "IPipeConnectionListener", "element", ":", "listeners", ")", "{", "try", "{", "element", ".", "onPipeConnectionEvent", "(", "event", ")", ";", "}", "catch", ...
Fire any pipe connection event and run all it's tasks @param event Pipe connection event
[ "Fire", "any", "pipe", "connection", "event", "and", "run", "all", "it", "s", "tasks" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L263-L284
train
Red5/red5-server-common
src/main/java/org/red5/server/messaging/AbstractPipe.java
AbstractPipe.close
public void close() { // clean up collections if (consumers != null) { consumers.clear(); consumers = null; } if (providers != null) { providers.clear(); providers = null; } if (listeners != null) { listeners.clear(); listeners = null; } }
java
public void close() { // clean up collections if (consumers != null) { consumers.clear(); consumers = null; } if (providers != null) { providers.clear(); providers = null; } if (listeners != null) { listeners.clear(); listeners = null; } }
[ "public", "void", "close", "(", ")", "{", "// clean up collections", "if", "(", "consumers", "!=", "null", ")", "{", "consumers", ".", "clear", "(", ")", ";", "consumers", "=", "null", ";", "}", "if", "(", "providers", "!=", "null", ")", "{", "provider...
Close the pipe
[ "Close", "the", "pipe" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L289-L303
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/AudioCodecFactory.java
AudioCodecFactory.getAudioCodec
public static IAudioStreamCodec getAudioCodec(IoBuffer data) { IAudioStreamCodec result = null; try { //get the codec identifying byte int codecId = (data.get() & 0xf0) >> 4; switch (codecId) { case 10: //aac result = (IAudioStreamCodec) Class.forName("org.red5.codec.AACAudio").newInstance(); break; case 11: result = (IAudioStreamCodec) Class.forName("org.red5.codec.SpeexAudio").newInstance(); break; case 2: case 14: result = (IAudioStreamCodec) Class.forName("org.red5.codec.MP3Audio").newInstance(); break; } data.rewind(); } catch (Exception ex) { log.error("Error creating codec instance", ex); } //if codec is not found do the old-style loop if (result == null) { for (IAudioStreamCodec storedCodec : codecs) { IAudioStreamCodec codec; // XXX: this is a bit of a hack to create new instances of the // configured audio codec for each stream try { codec = storedCodec.getClass().newInstance(); } catch (Exception e) { log.error("Could not create audio codec instance", e); continue; } if (codec.canHandleData(data)) { result = codec; break; } } } return result; }
java
public static IAudioStreamCodec getAudioCodec(IoBuffer data) { IAudioStreamCodec result = null; try { //get the codec identifying byte int codecId = (data.get() & 0xf0) >> 4; switch (codecId) { case 10: //aac result = (IAudioStreamCodec) Class.forName("org.red5.codec.AACAudio").newInstance(); break; case 11: result = (IAudioStreamCodec) Class.forName("org.red5.codec.SpeexAudio").newInstance(); break; case 2: case 14: result = (IAudioStreamCodec) Class.forName("org.red5.codec.MP3Audio").newInstance(); break; } data.rewind(); } catch (Exception ex) { log.error("Error creating codec instance", ex); } //if codec is not found do the old-style loop if (result == null) { for (IAudioStreamCodec storedCodec : codecs) { IAudioStreamCodec codec; // XXX: this is a bit of a hack to create new instances of the // configured audio codec for each stream try { codec = storedCodec.getClass().newInstance(); } catch (Exception e) { log.error("Could not create audio codec instance", e); continue; } if (codec.canHandleData(data)) { result = codec; break; } } } return result; }
[ "public", "static", "IAudioStreamCodec", "getAudioCodec", "(", "IoBuffer", "data", ")", "{", "IAudioStreamCodec", "result", "=", "null", ";", "try", "{", "//get the codec identifying byte\r", "int", "codecId", "=", "(", "data", ".", "get", "(", ")", "&", "0xf0",...
Create and return new audio codec applicable for byte buffer data @param data Byte buffer data @return audio codec
[ "Create", "and", "return", "new", "audio", "codec", "applicable", "for", "byte", "buffer", "data" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/AudioCodecFactory.java#L68-L108
train
Red5/red5-server-common
src/main/java/org/red5/server/api/Red5.java
Red5.setConnectionLocal
public static void setConnectionLocal(IConnection connection) { if (log.isDebugEnabled()) { log.debug("Set connection: {} with thread: {}", (connection != null ? connection.getSessionId() : null), Thread.currentThread().getName()); try { StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); StackTraceElement stackTraceElement = stackTraceElements[2]; log.debug("Caller: {}.{} #{}", stackTraceElement.getClassName(), stackTraceElement.getMethodName(), stackTraceElement.getLineNumber()); } catch (Exception e) { } } if (connection != null) { connThreadLocal.set(new WeakReference<IConnection>(connection)); IScope scope = connection.getScope(); if (scope != null) { Thread.currentThread().setContextClassLoader(scope.getClassLoader()); } } else { // use null to clear the value connThreadLocal.remove(); } }
java
public static void setConnectionLocal(IConnection connection) { if (log.isDebugEnabled()) { log.debug("Set connection: {} with thread: {}", (connection != null ? connection.getSessionId() : null), Thread.currentThread().getName()); try { StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); StackTraceElement stackTraceElement = stackTraceElements[2]; log.debug("Caller: {}.{} #{}", stackTraceElement.getClassName(), stackTraceElement.getMethodName(), stackTraceElement.getLineNumber()); } catch (Exception e) { } } if (connection != null) { connThreadLocal.set(new WeakReference<IConnection>(connection)); IScope scope = connection.getScope(); if (scope != null) { Thread.currentThread().setContextClassLoader(scope.getClassLoader()); } } else { // use null to clear the value connThreadLocal.remove(); } }
[ "public", "static", "void", "setConnectionLocal", "(", "IConnection", "connection", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Set connection: {} with thread: {}\"", ",", "(", "connection", "!=", "null", ...
Setter for connection @param connection Thread local connection
[ "Setter", "for", "connection" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/api/Red5.java#L125-L145
train
Red5/red5-server-common
src/main/java/org/red5/server/api/Red5.java
Red5.getConnectionLocal
public static IConnection getConnectionLocal() { WeakReference<IConnection> ref = connThreadLocal.get(); if (ref != null) { IConnection connection = ref.get(); log.debug("Get connection: {} on thread: {}", (connection != null ? connection.getSessionId() : null), Thread.currentThread().getName()); return connection; } else { return null; } }
java
public static IConnection getConnectionLocal() { WeakReference<IConnection> ref = connThreadLocal.get(); if (ref != null) { IConnection connection = ref.get(); log.debug("Get connection: {} on thread: {}", (connection != null ? connection.getSessionId() : null), Thread.currentThread().getName()); return connection; } else { return null; } }
[ "public", "static", "IConnection", "getConnectionLocal", "(", ")", "{", "WeakReference", "<", "IConnection", ">", "ref", "=", "connThreadLocal", ".", "get", "(", ")", ";", "if", "(", "ref", "!=", "null", ")", "{", "IConnection", "connection", "=", "ref", "...
Get the connection associated with the current thread. This method allows you to get connection object local to current thread. When you need to get a connection associated with event handler and so forth, this method provides you with it. @return Connection object
[ "Get", "the", "connection", "associated", "with", "the", "current", "thread", ".", "This", "method", "allows", "you", "to", "get", "connection", "object", "local", "to", "current", "thread", ".", "When", "you", "need", "to", "get", "a", "connection", "associ...
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/api/Red5.java#L152-L161
train
Red5/red5-server-common
src/main/java/org/red5/server/persistence/RamPersistence.java
RamPersistence.getObjectName
protected String getObjectName(String id) { // The format of the object id is <type>/<path>/<objectName> String result = id.substring(id.lastIndexOf('/') + 1); if (result.equals(PERSISTENCE_NO_NAME)) { result = null; } return result; }
java
protected String getObjectName(String id) { // The format of the object id is <type>/<path>/<objectName> String result = id.substring(id.lastIndexOf('/') + 1); if (result.equals(PERSISTENCE_NO_NAME)) { result = null; } return result; }
[ "protected", "String", "getObjectName", "(", "String", "id", ")", "{", "// The format of the object id is <type>/<path>/<objectName>\r", "String", "result", "=", "id", ".", "substring", "(", "id", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ";", "if",...
Get resource name from path. The format of the object id is <pre> type / path / objectName </pre> @param id object id @return resource name
[ "Get", "resource", "name", "from", "path", ".", "The", "format", "of", "the", "object", "id", "is" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/persistence/RamPersistence.java#L91-L98
train
Red5/red5-server-common
src/main/java/org/red5/server/persistence/RamPersistence.java
RamPersistence.getObjectPath
protected String getObjectPath(String id, String name) { // The format of the object id is <type>/<path>/<objectName> id = id.substring(id.indexOf('/') + 1); if (id.charAt(0) == '/') { id = id.substring(1); } if (id.lastIndexOf(name) <= 0) { return id; } return id.substring(0, id.lastIndexOf(name) - 1); }
java
protected String getObjectPath(String id, String name) { // The format of the object id is <type>/<path>/<objectName> id = id.substring(id.indexOf('/') + 1); if (id.charAt(0) == '/') { id = id.substring(1); } if (id.lastIndexOf(name) <= 0) { return id; } return id.substring(0, id.lastIndexOf(name) - 1); }
[ "protected", "String", "getObjectPath", "(", "String", "id", ",", "String", "name", ")", "{", "// The format of the object id is <type>/<path>/<objectName>\r", "id", "=", "id", ".", "substring", "(", "id", ".", "indexOf", "(", "'", "'", ")", "+", "1", ")", ";"...
Get object path for given id and name. The format of the object id is <pre> type / path / objectName </pre> @param id object id @param name object name @return resource path
[ "Get", "object", "path", "for", "given", "id", "and", "name", ".", "The", "format", "of", "the", "object", "id", "is" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/persistence/RamPersistence.java#L113-L123
train
Red5/red5-server-common
src/main/java/org/red5/server/persistence/RamPersistence.java
RamPersistence.getObjectId
protected String getObjectId(IPersistable object) { // The format of the object id is <type>/<path>/<objectName> String result = object.getType(); if (object.getPath().charAt(0) != '/') { result += '/'; } result += object.getPath(); if (!result.endsWith("/")) { result += '/'; } String name = object.getName(); if (name == null) { name = PERSISTENCE_NO_NAME; } if (name.charAt(0) == '/') { // "result" already ends with a slash name = name.substring(1); } return result + name; }
java
protected String getObjectId(IPersistable object) { // The format of the object id is <type>/<path>/<objectName> String result = object.getType(); if (object.getPath().charAt(0) != '/') { result += '/'; } result += object.getPath(); if (!result.endsWith("/")) { result += '/'; } String name = object.getName(); if (name == null) { name = PERSISTENCE_NO_NAME; } if (name.charAt(0) == '/') { // "result" already ends with a slash name = name.substring(1); } return result + name; }
[ "protected", "String", "getObjectId", "(", "IPersistable", "object", ")", "{", "// The format of the object id is <type>/<path>/<objectName>\r", "String", "result", "=", "object", ".", "getType", "(", ")", ";", "if", "(", "object", ".", "getPath", "(", ")", ".", "...
Get object id @param object Persistable object whose id is asked for @return Given persistable object id
[ "Get", "object", "id" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/persistence/RamPersistence.java#L132-L151
train
Red5/red5-server-common
src/main/java/org/red5/server/BaseConnection.java
BaseConnection.connect
public boolean connect(IScope newScope, Object[] params) { if (log.isDebugEnabled()) { log.debug("Connect Params: {}", params); if (params != null) { for (Object e : params) { log.debug("Param: {}", e); } } } scope = (Scope) newScope; return scope.connect(this, params); }
java
public boolean connect(IScope newScope, Object[] params) { if (log.isDebugEnabled()) { log.debug("Connect Params: {}", params); if (params != null) { for (Object e : params) { log.debug("Param: {}", e); } } } scope = (Scope) newScope; return scope.connect(this, params); }
[ "public", "boolean", "connect", "(", "IScope", "newScope", ",", "Object", "[", "]", "params", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Connect Params: {}\"", ",", "params", ")", ";", "if", "(",...
Connect to another scope on server with given parameters @param newScope New scope @param params Parameters to connect with @return true on success, false otherwise
[ "Connect", "to", "another", "scope", "on", "server", "with", "given", "parameters" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/BaseConnection.java#L359-L370
train
Red5/red5-server-common
src/main/java/org/red5/server/BaseConnection.java
BaseConnection.unregisterBasicScope
public void unregisterBasicScope(IBasicScope basicScope) { if (basicScope instanceof IBroadcastScope || basicScope instanceof SharedObjectScope) { basicScopes.remove(basicScope); basicScope.removeEventListener(this); } }
java
public void unregisterBasicScope(IBasicScope basicScope) { if (basicScope instanceof IBroadcastScope || basicScope instanceof SharedObjectScope) { basicScopes.remove(basicScope); basicScope.removeEventListener(this); } }
[ "public", "void", "unregisterBasicScope", "(", "IBasicScope", "basicScope", ")", "{", "if", "(", "basicScope", "instanceof", "IBroadcastScope", "||", "basicScope", "instanceof", "SharedObjectScope", ")", "{", "basicScopes", ".", "remove", "(", "basicScope", ")", ";"...
Unregister basic scope @param basicScope Unregister basic scope
[ "Unregister", "basic", "scope" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/BaseConnection.java#L491-L496
train
Red5/red5-server-common
src/main/java/org/red5/server/scope/BasicScope.java
BasicScope.isValid
public boolean isValid() { // to be valid a scope must have a type set other than undefined and its name will be set return (type != null && !type.equals(ScopeType.UNDEFINED) && (name != null && !("").equals(name))); }
java
public boolean isValid() { // to be valid a scope must have a type set other than undefined and its name will be set return (type != null && !type.equals(ScopeType.UNDEFINED) && (name != null && !("").equals(name))); }
[ "public", "boolean", "isValid", "(", ")", "{", "// to be valid a scope must have a type set other than undefined and its name will be set\r", "return", "(", "type", "!=", "null", "&&", "!", "type", ".", "equals", "(", "ScopeType", ".", "UNDEFINED", ")", "&&", "(", "na...
Validates a scope based on its name and type @return true if both name and type are valid, false otherwise
[ "Validates", "a", "scope", "based", "on", "its", "name", "and", "type" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/BasicScope.java#L208-L211
train
Red5/red5-server-common
src/main/java/org/red5/server/scope/BasicScope.java
BasicScope.addEventListener
public boolean addEventListener(IEventListener listener) { log.debug("addEventListener - scope: {} {}", getName(), listener); return listeners.add(listener); }
java
public boolean addEventListener(IEventListener listener) { log.debug("addEventListener - scope: {} {}", getName(), listener); return listeners.add(listener); }
[ "public", "boolean", "addEventListener", "(", "IEventListener", "listener", ")", "{", "log", ".", "debug", "(", "\"addEventListener - scope: {} {}\"", ",", "getName", "(", ")", ",", "listener", ")", ";", "return", "listeners", ".", "add", "(", "listener", ")", ...
Add event listener to list of notified objects @param listener Listening object @return true if listener is added and false otherwise
[ "Add", "event", "listener", "to", "list", "of", "notified", "objects" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/BasicScope.java#L282-L285
train
Red5/red5-server-common
src/main/java/org/red5/server/scope/BasicScope.java
BasicScope.removeEventListener
public boolean removeEventListener(IEventListener listener) { log.debug("removeEventListener - scope: {} {}", getName(), listener); if (log.isTraceEnabled()) { log.trace("Listeners - check #1: {}", listeners); } boolean removed = listeners.remove(listener); if (!keepOnDisconnect) { if (removed && keepAliveJobName == null) { if (ScopeUtils.isRoom(this) && listeners.isEmpty()) { // create job to kill the scope off if no listeners join within the delay ISchedulingService schedulingService = (ISchedulingService) parent.getContext().getBean(ISchedulingService.BEAN_NAME); // by default keep a scope around for a fraction of a second keepAliveJobName = schedulingService.addScheduledOnceJob((keepDelay > 0 ? keepDelay * 1000 : 100), new KeepAliveJob(this)); } } } else { log.trace("Scope: {} is exempt from removal when empty", getName()); } if (log.isTraceEnabled()) { log.trace("Listeners - check #2: {}", listeners); } return removed; }
java
public boolean removeEventListener(IEventListener listener) { log.debug("removeEventListener - scope: {} {}", getName(), listener); if (log.isTraceEnabled()) { log.trace("Listeners - check #1: {}", listeners); } boolean removed = listeners.remove(listener); if (!keepOnDisconnect) { if (removed && keepAliveJobName == null) { if (ScopeUtils.isRoom(this) && listeners.isEmpty()) { // create job to kill the scope off if no listeners join within the delay ISchedulingService schedulingService = (ISchedulingService) parent.getContext().getBean(ISchedulingService.BEAN_NAME); // by default keep a scope around for a fraction of a second keepAliveJobName = schedulingService.addScheduledOnceJob((keepDelay > 0 ? keepDelay * 1000 : 100), new KeepAliveJob(this)); } } } else { log.trace("Scope: {} is exempt from removal when empty", getName()); } if (log.isTraceEnabled()) { log.trace("Listeners - check #2: {}", listeners); } return removed; }
[ "public", "boolean", "removeEventListener", "(", "IEventListener", "listener", ")", "{", "log", ".", "debug", "(", "\"removeEventListener - scope: {} {}\"", ",", "getName", "(", ")", ",", "listener", ")", ";", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ...
Remove event listener from list of listeners @param listener Listener to remove @return true if listener is removed and false otherwise
[ "Remove", "event", "listener", "from", "list", "of", "listeners" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/BasicScope.java#L294-L316
train
Red5/red5-server-common
src/main/java/org/red5/server/adapter/AbstractScopeAdapter.java
AbstractScopeAdapter.checkBandwidth
public void checkBandwidth(Object o) { //Incoming object should be null IClient client = Red5.getConnectionLocal().getClient(); if (client != null) { client.checkBandwidth(); } }
java
public void checkBandwidth(Object o) { //Incoming object should be null IClient client = Red5.getConnectionLocal().getClient(); if (client != null) { client.checkBandwidth(); } }
[ "public", "void", "checkBandwidth", "(", "Object", "o", ")", "{", "//Incoming object should be null\r", "IClient", "client", "=", "Red5", ".", "getConnectionLocal", "(", ")", ".", "getClient", "(", ")", ";", "if", "(", "client", "!=", "null", ")", "{", "clie...
Calls the checkBandwidth method on the current client. @param o Object passed from Flash, not used at the moment
[ "Calls", "the", "checkBandwidth", "method", "on", "the", "current", "client", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/adapter/AbstractScopeAdapter.java#L278-L284
train
Red5/red5-server-common
src/main/java/org/red5/server/adapter/AbstractScopeAdapter.java
AbstractScopeAdapter.checkBandwidthUp
public Map<String, Object> checkBandwidthUp(Object[] params) { //Incoming object should be null IClient client = Red5.getConnectionLocal().getClient(); if (client != null) { return client.checkBandwidthUp(params); } return null; }
java
public Map<String, Object> checkBandwidthUp(Object[] params) { //Incoming object should be null IClient client = Red5.getConnectionLocal().getClient(); if (client != null) { return client.checkBandwidthUp(params); } return null; }
[ "public", "Map", "<", "String", ",", "Object", ">", "checkBandwidthUp", "(", "Object", "[", "]", "params", ")", "{", "//Incoming object should be null\r", "IClient", "client", "=", "Red5", ".", "getConnectionLocal", "(", ")", ".", "getClient", "(", ")", ";", ...
Calls the checkBandwidthUp method on the current client. @param params Object passed from Flash @return bandwidth results map
[ "Calls", "the", "checkBandwidthUp", "method", "on", "the", "current", "client", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/adapter/AbstractScopeAdapter.java#L293-L300
train
Red5/red5-server-common
src/main/java/org/red5/server/adapter/StatefulScopeWrappingAdapter.java
StatefulScopeWrappingAdapter.createChildScope
public boolean createChildScope(String name) { if (!scope.hasChildScope(name)) { return scope.createChildScope(name); } return false; }
java
public boolean createChildScope(String name) { if (!scope.hasChildScope(name)) { return scope.createChildScope(name); } return false; }
[ "public", "boolean", "createChildScope", "(", "String", "name", ")", "{", "if", "(", "!", "scope", ".", "hasChildScope", "(", "name", ")", ")", "{", "return", "scope", ".", "createChildScope", "(", "name", ")", ";", "}", "return", "false", ";", "}" ]
Creates child scope @param name Child scope name @return true on success, false otherwise
[ "Creates", "child", "scope" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/adapter/StatefulScopeWrappingAdapter.java#L176-L181
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/event/Notify.java
Notify.duplicate
public Notify duplicate() throws IOException, ClassNotFoundException { Notify result = new Notify(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); writeExternal(oos); oos.close(); byte[] buf = baos.toByteArray(); baos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(buf); ObjectInputStream ois = new ObjectInputStream(bais); result.readExternal(ois); ois.close(); bais.close(); // set the action if it exists result.setAction(getAction()); result.setSourceType(sourceType); result.setSource(source); result.setTimestamp(timestamp); return result; }
java
public Notify duplicate() throws IOException, ClassNotFoundException { Notify result = new Notify(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); writeExternal(oos); oos.close(); byte[] buf = baos.toByteArray(); baos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(buf); ObjectInputStream ois = new ObjectInputStream(bais); result.readExternal(ois); ois.close(); bais.close(); // set the action if it exists result.setAction(getAction()); result.setSourceType(sourceType); result.setSource(source); result.setTimestamp(timestamp); return result; }
[ "public", "Notify", "duplicate", "(", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "Notify", "result", "=", "new", "Notify", "(", ")", ";", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "ObjectOutputStrea...
Duplicate this Notify message to future injection Serialize to memory and deserialize, safe way. @return duplicated Notify event
[ "Duplicate", "this", "Notify", "message", "to", "future", "injection", "Serialize", "to", "memory", "and", "deserialize", "safe", "way", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/event/Notify.java#L279-L298
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.connectToProvider
private final void connectToProvider(String itemName) { log.debug("Attempting connection to {}", itemName); IMessageInput in = msgInReference.get(); if (in == null) { in = providerService.getLiveProviderInput(subscriberStream.getScope(), itemName, true); msgInReference.set(in); } if (in != null) { log.debug("Provider: {}", msgInReference.get()); if (in.subscribe(this, null)) { log.debug("Subscribed to {} provider", itemName); // execute the processes to get Live playback setup try { playLive(); } catch (IOException e) { log.warn("Could not play live stream: {}", itemName, e); } } else { log.warn("Subscribe to {} provider failed", itemName); } } else { log.warn("Provider was not found for {}", itemName); StreamService.sendNetStreamStatus(subscriberStream.getConnection(), StatusCodes.NS_PLAY_STREAMNOTFOUND, "Stream was not found", itemName, Status.ERROR, streamId); } }
java
private final void connectToProvider(String itemName) { log.debug("Attempting connection to {}", itemName); IMessageInput in = msgInReference.get(); if (in == null) { in = providerService.getLiveProviderInput(subscriberStream.getScope(), itemName, true); msgInReference.set(in); } if (in != null) { log.debug("Provider: {}", msgInReference.get()); if (in.subscribe(this, null)) { log.debug("Subscribed to {} provider", itemName); // execute the processes to get Live playback setup try { playLive(); } catch (IOException e) { log.warn("Could not play live stream: {}", itemName, e); } } else { log.warn("Subscribe to {} provider failed", itemName); } } else { log.warn("Provider was not found for {}", itemName); StreamService.sendNetStreamStatus(subscriberStream.getConnection(), StatusCodes.NS_PLAY_STREAMNOTFOUND, "Stream was not found", itemName, Status.ERROR, streamId); } }
[ "private", "final", "void", "connectToProvider", "(", "String", "itemName", ")", "{", "log", ".", "debug", "(", "\"Attempting connection to {}\"", ",", "itemName", ")", ";", "IMessageInput", "in", "=", "msgInReference", ".", "get", "(", ")", ";", "if", "(", ...
Connects to the data provider. @param itemName name of the item to play
[ "Connects", "to", "the", "data", "provider", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L660-L684
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.pause
public void pause(int position) throws IllegalStateException { // allow pause if playing or stopped switch (subscriberStream.getState()) { case PLAYING: case STOPPED: subscriberStream.setState(StreamState.PAUSED); clearWaitJobs(); sendPauseStatus(currentItem.get()); sendClearPing(); subscriberStream.onChange(StreamState.PAUSED, currentItem.get(), position); break; default: throw new IllegalStateException("Cannot pause in current state"); } }
java
public void pause(int position) throws IllegalStateException { // allow pause if playing or stopped switch (subscriberStream.getState()) { case PLAYING: case STOPPED: subscriberStream.setState(StreamState.PAUSED); clearWaitJobs(); sendPauseStatus(currentItem.get()); sendClearPing(); subscriberStream.onChange(StreamState.PAUSED, currentItem.get(), position); break; default: throw new IllegalStateException("Cannot pause in current state"); } }
[ "public", "void", "pause", "(", "int", "position", ")", "throws", "IllegalStateException", "{", "// allow pause if playing or stopped", "switch", "(", "subscriberStream", ".", "getState", "(", ")", ")", "{", "case", "PLAYING", ":", "case", "STOPPED", ":", "subscri...
Pause at position @param position Position in file @throws IllegalStateException If stream is stopped
[ "Pause", "at", "position" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L694-L708
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.seek
public void seek(int position) throws IllegalStateException, OperationNotSupportedException { // add this pending seek operation to the list pendingOperations.add(new SeekRunnable(position)); cancelDeferredStop(); ensurePullAndPushRunning(); }
java
public void seek(int position) throws IllegalStateException, OperationNotSupportedException { // add this pending seek operation to the list pendingOperations.add(new SeekRunnable(position)); cancelDeferredStop(); ensurePullAndPushRunning(); }
[ "public", "void", "seek", "(", "int", "position", ")", "throws", "IllegalStateException", ",", "OperationNotSupportedException", "{", "// add this pending seek operation to the list", "pendingOperations", ".", "add", "(", "new", "SeekRunnable", "(", "position", ")", ")", ...
Seek to a given position @param position Position @throws IllegalStateException If stream is in stopped state @throws OperationNotSupportedException If this object doesn't support the operation.
[ "Seek", "to", "a", "given", "position" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L756-L761
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.okayToSendMessage
private boolean okayToSendMessage(IRTMPEvent message) { if (message instanceof IStreamData) { final long now = System.currentTimeMillis(); // check client buffer size if (isClientBufferFull(now)) { return false; } // get pending message count long pending = pendingMessages(); if (bufferCheckInterval > 0 && now >= nextCheckBufferUnderrun) { if (pending > underrunTrigger) { // client is playing behind speed, notify him sendInsufficientBandwidthStatus(currentItem.get()); } nextCheckBufferUnderrun = now + bufferCheckInterval; } // check for under run if (pending > underrunTrigger) { // too many messages already queued on the connection return false; } return true; } else { String itemName = "Undefined"; // if current item exists get the name to help debug this issue if (currentItem.get() != null) { itemName = currentItem.get().getName(); } Object[] errorItems = new Object[] { message.getClass(), message.getDataType(), itemName }; throw new RuntimeException(String.format("Expected IStreamData but got %s (type %s) for %s", errorItems)); } }
java
private boolean okayToSendMessage(IRTMPEvent message) { if (message instanceof IStreamData) { final long now = System.currentTimeMillis(); // check client buffer size if (isClientBufferFull(now)) { return false; } // get pending message count long pending = pendingMessages(); if (bufferCheckInterval > 0 && now >= nextCheckBufferUnderrun) { if (pending > underrunTrigger) { // client is playing behind speed, notify him sendInsufficientBandwidthStatus(currentItem.get()); } nextCheckBufferUnderrun = now + bufferCheckInterval; } // check for under run if (pending > underrunTrigger) { // too many messages already queued on the connection return false; } return true; } else { String itemName = "Undefined"; // if current item exists get the name to help debug this issue if (currentItem.get() != null) { itemName = currentItem.get().getName(); } Object[] errorItems = new Object[] { message.getClass(), message.getDataType(), itemName }; throw new RuntimeException(String.format("Expected IStreamData but got %s (type %s) for %s", errorItems)); } }
[ "private", "boolean", "okayToSendMessage", "(", "IRTMPEvent", "message", ")", "{", "if", "(", "message", "instanceof", "IStreamData", ")", "{", "final", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "// check client buffer size", "if", "...
Check if it's okay to send the client more data. This takes the configured bandwidth as well as the requested client buffer into account. @param message @return true if it is ok to send more, false otherwise
[ "Check", "if", "it", "s", "okay", "to", "send", "the", "client", "more", "data", ".", "This", "takes", "the", "configured", "bandwidth", "as", "well", "as", "the", "requested", "client", "buffer", "into", "account", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L860-L891
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.isClientBufferFull
private boolean isClientBufferFull(final long now) { // check client buffer length when we've already sent some messages if (lastMessageTs > 0) { // duration the stream is playing / playback duration final long delta = now - playbackStart; // buffer size as requested by the client final long buffer = subscriberStream.getClientBufferDuration(); // expected amount of data present in client buffer final long buffered = lastMessageTs - delta; log.trace("isClientBufferFull: timestamp {} delta {} buffered {} buffer duration {}", new Object[] { lastMessageTs, delta, buffered, buffer }); // fix for SN-122, this sends double the size of the client buffer if (buffer > 0 && buffered > (buffer * 2)) { // client is likely to have enough data in the buffer return true; } } return false; }
java
private boolean isClientBufferFull(final long now) { // check client buffer length when we've already sent some messages if (lastMessageTs > 0) { // duration the stream is playing / playback duration final long delta = now - playbackStart; // buffer size as requested by the client final long buffer = subscriberStream.getClientBufferDuration(); // expected amount of data present in client buffer final long buffered = lastMessageTs - delta; log.trace("isClientBufferFull: timestamp {} delta {} buffered {} buffer duration {}", new Object[] { lastMessageTs, delta, buffered, buffer }); // fix for SN-122, this sends double the size of the client buffer if (buffer > 0 && buffered > (buffer * 2)) { // client is likely to have enough data in the buffer return true; } } return false; }
[ "private", "boolean", "isClientBufferFull", "(", "final", "long", "now", ")", "{", "// check client buffer length when we've already sent some messages", "if", "(", "lastMessageTs", ">", "0", ")", "{", "// duration the stream is playing / playback duration", "final", "long", ...
Estimate client buffer fill. @param now The current timestamp being used. @return True if it appears that the client buffer is full, otherwise false.
[ "Estimate", "client", "buffer", "fill", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L900-L917
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.ensurePullAndPushRunning
private void ensurePullAndPushRunning() { log.trace("State should be PLAYING to running this task: {}", subscriberStream.getState()); if (pullMode && pullAndPush == null && subscriberStream.getState() == StreamState.PLAYING) { // client buffer is at least 100ms pullAndPush = subscriberStream.scheduleWithFixedDelay(new PullAndPushRunnable(), 10); } }
java
private void ensurePullAndPushRunning() { log.trace("State should be PLAYING to running this task: {}", subscriberStream.getState()); if (pullMode && pullAndPush == null && subscriberStream.getState() == StreamState.PLAYING) { // client buffer is at least 100ms pullAndPush = subscriberStream.scheduleWithFixedDelay(new PullAndPushRunnable(), 10); } }
[ "private", "void", "ensurePullAndPushRunning", "(", ")", "{", "log", ".", "trace", "(", "\"State should be PLAYING to running this task: {}\"", ",", "subscriberStream", ".", "getState", "(", ")", ")", ";", "if", "(", "pullMode", "&&", "pullAndPush", "==", "null", ...
Make sure the pull and push processing is running.
[ "Make", "sure", "the", "pull", "and", "push", "processing", "is", "running", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L937-L943
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.clearWaitJobs
private void clearWaitJobs() { log.debug("Clear wait jobs"); if (pullAndPush != null) { subscriberStream.cancelJob(pullAndPush); releasePendingMessage(); pullAndPush = null; } if (waitLiveJob != null) { schedulingService.removeScheduledJob(waitLiveJob); waitLiveJob = null; } }
java
private void clearWaitJobs() { log.debug("Clear wait jobs"); if (pullAndPush != null) { subscriberStream.cancelJob(pullAndPush); releasePendingMessage(); pullAndPush = null; } if (waitLiveJob != null) { schedulingService.removeScheduledJob(waitLiveJob); waitLiveJob = null; } }
[ "private", "void", "clearWaitJobs", "(", ")", "{", "log", ".", "debug", "(", "\"Clear wait jobs\"", ")", ";", "if", "(", "pullAndPush", "!=", "null", ")", "{", "subscriberStream", ".", "cancelJob", "(", "pullAndPush", ")", ";", "releasePendingMessage", "(", ...
Clear all scheduled waiting jobs
[ "Clear", "all", "scheduled", "waiting", "jobs" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L948-L959
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.doPushMessage
private void doPushMessage(Status status) { StatusMessage message = new StatusMessage(); message.setBody(status); doPushMessage(message); }
java
private void doPushMessage(Status status) { StatusMessage message = new StatusMessage(); message.setBody(status); doPushMessage(message); }
[ "private", "void", "doPushMessage", "(", "Status", "status", ")", "{", "StatusMessage", "message", "=", "new", "StatusMessage", "(", ")", ";", "message", ".", "setBody", "(", "status", ")", ";", "doPushMessage", "(", "message", ")", ";", "}" ]
Sends a status message. @param status
[ "Sends", "a", "status", "message", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L966-L970
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.doPushMessage
private void doPushMessage(AbstractMessage message) { if (log.isTraceEnabled()) { String msgType = message.getMessageType(); log.trace("doPushMessage: {}", msgType); } IMessageOutput out = msgOutReference.get(); if (out != null) { try { out.pushMessage(message); if (message instanceof RTMPMessage) { IRTMPEvent body = ((RTMPMessage) message).getBody(); // update the last message sent's timestamp lastMessageTs = body.getTimestamp(); IoBuffer streamData = null; if (body instanceof IStreamData && (streamData = ((IStreamData<?>) body).getData()) != null) { bytesSent.addAndGet(streamData.limit()); } } } catch (IOException err) { log.warn("Error while pushing message", err); } } else { log.warn("Push message failed due to null output pipe"); } }
java
private void doPushMessage(AbstractMessage message) { if (log.isTraceEnabled()) { String msgType = message.getMessageType(); log.trace("doPushMessage: {}", msgType); } IMessageOutput out = msgOutReference.get(); if (out != null) { try { out.pushMessage(message); if (message instanceof RTMPMessage) { IRTMPEvent body = ((RTMPMessage) message).getBody(); // update the last message sent's timestamp lastMessageTs = body.getTimestamp(); IoBuffer streamData = null; if (body instanceof IStreamData && (streamData = ((IStreamData<?>) body).getData()) != null) { bytesSent.addAndGet(streamData.limit()); } } } catch (IOException err) { log.warn("Error while pushing message", err); } } else { log.warn("Push message failed due to null output pipe"); } }
[ "private", "void", "doPushMessage", "(", "AbstractMessage", "message", ")", "{", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ")", "{", "String", "msgType", "=", "message", ".", "getMessageType", "(", ")", ";", "log", ".", "trace", "(", "\"doPushMess...
Send message to output stream and handle exceptions. @param message The message to send.
[ "Send", "message", "to", "output", "stream", "and", "handle", "exceptions", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L978-L1002
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendMessage
private void sendMessage(RTMPMessage messageIn) { IRTMPEvent eventIn = messageIn.getBody(); IRTMPEvent event; switch (eventIn.getDataType()) { case Constants.TYPE_AGGREGATE: event = new Aggregate(((Aggregate) eventIn).getData()); break; case Constants.TYPE_AUDIO_DATA: event = new AudioData(((AudioData) eventIn).getData()); break; case Constants.TYPE_VIDEO_DATA: event = new VideoData(((VideoData) eventIn).getData()); break; default: event = new Notify(((Notify) eventIn).getData()); break; } // get the incoming event time int eventTime = eventIn.getTimestamp(); // get the incoming event source type and set on the outgoing event event.setSourceType(eventIn.getSourceType()); // instance the outgoing message RTMPMessage messageOut = RTMPMessage.build(event, eventTime); if (log.isTraceEnabled()) { log.trace("Source type - in: {} out: {}", eventIn.getSourceType(), messageOut.getBody().getSourceType()); long delta = System.currentTimeMillis() - playbackStart; log.trace("sendMessage: streamStartTS {}, length {}, streamOffset {}, timestamp {} last timestamp {} delta {} buffered {}", new Object[] { streamStartTS.get(), currentItem.get().getLength(), streamOffset, eventTime, lastMessageTs, delta, lastMessageTs - delta }); } if (playDecision == 1) { // 1 == vod/file if (eventTime > 0 && streamStartTS.compareAndSet(-1, eventTime)) { log.debug("sendMessage: set streamStartTS"); messageOut.getBody().setTimestamp(0); } long length = currentItem.get().getLength(); if (length >= 0) { int duration = eventTime - streamStartTS.get(); if (log.isTraceEnabled()) { log.trace("sendMessage duration={} length={}", duration, length); } if (duration - streamOffset >= length) { // sent enough data to client stop(); return; } } } else { // don't reset streamStartTS to 0 for live streams if (eventTime > 0 && streamStartTS.compareAndSet(-1, eventTime)) { log.debug("sendMessage: set streamStartTS"); } // relative timestamp adjustment for live streams int startTs = streamStartTS.get(); if (startTs > 0) { // subtract the offset time of when the stream started playing for the client eventTime -= startTs; messageOut.getBody().setTimestamp(eventTime); if (log.isTraceEnabled()) { log.trace("sendMessage (updated): streamStartTS={}, length={}, streamOffset={}, timestamp={}", new Object[] { startTs, currentItem.get().getLength(), streamOffset, eventTime }); } } } doPushMessage(messageOut); }
java
private void sendMessage(RTMPMessage messageIn) { IRTMPEvent eventIn = messageIn.getBody(); IRTMPEvent event; switch (eventIn.getDataType()) { case Constants.TYPE_AGGREGATE: event = new Aggregate(((Aggregate) eventIn).getData()); break; case Constants.TYPE_AUDIO_DATA: event = new AudioData(((AudioData) eventIn).getData()); break; case Constants.TYPE_VIDEO_DATA: event = new VideoData(((VideoData) eventIn).getData()); break; default: event = new Notify(((Notify) eventIn).getData()); break; } // get the incoming event time int eventTime = eventIn.getTimestamp(); // get the incoming event source type and set on the outgoing event event.setSourceType(eventIn.getSourceType()); // instance the outgoing message RTMPMessage messageOut = RTMPMessage.build(event, eventTime); if (log.isTraceEnabled()) { log.trace("Source type - in: {} out: {}", eventIn.getSourceType(), messageOut.getBody().getSourceType()); long delta = System.currentTimeMillis() - playbackStart; log.trace("sendMessage: streamStartTS {}, length {}, streamOffset {}, timestamp {} last timestamp {} delta {} buffered {}", new Object[] { streamStartTS.get(), currentItem.get().getLength(), streamOffset, eventTime, lastMessageTs, delta, lastMessageTs - delta }); } if (playDecision == 1) { // 1 == vod/file if (eventTime > 0 && streamStartTS.compareAndSet(-1, eventTime)) { log.debug("sendMessage: set streamStartTS"); messageOut.getBody().setTimestamp(0); } long length = currentItem.get().getLength(); if (length >= 0) { int duration = eventTime - streamStartTS.get(); if (log.isTraceEnabled()) { log.trace("sendMessage duration={} length={}", duration, length); } if (duration - streamOffset >= length) { // sent enough data to client stop(); return; } } } else { // don't reset streamStartTS to 0 for live streams if (eventTime > 0 && streamStartTS.compareAndSet(-1, eventTime)) { log.debug("sendMessage: set streamStartTS"); } // relative timestamp adjustment for live streams int startTs = streamStartTS.get(); if (startTs > 0) { // subtract the offset time of when the stream started playing for the client eventTime -= startTs; messageOut.getBody().setTimestamp(eventTime); if (log.isTraceEnabled()) { log.trace("sendMessage (updated): streamStartTS={}, length={}, streamOffset={}, timestamp={}", new Object[] { startTs, currentItem.get().getLength(), streamOffset, eventTime }); } } } doPushMessage(messageOut); }
[ "private", "void", "sendMessage", "(", "RTMPMessage", "messageIn", ")", "{", "IRTMPEvent", "eventIn", "=", "messageIn", ".", "getBody", "(", ")", ";", "IRTMPEvent", "event", ";", "switch", "(", "eventIn", ".", "getDataType", "(", ")", ")", "{", "case", "Co...
Send an RTMP message @param messageIn incoming RTMP message
[ "Send", "an", "RTMP", "message" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1010-L1072
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendClearPing
private void sendClearPing() { Ping eof = new Ping(); eof.setEventType(Ping.STREAM_PLAYBUFFER_CLEAR); eof.setValue2(streamId); // eos RTMPMessage eofMsg = RTMPMessage.build(eof); doPushMessage(eofMsg); }
java
private void sendClearPing() { Ping eof = new Ping(); eof.setEventType(Ping.STREAM_PLAYBUFFER_CLEAR); eof.setValue2(streamId); // eos RTMPMessage eofMsg = RTMPMessage.build(eof); doPushMessage(eofMsg); }
[ "private", "void", "sendClearPing", "(", ")", "{", "Ping", "eof", "=", "new", "Ping", "(", ")", ";", "eof", ".", "setEventType", "(", "Ping", ".", "STREAM_PLAYBUFFER_CLEAR", ")", ";", "eof", ".", "setValue2", "(", "streamId", ")", ";", "// eos ", "RTMPMe...
Send clear ping. Lets client know that stream has no more data to send.
[ "Send", "clear", "ping", ".", "Lets", "client", "know", "that", "stream", "has", "no", "more", "data", "to", "send", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1077-L1084
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendReset
private void sendReset() { if (pullMode) { Ping recorded = new Ping(); recorded.setEventType(Ping.RECORDED_STREAM); recorded.setValue2(streamId); // recorded RTMPMessage recordedMsg = RTMPMessage.build(recorded); doPushMessage(recordedMsg); } Ping begin = new Ping(); begin.setEventType(Ping.STREAM_BEGIN); begin.setValue2(streamId); // begin RTMPMessage beginMsg = RTMPMessage.build(begin); doPushMessage(beginMsg); // reset ResetMessage reset = new ResetMessage(); doPushMessage(reset); }
java
private void sendReset() { if (pullMode) { Ping recorded = new Ping(); recorded.setEventType(Ping.RECORDED_STREAM); recorded.setValue2(streamId); // recorded RTMPMessage recordedMsg = RTMPMessage.build(recorded); doPushMessage(recordedMsg); } Ping begin = new Ping(); begin.setEventType(Ping.STREAM_BEGIN); begin.setValue2(streamId); // begin RTMPMessage beginMsg = RTMPMessage.build(begin); doPushMessage(beginMsg); // reset ResetMessage reset = new ResetMessage(); doPushMessage(reset); }
[ "private", "void", "sendReset", "(", ")", "{", "if", "(", "pullMode", ")", "{", "Ping", "recorded", "=", "new", "Ping", "(", ")", ";", "recorded", ".", "setEventType", "(", "Ping", ".", "RECORDED_STREAM", ")", ";", "recorded", ".", "setValue2", "(", "s...
Send reset message
[ "Send", "reset", "message" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1089-L1107
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendResetStatus
private void sendResetStatus(IPlayItem item) { Status reset = new Status(StatusCodes.NS_PLAY_RESET); reset.setClientid(streamId); reset.setDetails(item.getName()); reset.setDesciption(String.format("Playing and resetting %s.", item.getName())); doPushMessage(reset); }
java
private void sendResetStatus(IPlayItem item) { Status reset = new Status(StatusCodes.NS_PLAY_RESET); reset.setClientid(streamId); reset.setDetails(item.getName()); reset.setDesciption(String.format("Playing and resetting %s.", item.getName())); doPushMessage(reset); }
[ "private", "void", "sendResetStatus", "(", "IPlayItem", "item", ")", "{", "Status", "reset", "=", "new", "Status", "(", "StatusCodes", ".", "NS_PLAY_RESET", ")", ";", "reset", ".", "setClientid", "(", "streamId", ")", ";", "reset", ".", "setDetails", "(", ...
Send reset status for item @param item Playlist item
[ "Send", "reset", "status", "for", "item" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1115-L1122
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendStartStatus
private void sendStartStatus(IPlayItem item) { Status start = new Status(StatusCodes.NS_PLAY_START); start.setClientid(streamId); start.setDetails(item.getName()); start.setDesciption(String.format("Started playing %s.", item.getName())); doPushMessage(start); }
java
private void sendStartStatus(IPlayItem item) { Status start = new Status(StatusCodes.NS_PLAY_START); start.setClientid(streamId); start.setDetails(item.getName()); start.setDesciption(String.format("Started playing %s.", item.getName())); doPushMessage(start); }
[ "private", "void", "sendStartStatus", "(", "IPlayItem", "item", ")", "{", "Status", "start", "=", "new", "Status", "(", "StatusCodes", ".", "NS_PLAY_START", ")", ";", "start", ".", "setClientid", "(", "streamId", ")", ";", "start", ".", "setDetails", "(", ...
Send playback start status notification @param item Playlist item
[ "Send", "playback", "start", "status", "notification" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1130-L1137
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendStopStatus
private void sendStopStatus(IPlayItem item) { Status stop = new Status(StatusCodes.NS_PLAY_STOP); stop.setClientid(streamId); stop.setDesciption(String.format("Stopped playing %s.", item.getName())); stop.setDetails(item.getName()); doPushMessage(stop); }
java
private void sendStopStatus(IPlayItem item) { Status stop = new Status(StatusCodes.NS_PLAY_STOP); stop.setClientid(streamId); stop.setDesciption(String.format("Stopped playing %s.", item.getName())); stop.setDetails(item.getName()); doPushMessage(stop); }
[ "private", "void", "sendStopStatus", "(", "IPlayItem", "item", ")", "{", "Status", "stop", "=", "new", "Status", "(", "StatusCodes", ".", "NS_PLAY_STOP", ")", ";", "stop", ".", "setClientid", "(", "streamId", ")", ";", "stop", ".", "setDesciption", "(", "S...
Send playback stoppage status notification @param item Playlist item
[ "Send", "playback", "stoppage", "status", "notification" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1145-L1152
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendOnPlayStatus
private void sendOnPlayStatus(String code, int duration, long bytes) { if (log.isDebugEnabled()) { log.debug("Sending onPlayStatus - code: {} duration: {} bytes: {}", code, duration, bytes); } // create the buffer IoBuffer buf = IoBuffer.allocate(102); buf.setAutoExpand(true); Output out = new Output(buf); out.writeString("onPlayStatus"); ObjectMap<Object, Object> args = new ObjectMap<>(); args.put("code", code); args.put("level", Status.STATUS); args.put("duration", duration); args.put("bytes", bytes); String name = currentItem.get().getName(); if (StatusCodes.NS_PLAY_TRANSITION_COMPLETE.equals(code)) { args.put("clientId", streamId); args.put("details", name); args.put("description", String.format("Transitioned to %s", name)); args.put("isFastPlay", false); } out.writeObject(args); buf.flip(); Notify event = new Notify(buf, "onPlayStatus"); if (lastMessageTs > 0) { event.setTimestamp(lastMessageTs); } else { event.setTimestamp(0); } RTMPMessage msg = RTMPMessage.build(event); doPushMessage(msg); }
java
private void sendOnPlayStatus(String code, int duration, long bytes) { if (log.isDebugEnabled()) { log.debug("Sending onPlayStatus - code: {} duration: {} bytes: {}", code, duration, bytes); } // create the buffer IoBuffer buf = IoBuffer.allocate(102); buf.setAutoExpand(true); Output out = new Output(buf); out.writeString("onPlayStatus"); ObjectMap<Object, Object> args = new ObjectMap<>(); args.put("code", code); args.put("level", Status.STATUS); args.put("duration", duration); args.put("bytes", bytes); String name = currentItem.get().getName(); if (StatusCodes.NS_PLAY_TRANSITION_COMPLETE.equals(code)) { args.put("clientId", streamId); args.put("details", name); args.put("description", String.format("Transitioned to %s", name)); args.put("isFastPlay", false); } out.writeObject(args); buf.flip(); Notify event = new Notify(buf, "onPlayStatus"); if (lastMessageTs > 0) { event.setTimestamp(lastMessageTs); } else { event.setTimestamp(0); } RTMPMessage msg = RTMPMessage.build(event); doPushMessage(msg); }
[ "private", "void", "sendOnPlayStatus", "(", "String", "code", ",", "int", "duration", ",", "long", "bytes", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Sending onPlayStatus - code: {} duration: {} bytes: {}...
Sends an onPlayStatus message. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/NetDataEvent.html @param code @param duration @param bytes
[ "Sends", "an", "onPlayStatus", "message", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1163-L1194
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendCompleteStatus
private void sendCompleteStatus() { // may be the correct duration int duration = (lastMessageTs > 0) ? Math.max(0, lastMessageTs - streamStartTS.get()) : 0; if (log.isDebugEnabled()) { log.debug("sendCompleteStatus - duration: {} bytes sent: {}", duration, bytesSent.get()); } sendOnPlayStatus(StatusCodes.NS_PLAY_COMPLETE, duration, bytesSent.get()); }
java
private void sendCompleteStatus() { // may be the correct duration int duration = (lastMessageTs > 0) ? Math.max(0, lastMessageTs - streamStartTS.get()) : 0; if (log.isDebugEnabled()) { log.debug("sendCompleteStatus - duration: {} bytes sent: {}", duration, bytesSent.get()); } sendOnPlayStatus(StatusCodes.NS_PLAY_COMPLETE, duration, bytesSent.get()); }
[ "private", "void", "sendCompleteStatus", "(", ")", "{", "// may be the correct duration", "int", "duration", "=", "(", "lastMessageTs", ">", "0", ")", "?", "Math", ".", "max", "(", "0", ",", "lastMessageTs", "-", "streamStartTS", ".", "get", "(", ")", ")", ...
Send playlist complete status notification
[ "Send", "playlist", "complete", "status", "notification" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1215-L1222
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendSeekStatus
private void sendSeekStatus(IPlayItem item, int position) { Status seek = new Status(StatusCodes.NS_SEEK_NOTIFY); seek.setClientid(streamId); seek.setDetails(item.getName()); seek.setDesciption(String.format("Seeking %d (stream ID: %d).", position, streamId)); doPushMessage(seek); }
java
private void sendSeekStatus(IPlayItem item, int position) { Status seek = new Status(StatusCodes.NS_SEEK_NOTIFY); seek.setClientid(streamId); seek.setDetails(item.getName()); seek.setDesciption(String.format("Seeking %d (stream ID: %d).", position, streamId)); doPushMessage(seek); }
[ "private", "void", "sendSeekStatus", "(", "IPlayItem", "item", ",", "int", "position", ")", "{", "Status", "seek", "=", "new", "Status", "(", "StatusCodes", ".", "NS_SEEK_NOTIFY", ")", ";", "seek", ".", "setClientid", "(", "streamId", ")", ";", "seek", "."...
Send seek status notification @param item Playlist item @param position Seek position
[ "Send", "seek", "status", "notification" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1232-L1239
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendPauseStatus
private void sendPauseStatus(IPlayItem item) { Status pause = new Status(StatusCodes.NS_PAUSE_NOTIFY); pause.setClientid(streamId); pause.setDetails(item.getName()); doPushMessage(pause); }
java
private void sendPauseStatus(IPlayItem item) { Status pause = new Status(StatusCodes.NS_PAUSE_NOTIFY); pause.setClientid(streamId); pause.setDetails(item.getName()); doPushMessage(pause); }
[ "private", "void", "sendPauseStatus", "(", "IPlayItem", "item", ")", "{", "Status", "pause", "=", "new", "Status", "(", "StatusCodes", ".", "NS_PAUSE_NOTIFY", ")", ";", "pause", ".", "setClientid", "(", "streamId", ")", ";", "pause", ".", "setDetails", "(", ...
Send pause status notification @param item Playlist item
[ "Send", "pause", "status", "notification" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1247-L1253
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendResumeStatus
private void sendResumeStatus(IPlayItem item) { Status resume = new Status(StatusCodes.NS_UNPAUSE_NOTIFY); resume.setClientid(streamId); resume.setDetails(item.getName()); doPushMessage(resume); }
java
private void sendResumeStatus(IPlayItem item) { Status resume = new Status(StatusCodes.NS_UNPAUSE_NOTIFY); resume.setClientid(streamId); resume.setDetails(item.getName()); doPushMessage(resume); }
[ "private", "void", "sendResumeStatus", "(", "IPlayItem", "item", ")", "{", "Status", "resume", "=", "new", "Status", "(", "StatusCodes", ".", "NS_UNPAUSE_NOTIFY", ")", ";", "resume", ".", "setClientid", "(", "streamId", ")", ";", "resume", ".", "setDetails", ...
Send resume status notification @param item Playlist item
[ "Send", "resume", "status", "notification" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1261-L1267
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendPublishedStatus
private void sendPublishedStatus(IPlayItem item) { Status published = new Status(StatusCodes.NS_PLAY_PUBLISHNOTIFY); published.setClientid(streamId); published.setDetails(item.getName()); doPushMessage(published); }
java
private void sendPublishedStatus(IPlayItem item) { Status published = new Status(StatusCodes.NS_PLAY_PUBLISHNOTIFY); published.setClientid(streamId); published.setDetails(item.getName()); doPushMessage(published); }
[ "private", "void", "sendPublishedStatus", "(", "IPlayItem", "item", ")", "{", "Status", "published", "=", "new", "Status", "(", "StatusCodes", ".", "NS_PLAY_PUBLISHNOTIFY", ")", ";", "published", ".", "setClientid", "(", "streamId", ")", ";", "published", ".", ...
Send published status notification @param item Playlist item
[ "Send", "published", "status", "notification" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1275-L1281
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendUnpublishedStatus
private void sendUnpublishedStatus(IPlayItem item) { Status unpublished = new Status(StatusCodes.NS_PLAY_UNPUBLISHNOTIFY); unpublished.setClientid(streamId); unpublished.setDetails(item.getName()); doPushMessage(unpublished); }
java
private void sendUnpublishedStatus(IPlayItem item) { Status unpublished = new Status(StatusCodes.NS_PLAY_UNPUBLISHNOTIFY); unpublished.setClientid(streamId); unpublished.setDetails(item.getName()); doPushMessage(unpublished); }
[ "private", "void", "sendUnpublishedStatus", "(", "IPlayItem", "item", ")", "{", "Status", "unpublished", "=", "new", "Status", "(", "StatusCodes", ".", "NS_PLAY_UNPUBLISHNOTIFY", ")", ";", "unpublished", ".", "setClientid", "(", "streamId", ")", ";", "unpublished"...
Send unpublished status notification @param item Playlist item
[ "Send", "unpublished", "status", "notification" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1289-L1295
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendStreamNotFoundStatus
private void sendStreamNotFoundStatus(IPlayItem item) { Status notFound = new Status(StatusCodes.NS_PLAY_STREAMNOTFOUND); notFound.setClientid(streamId); notFound.setLevel(Status.ERROR); notFound.setDetails(item.getName()); doPushMessage(notFound); }
java
private void sendStreamNotFoundStatus(IPlayItem item) { Status notFound = new Status(StatusCodes.NS_PLAY_STREAMNOTFOUND); notFound.setClientid(streamId); notFound.setLevel(Status.ERROR); notFound.setDetails(item.getName()); doPushMessage(notFound); }
[ "private", "void", "sendStreamNotFoundStatus", "(", "IPlayItem", "item", ")", "{", "Status", "notFound", "=", "new", "Status", "(", "StatusCodes", ".", "NS_PLAY_STREAMNOTFOUND", ")", ";", "notFound", ".", "setClientid", "(", "streamId", ")", ";", "notFound", "."...
Stream not found status notification @param item Playlist item
[ "Stream", "not", "found", "status", "notification" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1303-L1310
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendInsufficientBandwidthStatus
private void sendInsufficientBandwidthStatus(IPlayItem item) { Status insufficientBW = new Status(StatusCodes.NS_PLAY_INSUFFICIENT_BW); insufficientBW.setClientid(streamId); insufficientBW.setLevel(Status.WARNING); insufficientBW.setDetails(item.getName()); insufficientBW.setDesciption("Data is playing behind the normal speed."); doPushMessage(insufficientBW); }
java
private void sendInsufficientBandwidthStatus(IPlayItem item) { Status insufficientBW = new Status(StatusCodes.NS_PLAY_INSUFFICIENT_BW); insufficientBW.setClientid(streamId); insufficientBW.setLevel(Status.WARNING); insufficientBW.setDetails(item.getName()); insufficientBW.setDesciption("Data is playing behind the normal speed."); doPushMessage(insufficientBW); }
[ "private", "void", "sendInsufficientBandwidthStatus", "(", "IPlayItem", "item", ")", "{", "Status", "insufficientBW", "=", "new", "Status", "(", "StatusCodes", ".", "NS_PLAY_INSUFFICIENT_BW", ")", ";", "insufficientBW", ".", "setClientid", "(", "streamId", ")", ";",...
Insufficient bandwidth notification @param item Playlist item
[ "Insufficient", "bandwidth", "notification" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1318-L1326
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendVODInitCM
private void sendVODInitCM(IPlayItem item) { OOBControlMessage oobCtrlMsg = new OOBControlMessage(); oobCtrlMsg.setTarget(IPassive.KEY); oobCtrlMsg.setServiceName("init"); Map<String, Object> paramMap = new HashMap<String, Object>(1); paramMap.put("startTS", (int) item.getStart()); oobCtrlMsg.setServiceParamMap(paramMap); msgInReference.get().sendOOBControlMessage(this, oobCtrlMsg); }
java
private void sendVODInitCM(IPlayItem item) { OOBControlMessage oobCtrlMsg = new OOBControlMessage(); oobCtrlMsg.setTarget(IPassive.KEY); oobCtrlMsg.setServiceName("init"); Map<String, Object> paramMap = new HashMap<String, Object>(1); paramMap.put("startTS", (int) item.getStart()); oobCtrlMsg.setServiceParamMap(paramMap); msgInReference.get().sendOOBControlMessage(this, oobCtrlMsg); }
[ "private", "void", "sendVODInitCM", "(", "IPlayItem", "item", ")", "{", "OOBControlMessage", "oobCtrlMsg", "=", "new", "OOBControlMessage", "(", ")", ";", "oobCtrlMsg", ".", "setTarget", "(", "IPassive", ".", "KEY", ")", ";", "oobCtrlMsg", ".", "setServiceName",...
Send VOD init control message @param item Playlist item
[ "Send", "VOD", "init", "control", "message" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1334-L1342
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendVODSeekCM
private int sendVODSeekCM(int position) { OOBControlMessage oobCtrlMsg = new OOBControlMessage(); oobCtrlMsg.setTarget(ISeekableProvider.KEY); oobCtrlMsg.setServiceName("seek"); Map<String, Object> paramMap = new HashMap<String, Object>(1); paramMap.put("position", position); oobCtrlMsg.setServiceParamMap(paramMap); msgInReference.get().sendOOBControlMessage(this, oobCtrlMsg); if (oobCtrlMsg.getResult() instanceof Integer) { return (Integer) oobCtrlMsg.getResult(); } else { return -1; } }
java
private int sendVODSeekCM(int position) { OOBControlMessage oobCtrlMsg = new OOBControlMessage(); oobCtrlMsg.setTarget(ISeekableProvider.KEY); oobCtrlMsg.setServiceName("seek"); Map<String, Object> paramMap = new HashMap<String, Object>(1); paramMap.put("position", position); oobCtrlMsg.setServiceParamMap(paramMap); msgInReference.get().sendOOBControlMessage(this, oobCtrlMsg); if (oobCtrlMsg.getResult() instanceof Integer) { return (Integer) oobCtrlMsg.getResult(); } else { return -1; } }
[ "private", "int", "sendVODSeekCM", "(", "int", "position", ")", "{", "OOBControlMessage", "oobCtrlMsg", "=", "new", "OOBControlMessage", "(", ")", ";", "oobCtrlMsg", ".", "setTarget", "(", "ISeekableProvider", ".", "KEY", ")", ";", "oobCtrlMsg", ".", "setService...
Send VOD seek control message @param msgIn Message input @param position Playlist item @return Out-of-band control message call result or -1 on failure
[ "Send", "VOD", "seek", "control", "message" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1353-L1366
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendCheckVideoCM
private boolean sendCheckVideoCM() { OOBControlMessage oobCtrlMsg = new OOBControlMessage(); oobCtrlMsg.setTarget(IStreamTypeAwareProvider.KEY); oobCtrlMsg.setServiceName("hasVideo"); msgInReference.get().sendOOBControlMessage(this, oobCtrlMsg); if (oobCtrlMsg.getResult() instanceof Boolean) { return (Boolean) oobCtrlMsg.getResult(); } else { return false; } }
java
private boolean sendCheckVideoCM() { OOBControlMessage oobCtrlMsg = new OOBControlMessage(); oobCtrlMsg.setTarget(IStreamTypeAwareProvider.KEY); oobCtrlMsg.setServiceName("hasVideo"); msgInReference.get().sendOOBControlMessage(this, oobCtrlMsg); if (oobCtrlMsg.getResult() instanceof Boolean) { return (Boolean) oobCtrlMsg.getResult(); } else { return false; } }
[ "private", "boolean", "sendCheckVideoCM", "(", ")", "{", "OOBControlMessage", "oobCtrlMsg", "=", "new", "OOBControlMessage", "(", ")", ";", "oobCtrlMsg", ".", "setTarget", "(", "IStreamTypeAwareProvider", ".", "KEY", ")", ";", "oobCtrlMsg", ".", "setServiceName", ...
Send VOD check video control message @return result of oob control message
[ "Send", "VOD", "check", "video", "control", "message" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1373-L1383
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.pendingVideoMessages
private long pendingVideoMessages() { IMessageOutput out = msgOutReference.get(); if (out != null) { OOBControlMessage pendingRequest = new OOBControlMessage(); pendingRequest.setTarget("ConnectionConsumer"); pendingRequest.setServiceName("pendingVideoCount"); out.sendOOBControlMessage(this, pendingRequest); if (pendingRequest.getResult() != null) { return (Long) pendingRequest.getResult(); } } return 0; }
java
private long pendingVideoMessages() { IMessageOutput out = msgOutReference.get(); if (out != null) { OOBControlMessage pendingRequest = new OOBControlMessage(); pendingRequest.setTarget("ConnectionConsumer"); pendingRequest.setServiceName("pendingVideoCount"); out.sendOOBControlMessage(this, pendingRequest); if (pendingRequest.getResult() != null) { return (Long) pendingRequest.getResult(); } } return 0; }
[ "private", "long", "pendingVideoMessages", "(", ")", "{", "IMessageOutput", "out", "=", "msgOutReference", ".", "get", "(", ")", ";", "if", "(", "out", "!=", "null", ")", "{", "OOBControlMessage", "pendingRequest", "=", "new", "OOBControlMessage", "(", ")", ...
Get number of pending video messages @return Number of pending video messages
[ "Get", "number", "of", "pending", "video", "messages" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1573-L1585
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.releasePendingMessage
private void releasePendingMessage() { if (pendingMessage != null) { IRTMPEvent body = pendingMessage.getBody(); if (body instanceof IStreamData && ((IStreamData<?>) body).getData() != null) { ((IStreamData<?>) body).getData().free(); } pendingMessage = null; } }
java
private void releasePendingMessage() { if (pendingMessage != null) { IRTMPEvent body = pendingMessage.getBody(); if (body instanceof IStreamData && ((IStreamData<?>) body).getData() != null) { ((IStreamData<?>) body).getData().free(); } pendingMessage = null; } }
[ "private", "void", "releasePendingMessage", "(", ")", "{", "if", "(", "pendingMessage", "!=", "null", ")", "{", "IRTMPEvent", "body", "=", "pendingMessage", ".", "getBody", "(", ")", ";", "if", "(", "body", "instanceof", "IStreamData", "&&", "(", "(", "ISt...
Releases pending message body, nullifies pending message object
[ "Releases", "pending", "message", "body", "nullifies", "pending", "message", "object" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1674-L1682
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.checkSendMessageEnabled
protected boolean checkSendMessageEnabled(RTMPMessage message) { IRTMPEvent body = message.getBody(); if (!receiveAudio && body instanceof AudioData) { // The user doesn't want to get audio packets ((IStreamData<?>) body).getData().free(); if (sendBlankAudio) { // Send reset audio packet sendBlankAudio = false; body = new AudioData(); // We need a zero timestamp if (lastMessageTs >= 0) { body.setTimestamp(lastMessageTs - timestampOffset); } else { body.setTimestamp(-timestampOffset); } message = RTMPMessage.build(body); } else { return false; } } else if (!receiveVideo && body instanceof VideoData) { // The user doesn't want to get video packets ((IStreamData<?>) body).getData().free(); return false; } return true; }
java
protected boolean checkSendMessageEnabled(RTMPMessage message) { IRTMPEvent body = message.getBody(); if (!receiveAudio && body instanceof AudioData) { // The user doesn't want to get audio packets ((IStreamData<?>) body).getData().free(); if (sendBlankAudio) { // Send reset audio packet sendBlankAudio = false; body = new AudioData(); // We need a zero timestamp if (lastMessageTs >= 0) { body.setTimestamp(lastMessageTs - timestampOffset); } else { body.setTimestamp(-timestampOffset); } message = RTMPMessage.build(body); } else { return false; } } else if (!receiveVideo && body instanceof VideoData) { // The user doesn't want to get video packets ((IStreamData<?>) body).getData().free(); return false; } return true; }
[ "protected", "boolean", "checkSendMessageEnabled", "(", "RTMPMessage", "message", ")", "{", "IRTMPEvent", "body", "=", "message", ".", "getBody", "(", ")", ";", "if", "(", "!", "receiveAudio", "&&", "body", "instanceof", "AudioData", ")", "{", "// The user doesn...
Check if sending the given message was enabled by the client. @param message the message to check @return true if the message should be sent, false otherwise (and the message is discarded)
[ "Check", "if", "sending", "the", "given", "message", "was", "enabled", "by", "the", "client", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1691-L1716
train
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.runDeferredStop
private void runDeferredStop() { // Stop current jobs from running. clearWaitJobs(); // Schedule deferred stop executor. log.trace("Ran deferred stop"); if (deferredStop == null) { // set deferred stop if we get a job name returned deferredStop = subscriberStream.scheduleWithFixedDelay(new DeferredStopRunnable(), 100); } }
java
private void runDeferredStop() { // Stop current jobs from running. clearWaitJobs(); // Schedule deferred stop executor. log.trace("Ran deferred stop"); if (deferredStop == null) { // set deferred stop if we get a job name returned deferredStop = subscriberStream.scheduleWithFixedDelay(new DeferredStopRunnable(), 100); } }
[ "private", "void", "runDeferredStop", "(", ")", "{", "// Stop current jobs from running.", "clearWaitJobs", "(", ")", ";", "// Schedule deferred stop executor.", "log", ".", "trace", "(", "\"Ran deferred stop\"", ")", ";", "if", "(", "deferredStop", "==", "null", ")",...
Schedule a stop to be run from a separate thread to allow the background thread to stop cleanly.
[ "Schedule", "a", "stop", "to", "be", "run", "from", "a", "separate", "thread", "to", "allow", "the", "background", "thread", "to", "stop", "cleanly", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1721-L1730
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/event/AllocationDebugger.java
AllocationDebugger.release
protected void release(BaseEvent event) { Info info = events.get(event); if (info != null) { if (info.refcount.decrementAndGet() == 0) { events.remove(event); } } else { log.warn("Release called on already released event."); } }
java
protected void release(BaseEvent event) { Info info = events.get(event); if (info != null) { if (info.refcount.decrementAndGet() == 0) { events.remove(event); } } else { log.warn("Release called on already released event."); } }
[ "protected", "void", "release", "(", "BaseEvent", "event", ")", "{", "Info", "info", "=", "events", ".", "get", "(", "event", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "if", "(", "info", ".", "refcount", ".", "decrementAndGet", "(", ")", ...
Release event if there's no more references to it @param event Event
[ "Release", "event", "if", "there", "s", "no", "more", "references", "to", "it" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/event/AllocationDebugger.java#L114-L123
train
Red5/red5-server-common
src/main/java/org/red5/server/util/ScopeUtils.java
ScopeUtils.resolveScope
public static IScope resolveScope(IScope from, String path) { log.debug("resolveScope from: {} path: {}", from.getName(), path); IScope current = from; if (path.startsWith(SLASH)) { current = ScopeUtils.findRoot(current); path = path.substring(1, path.length()); } if (path.endsWith(SLASH)) { path = path.substring(0, path.length() - 1); } log.trace("Current: {}", current); String[] parts = path.split(SLASH); if (log.isTraceEnabled()) { log.trace("Parts: {}", Arrays.toString(parts)); } for (String part : parts) { log.trace("Part: {}", part); if (part.equals(".")) { continue; } if (part.equals("..")) { if (!current.hasParent()) { return null; } current = current.getParent(); continue; } if (!current.hasChildScope(part)) { return null; } current = current.getScope(part); log.trace("Current: {}", current); } return current; }
java
public static IScope resolveScope(IScope from, String path) { log.debug("resolveScope from: {} path: {}", from.getName(), path); IScope current = from; if (path.startsWith(SLASH)) { current = ScopeUtils.findRoot(current); path = path.substring(1, path.length()); } if (path.endsWith(SLASH)) { path = path.substring(0, path.length() - 1); } log.trace("Current: {}", current); String[] parts = path.split(SLASH); if (log.isTraceEnabled()) { log.trace("Parts: {}", Arrays.toString(parts)); } for (String part : parts) { log.trace("Part: {}", part); if (part.equals(".")) { continue; } if (part.equals("..")) { if (!current.hasParent()) { return null; } current = current.getParent(); continue; } if (!current.hasChildScope(part)) { return null; } current = current.getScope(part); log.trace("Current: {}", current); } return current; }
[ "public", "static", "IScope", "resolveScope", "(", "IScope", "from", ",", "String", "path", ")", "{", "log", ".", "debug", "(", "\"resolveScope from: {} path: {}\"", ",", "from", ".", "getName", "(", ")", ",", "path", ")", ";", "IScope", "current", "=", "f...
Resolves scope for specified scope and path. @param from Scope to use as context (to start from) @param path Path to resolve @return Resolved scope
[ "Resolves", "scope", "for", "specified", "scope", "and", "path", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/util/ScopeUtils.java#L58-L92
train
Red5/red5-server-common
src/main/java/org/red5/server/util/ScopeUtils.java
ScopeUtils.findRoot
public static IScope findRoot(IScope from) { IScope current = from; while (current.hasParent()) { current = current.getParent(); } return current; }
java
public static IScope findRoot(IScope from) { IScope current = from; while (current.hasParent()) { current = current.getParent(); } return current; }
[ "public", "static", "IScope", "findRoot", "(", "IScope", "from", ")", "{", "IScope", "current", "=", "from", ";", "while", "(", "current", ".", "hasParent", "(", ")", ")", "{", "current", "=", "current", ".", "getParent", "(", ")", ";", "}", "return", ...
Finds root scope for specified scope object. Root scope is the top level scope among scope's parents. @param from Scope to find root for @return Root scope object
[ "Finds", "root", "scope", "for", "specified", "scope", "object", ".", "Root", "scope", "is", "the", "top", "level", "scope", "among", "scope", "s", "parents", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/util/ScopeUtils.java#L101-L107
train
Red5/red5-server-common
src/main/java/org/red5/server/util/ScopeUtils.java
ScopeUtils.findApplication
public static IScope findApplication(IScope from) { IScope current = from; while (current.hasParent() && !current.getType().equals(ScopeType.APPLICATION)) { current = current.getParent(); } return current; }
java
public static IScope findApplication(IScope from) { IScope current = from; while (current.hasParent() && !current.getType().equals(ScopeType.APPLICATION)) { current = current.getParent(); } return current; }
[ "public", "static", "IScope", "findApplication", "(", "IScope", "from", ")", "{", "IScope", "current", "=", "from", ";", "while", "(", "current", ".", "hasParent", "(", ")", "&&", "!", "current", ".", "getType", "(", ")", ".", "equals", "(", "ScopeType",...
Returns the application scope for specified scope. Application scope has depth of 1 and has no parent. See <pre> isApp </pre> method for details. @param from Scope to find application for @return Application scope.
[ "Returns", "the", "application", "scope", "for", "specified", "scope", ".", "Application", "scope", "has", "depth", "of", "1", "and", "has", "no", "parent", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/util/ScopeUtils.java#L124-L130
train
Red5/red5-server-common
src/main/java/org/red5/server/util/ScopeUtils.java
ScopeUtils.isAncestor
public static boolean isAncestor(IBasicScope from, IBasicScope ancestor) { IBasicScope current = from; while (current.hasParent()) { current = current.getParent(); if (current.equals(ancestor)) { return true; } } return false; }
java
public static boolean isAncestor(IBasicScope from, IBasicScope ancestor) { IBasicScope current = from; while (current.hasParent()) { current = current.getParent(); if (current.equals(ancestor)) { return true; } } return false; }
[ "public", "static", "boolean", "isAncestor", "(", "IBasicScope", "from", ",", "IBasicScope", "ancestor", ")", "{", "IBasicScope", "current", "=", "from", ";", "while", "(", "current", ".", "hasParent", "(", ")", ")", "{", "current", "=", "current", ".", "g...
Check whether one scope is an ancestor of another @param from Scope @param ancestor Scope to check @return <pre> true </pre> if ancestor scope is really an ancestor of scope passed as from parameter, <pre> false </pre> otherwise.
[ "Check", "whether", "one", "scope", "is", "an", "ancestor", "of", "another" ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/util/ScopeUtils.java#L151-L160
train
Red5/red5-server-common
src/main/java/org/red5/server/util/ScopeUtils.java
ScopeUtils.getScopeService
protected static Object getScopeService(IScope scope, String name) { return getScopeService(scope, name, null); }
java
protected static Object getScopeService(IScope scope, String name) { return getScopeService(scope, name, null); }
[ "protected", "static", "Object", "getScopeService", "(", "IScope", "scope", ",", "String", "name", ")", "{", "return", "getScopeService", "(", "scope", ",", "name", ",", "null", ")", ";", "}" ]
Returns scope service by bean name. See overloaded method for details. @param scope scope @param name name @return object
[ "Returns", "scope", "service", "by", "bean", "name", ".", "See", "overloaded", "method", "for", "details", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/util/ScopeUtils.java#L257-L259
train
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/codec/RTMP.java
RTMP.getChannelInfo
private ChannelInfo getChannelInfo(int channelId) { ChannelInfo info = channels.putIfAbsent(channelId, new ChannelInfo()); if (info == null) { info = channels.get(channelId); } return info; }
java
private ChannelInfo getChannelInfo(int channelId) { ChannelInfo info = channels.putIfAbsent(channelId, new ChannelInfo()); if (info == null) { info = channels.get(channelId); } return info; }
[ "private", "ChannelInfo", "getChannelInfo", "(", "int", "channelId", ")", "{", "ChannelInfo", "info", "=", "channels", ".", "putIfAbsent", "(", "channelId", ",", "new", "ChannelInfo", "(", ")", ")", ";", "if", "(", "info", "==", "null", ")", "{", "info", ...
Returns channel information for a given channel id. @param channelId @return channel info
[ "Returns", "channel", "information", "for", "a", "given", "channel", "id", "." ]
39ae73710c25bda86d70b13ef37ae707962217b9
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMP.java#L122-L128
train