[mobicents-public] RTSP Client Problem

62 views
Skip to first unread message

Zelalem Sintayehu

unread,
Mar 8, 2010, 11:58:19 AM3/8/10
to mobicent...@googlegroups.com
Hi I wanted to use the mobicents rtsp client and tried to implement the code. As there are no codes for sending the request and also to process the response. So, i tried to implement the codes. I implemented it this way.

I created a different rtspcontroller for the client (called it RtspControllerClient) and implemented the onRtspResponse method to process incoming responses. Also in the start method of this class I included a code to send the first request to the media server. So far so good. I sent an OPTIONS request to Darwin and I get an OK response together with the Methods Darwin Supports (a proper response to options request). The problem comes now. As I mentioned above i included a code to send the other requests in the OnRtspResponse method. So, I use a variable that holds previous request and based on that I form the proper request for the current session and call the SendReuqest method but the SendRequest method raises exception. The following is the error I got:

70 [New I/O client worker #1-1] INFO org.mobicents.media.server.ctrl.rtsp.RtspController  - Last request was ...OPTIONS
70 [New I/O client worker #1-1] INFO org.mobicents.media.server.ctrl.rtsp.RtspController  - About to send the second request ...
70 [New I/O client worker #1-1] INFO org.mobicents.media.server.ctrl.rtsp.RtspController  - The second request is ...DefaultHttpRequest(chunked: false)
DESCRIBE rtsp://192.168.2.99:554/sample_100kbit.mp4 HTTP/1.1
Host: 192.168.2.20
Connection: close
Accept-Encoding: gzip
CSeq: 2
Content-Type: application/x-rtsp-tunnelled
70 [New I/O client worker #1-1] INFO org.mobicents.media.server.ctrl.rtsp.stack.RtspClientStackImpl  - Inside SendRequest with rtspRequest...DefaultHttpRequest(chunked: false)
DESCRIBE rtsp://192.168.2.99:554/sample_100kbit.mp4 HTTP/1.1
Host: 192.168.2.20
Connection: close
Accept-Encoding: gzip
CSeq: 2
Content-Type: application/x-rtsp-tunnelled
70 [New I/O client worker #1-1] INFO org.mobicents.media.server.ctrl.rtsp.stack.RtspClientStackImpl  - And this is the second request
71 [New I/O client worker #1-1] ERROR org.mobicents.media.server.ctrl.rtsp.RtspController  - Unexpected error during processing,Caused by
java.lang.NullPointerException

        at org.mobicents.media.server.ctrl.rtsp.stack.RtspClientStackImpl.sendRquest(RtspClientStackImpl.java:135)
        at org.mobicents.media.server.ctrl.rtsp.RtspControllerClient.onRtspResponse(RtspControllerClient.java:171)
        at org.mobicents.media.server.ctrl.rtsp.stack.RtspClientStackImpl.processRtspResponse(RtspClientStackImpl.java:85)
        at org.mobicents.media.server.ctrl.rtsp.stack.RtspResponseHandler.messageReceived(RtspResponseHandler.java:28)
        at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
        at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302)
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndfireMessageReceived(ReplayingDecoder.java:513)
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:497)
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:434)
        at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
        at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:353)
        at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:277)
        at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:197)
        at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

I trace the error and it happens at the following line:


                // Wait for the server to close the connection.
            channel.getCloseFuture().awaitUninterruptibly();
channel = future.awaitUninterruptibly().getChannel();

             // Shut down executor threads to exit.
            bootstrap.releaseExternalResources();

And what surprises me is that the error is raised by the RtspController (the one you developed for teh Server) and not by the RsptControllerClient (the one that used for the client). And the code is running from the second class. I traced back the error and it is caused by the following statement:

channel = future.awaitUninterruptibly().getChannel();  // b/c there is a channel active and connected to the server.

Thank you.


Amit Bhayani

unread,
Mar 8, 2010, 12:10:52 PM3/8/10
to mobicent...@googlegroups.com
Not sure which version of code you are working with, but you should use JBoss Netty 3.2.0.Beta1 which has RTSP included and your client should look something like

