Vinay
Vinay

Reputation: 4793

RTSP client in android

I am writing a RTSP client in Android. I am able to receive the Responses for all the requests i.e.,

  1. DESCRIBE it sends back the 200 OK
  2. SETUP with transport: RTP/AVP:unicast:client_port=4568:4569 got the 200 OK Message back
  3. Sent PLAY, and got the OK Message

After that how to get the audio and video frames?

I have searched on blogs, but all say to listen at client_port but I am not receiving any packets.

Please let me know am I doing correctly.

Upvotes: 7

Views: 28248

Answers (4)

Shreesh
Shreesh

Reputation: 677

Try first with a local Darwin Streaming server installed within your LAN.that way Firewall wont matter.Streaming will work.

If you want to try from external server then:

1) Check the client_ports mentioned in the SERVER response,some servers suggest different ports from the one requested.you have to use the ports suggested by server.

2) If the ports are correct, then you can send 64byte empty packets from each of the UDP ports to the server(called "door openers").

3) If the above two don't fix it, check the server side logs.The server might be closing the UDP ports.

Upvotes: 1

shodanex
shodanex

Reputation: 15456

Put a sniffer on the network, you should see UDP packet with destination port 4568 targeted at your IP address.

With a decent sniffer, you will be able to see the rtsp dialog. Maybe you are missing something in the answers

You should also check the content of the SETUP response, to see if the port you requested were accepted.

Things to check :

  • Listening in UDP.
  • Firewall rules.
  • Range of the play request : Don't specify any to be sure the server will be playing something.

If you are behind a router or firewall, you probably won't receive anything, because your router / firewall don't know what to do with incoming UDP packets

Upvotes: 1

neuro
neuro

Reputation: 15210

RTSP is only used to start the streaming. It gives you an SDP description of the real streams. You have to manage an RTCP connection and a RTP connection per channel (audio / video). The ports to use are the "client_port" ones.

It is pretty complex to code a RTSP/RTCP/RTP stack from scratch. You can have a look at the live555 library that implement such a stack in c++.

Upvotes: 3

haseman
haseman

Reputation: 11313

You may or may not know this, but Android has built in support for RTSP using the VideoView.

http://developer.android.com/reference/android/widget/VideoView.html

This may cut down on your development time...or it may be totally useless if you're trying to roll your own RTSP stack.

Upvotes: 4

Related Questions