RTSP client in android

I am writing an RTSP client in Android. I can get answers to all requests that is.,

  • DESCRIBE sends back 200 OK
  • SETUP with transport: RTP / AVP: unicast: client_port = 4568: 4569 received a 200 OK message.
  • PLAY sent and received OK

After that, how to get audio and video frames?

I searched on blogs, but everyone says to listen on client_port, but I don't get any packages.

Please let me know what I'm doing right.

+7
c ++ android client rtsp
source share
4 answers

You may or may not know about it, but Android supports RTSP support using VideoView.

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

It can shorten development time ... or it can be completely useless if you are trying to collapse your own RTSP stack.

+5
source share

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

It is difficult to build the RTSP / RTCP / RTP code from scratch. You can see the live555 library that implements such a stack in C ++.

+3
source share

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

With a good sniffer, you can see the rtsp dialog. There may be something missing in your answers.

You should also check the contents of the SETUP response to ensure that the selected port has been accepted.

What you need to check:

  • Listening in UDP.
  • Firewall rules.
  • Playback request range: Do not specify to make sure the server will play something.

If you are behind a router or firewall, you probably won’t get anything because your router / firewall does not know what to do with incoming UDP packets

+1
source share

Try first with the local Darwin Streaming server installed on your local network. Therefore, the firewall does not matter. The stream will work.

If you want to try from an external server, then:

1) Check the client_ports mentioned in the SERVER response, some servers offer different ports from the requested one. You must use the ports offered by the server.

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

3) If the above two cannot be fixed, check the server logs. The server may close UDP ports.

+1
source share

All Articles