http://code.google.com/p/mobicents/source/browse/trunk/servers/media/core/controllers/rtsp/src/main/java/org/mobicents/media/server/ctrl/rtsp/stack/RtspClientStackImpl.java

Amit Bhayani

unread,
Mar 8, 2010, 12:11:45 PM3/8/10
to mobicent...@googlegroups.com
Also, to create RTSP Client, you don't need mobicents media server. Just JBoss Netty 3.2.0.Beta1

Zelalem Sintayehu

unread,
Mar 8, 2010, 12:13:30 PM3/8/10
to mobicent...@googlegroups.com
Hi please descard the previous message with the same header. I sent it before I finalize the email. Sorry for the inconvenience. Anyway, I wanted to use the mobicent's rtsp client and tried to implement the code. As there are no codes for sending the request and also to process the response, i wrote my own code by following the server implementaiton. I implemented it this way.

I created a different rtspcontroller for the client (called it RtspControllerClient) and implemented the onRtspResponse method to process incoming responses. Also in the start method of this class I included a code to send the first request to the media server.  So far so good. I sent an OPTIONS request to Darwin and I get an OK response together with the Methods Darwin Supports (a proper response to options request). The problem comes when i try to send the second message. As I mentioned above i included a code to send the other requests in the OnRtspResponse method. So, I use a variable that holds previous request and based on that I form the proper request for the current session and call the SendReuqest method but the SendRequest method raises exception. The following is the error I got:
channel = future.awaitUninterruptibly().getChannel();      - I think it is b/c future is not initialized b/c the if statement is not executed :
if (channel == null || (channel != null && !channel.isConnected())) {
            // Start the connection attempt.
            future = bootstrap.connect(new InetSocketAddress(host, port));

        }


And when I use another if not avoid executing the statement that I mentioned above which created the error. I get a different error:

77 [New I/O client worker #1-1] ERROR org.mobicents.media.server.ctrl.rtsp.RtspController  - Unexpected error during processing,Caused by
java.lang.IllegalStateException: await*() in I/O thread causes a dead lock or sudden performance drop. Use addListener() instead or call await*() from a different thread.
        at org.jboss.netty.channel.DefaultChannelFuture.checkDeadLock(DefaultChannelFuture.java:283)
        at org.jboss.netty.channel.DefaultChannelFuture.awaitUninterruptibly(DefaultChannelFuture.java:195)
        at org.mobicents.media.server.ctrl.rtsp.stack.RtspClientStackImpl.sendRquest(RtspClientStackImpl.java:154)

        at org.mobicents.media.server.ctrl.rtsp.RtspControllerClient.onRtspResponse(RtspControllerClient.java:171)
        at org.mobicents.media.server.ctrl.rtsp.stack.RtspClientStackImpl.processRtspResponse(RtspClientStackImpl.java:85)
        at org.mobicents.media.server.ctrl.rtsp.stack.RtspResponseHandler.messageReceived(RtspResponseHandler.java:28)
        at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
        at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302)
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndfireMessageReceived(ReplayingDecoder.java:513)
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:497)
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:434)
        at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
        at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:353)
        at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:277)
        at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:197)
        at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

The surprising thing is that this error is raised by RtspController (that you used for the server not the client controller that I created). So, what is happening? Please help me.



Thank you.

Zelalem Sintayehu

unread,
Mar 8, 2010, 12:24:41 PM3/8/10
to mobicent...@googlegroups.com
Hi Amit that is what I used. I mean the rtspclientimpl code. But it doesn't have an event handler so i created one based on the rtspcontroller and put some code to send the first message in the start method. And also anotehr code in the OnRtspResponse method. So, the error is inside the sendrequest method of rtspclientimpl. As I mentioned in my modified email there are two error scanarios. I hope you got my problem now.

Thank you.

Zelalem
Reply all
Reply to author
Forward
0 new messages