public synchronized void pushMessage(IMessage message) throws IOException { if (getState() >= PUBLISHED && message instanceof RTMPMessage) { RTMPMessage rtmpMsg = (RTMPMessage) message; rtmpClient.publishStreamData(streamId, rtmpMsg); } else { frameBuffer.add(message); } }
public synchronized void onStreamEvent(Notify notify) { ObjectMap<?, ?> map = (ObjectMap<?, ?>) notify.getCall().getArguments()[0]; String code = (String) map.get("code"); if (StatusCodes.NS_PUBLISH_START.equals(code)) { setState(PUBLISHED); while (frameBuffer.size() > 0) { rtmpClient.publishStreamData(streamId, frameBuffer.remove(0)); } } }