Search in sources :

Example 1 with RTMPMessage

use of org.red5.server.stream.message.RTMPMessage 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 {
    }
}
Also used : IStreamListener(org.red5.server.api.stream.IStreamListener) RTMPMessage(org.red5.server.stream.message.RTMPMessage) IRTMPEvent(org.red5.server.net.rtmp.event.IRTMPEvent) IOException(java.io.IOException) IVideoStreamCodec(org.red5.codec.IVideoStreamCodec) IStreamPacket(org.red5.server.api.stream.IStreamPacket) ResourceExistException(org.red5.server.api.stream.ResourceExistException) ResourceNotFoundException(org.red5.server.api.stream.ResourceNotFoundException) IOException(java.io.IOException)

Example 2 with RTMPMessage

use of org.red5.server.stream.message.RTMPMessage in project openmeetings by apache.

the class CaptureScreen method pushVideo.

public void pushVideo(VideoData data, int ts) {
    if (startPublish) {
        if (Red5.getConnectionLocal() == null) {
            Red5.setConnectionLocal(client.getConnection());
        }
        RTMPMessage rtmpMsg = RTMPMessage.build(data, ts);
        client.publishStreamData(streamId, rtmpMsg);
    }
}
Also used : RTMPMessage(org.red5.server.stream.message.RTMPMessage)

Aggregations

RTMPMessage (org.red5.server.stream.message.RTMPMessage)2 IOException (java.io.IOException)1 IVideoStreamCodec (org.red5.codec.IVideoStreamCodec)1 IStreamListener (org.red5.server.api.stream.IStreamListener)1 IStreamPacket (org.red5.server.api.stream.IStreamPacket)1 ResourceExistException (org.red5.server.api.stream.ResourceExistException)1 ResourceNotFoundException (org.red5.server.api.stream.ResourceNotFoundException)1 IRTMPEvent (org.red5.server.net.rtmp.event.IRTMPEvent)1