Does Android 4.x support streaming RTSP over TCP?

2019-04-07 13:03发布

问题:

I've used VideoView in Android to play video on wowza successfully. Now I got to deal with my server which the UDP ports seems to be blocked. With the proof of openRTSP command:

-> % openRTSP rtsp://61.218.52.250:554/live/ch00_0

Opening connection to 61.218.52.250, port 554...
...remote connection opened
Sending request: OPTIONS rtsp://61.218.52.250:554/live/ch00_0 RTSP/1.0
CSeq: 2
User-Agent: openRTSP (LIVE555 Streaming Media v2013.12.16)


Received 105 new bytes of response data.
Received a complete OPTIONS response:
RTSP/1.0 200 OK
CSeq: 2
Server: UBNT Streaming Server v1.2
Public: DESCRIBE, SETUP, TEARDOWN, PLAY


Sending request: DESCRIBE rtsp://61.218.52.250:554/live/ch00_0 RTSP/1.0
CSeq: 3
User-Agent: openRTSP (LIVE555 Streaming Media v2013.12.16)
Accept: application/sdp


Received 562 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 3
Server: UBNT Streaming Server v1.2
Content-Base: rtsp://61.218.52.250:554/live/ch00_0/
Content-Type: application/sdp
Content-Length: 393

v=0
o=- 1 1 IN IP4 127.0.0.1
s=Ubiquiti Live
i=UBNT Streaming Media
c=IN IP4 0.0.0.0
t=0 0
m=video 0 RTP/AVP 99
b=AS:50000
a=framerate:25
a=x-dimensions:1280,720
a=x-vendor-id:ubnt,a521
a=x-rtp-ts:4617405454576779984
a=rtpmap:99 H264/90000
a=fmtp:99 profile-level-id=42A01E;packetization-mode=1;sprop-parameter-sets=Z0IAKOkAoAt1xIAG3dAAzf5gDYgQlA==,aM4xUg==
a=control:trackID=0

Opened URL "rtsp://61.218.52.250:554/live/ch00_0", returning a SDP description:
v=0
o=- 1 1 IN IP4 127.0.0.1
s=Ubiquiti Live
i=UBNT Streaming Media
c=IN IP4 0.0.0.0
t=0 0
m=video 0 RTP/AVP 99
b=AS:50000
a=framerate:25
a=x-dimensions:1280,720
a=x-vendor-id:ubnt,a521
a=x-rtp-ts:4617405454576779984
a=rtpmap:99 H264/90000
a=fmtp:99 profile-level-id=42A01E;packetization-mode=1;sprop-parameter-sets=Z0IAKOkAoAt1xIAG3dAAzf5gDYgQlA==,aM4xUg==
a=control:trackID=0

Created receiver for "video/H264" subsession (client ports 63346-63347)
Sending request: SETUP rtsp://61.218.52.250:554/live/ch00_0/trackID=0 RTSP/1.0
CSeq: 4
User-Agent: openRTSP (LIVE555 Streaming Media v2013.12.16)
Transport: RTP/AVP;unicast;client_port=63346-63347


Received 47 new bytes of response data.
Received a complete SETUP response:
RTSP/1.0 461 Unsupported Transport
CSeq: 4


Failed to setup "video/H264" subsession: 461 Unsupported Transport

After searching around I found it seems Android still not support RTSP over TCP:

When streaming to an Android device using RTSP/RTP, the RTP portion must flow over UDP. Android doesn't support RTSP/RTP interleaved (RTP over TCP). This means that if UDP is unavailable for RTP playback, RTP over TCP won't work as a failover and your stream won't play.

Considering it's posted on 2010, does Android 4.x support RTSP over TCP now? I've found lots of post asking for how to force transfer via TCP other than UDP. I guess it's not.

If not, could I achieve it by re-compiling and using ffmpeg library?

Basically I hope ffmpeg could help me to automatically switch to TCP while UDP not available.