fyhertz / libstreaming

A solution for streaming H.264, H.263, AMR, AAC using RTP on Android
Apache License 2.0
3.48k stars 1.07k forks source link

TCP support #21

Open tulkas85 opened 10 years ago

tulkas85 commented 10 years ago

I'm trying Example 3 with Wowza . All works fine on local network, but I have problem if smartphone try to connect on wowza by server public ip address. I have set port forwarding for my wowza port, and when I click on start button, streaming starts, and in wowza manager I can see this connection in incoming streams. test

The problem is that wowza not receive packets from android client. If I see Network Throughput section, it show this : bytes in 0 , bytes out 0 and of course video not shown. From smartphone I can ping my public wowza's server ip, port 1935 is open and forwarded to local address of server. What I miss ? I must open and forward some other ports ?

smartphone android 4.1.2 wowza server on windows 7 (firewall disabled)

tulkas85 commented 10 years ago

maybe I found a temporary solution. Using wireshark on smartphone I see that RtspClient using always same range of udp ports (6970-6978 there are only of my experience) Adding rule on router to forward these udp ports to my local wowza server all works fine.

Does libstreaming assign these ports in source code ? If so I would understand how can I manage this range of udp ports.

fyhertz commented 10 years ago

Hi,

Yes, you need to redirect udp ports to your wowza media server if it is behind a NAT. This is not a bug, it's just how things work.

The UDP destination ports of the stream are chosen by wowza during the SETUP request of the RTSP client, not by libstreaming.

I am not a wowza expert, but there may be a way to force those ports somehow... But if you intend to receive streams from more than one client at a time, beware that they will all need to use at least two UDP ports...

tulkas85 commented 10 years ago

It's possible to work on TCP instead of UDP ?

fyhertz commented 10 years ago

Not right now, but I'm working on it :)

2014-02-21 3:35 GMT-05:00 tulkas85 notifications@github.com:

It's possible to work on TCP instead of UDP ?

Reply to this email directly or view it on GitHubhttps://github.com/fyhertz/libstreaming/issues/21#issuecomment-35708289 .

avaranovich commented 10 years ago

@fyhertz If one would be willig to contribute into TCP support, can you point to the places where it should be implemented? I understand the RTSP set up should be different, but also a TCP sockets should be used instead of UDP. It should be relatively easy to implement. What do you think?

fyhertz commented 10 years ago

Hi,

I just published a patch that adds TCP support, it's not ready yet, there are still things I need to handle. For instance, if the RTSP server sends RTCP receiver reports back to libstreaming, the RTSP client won't be able to handle them. And if the bandwidth is not good enough, the fifo of the TCP socket will just grow and eventually saturate.

If you want to try it out use that: mClient.setTransportMode(RtspClient.TRANSPORT_TCP); before starting the RTSP client.

If you want to improve TCP support go ahead, check the last commit to see the modification I made.

hdezela commented 10 years ago

To fix this you have to edit /usr/local/WowzaStreamingEngine/conf/Application.xml, specifically the following lines within the "RTP" section:

<RTSPBindIpAddress>[INTERNAL_IP]</RTSPBindIpAddress>
<RTSPConnectionIpAddress>[EXTERNAL_IP]</RTSPConnectionIpAddress>
<RTSPOriginIpAddress>[EXTERNAL_IP]</RTSPOriginIpAddress>

That should take care of it. Also, rather obviously but worth mentioning, open up the requisite UDP ports on your firewall.

tulkas85 commented 9 years ago

@fyhertz some news on TCP support ? Now does it works ?

now I need to stream over Internet (peer to peer mode, from android smartphone to client pc) and udp packet usually could be blocked around the Internet network.

halsafar commented 9 years ago

I could also make some use of libstreaming if it supported a TCP Socket. Even without any of the RTP stuff. I want to use libstreaming basically with a TCP websocket.

irasoftwares7 commented 8 years ago

@tulkas85 Any news?? I also want to achieve the same you are trying to, and stuck at the same point.

wen842520 commented 3 years ago

如何设置让libstreaming支持rtp over tcp呢 在客户端只支持rtp over tcp的情况下,客户端不能显示视频。