use of org.red5.server.net.rtmp.event.IRTMPEvent in project bigbluebutton by bigbluebutton.
the class ScreenVideoBroadcastStream method dispatchEvent.
public void dispatchEvent(IEvent event) {
try {
// System.out.println("dispatchEvent(event:screenVideo)");
if (event instanceof IRTMPEvent) {
IRTMPEvent rtmpEvent = (IRTMPEvent) event;
if (livePipe != null) {
RTMPMessage msg = RTMPMessage.build(rtmpEvent, Constants.SOURCE_TYPE_LIVE);
if (creationTime == null)
creationTime = (long) rtmpEvent.getTimestamp();
try {
IVideoStreamCodec videoStreamCodec = new ScreenVideo();
streamCodecInfo.setHasVideo(true);
streamCodecInfo.setVideoCodec(videoStreamCodec);
videoStreamCodec.reset();
videoStreamCodec.addData(((VideoData) rtmpEvent).getData());
livePipe.pushMessage(msg);
// Notify listeners about received packet
if (rtmpEvent instanceof IStreamPacket) {
for (IStreamListener listener : getStreamListeners()) {
try {
listener.packetReceived(this, (IStreamPacket) rtmpEvent);
} catch (Exception e) {
log.error("Error while notifying listener " + listener, e);
}
}
}
} catch (IOException ex) {
// ignore
log.error("Got exception: {}", ex);
}
}
}
} finally {
}
}
Aggregations