RTP Transmitter sample |
||
Sample is based on TunaIPTransmitter component, which does the following:
There are several different streaming modes, all specified by the URI property. RAW/RTP UDP Unicast streamingIn this mode target (destination) address and port is specified in URI, so any receiver which is able to bind to the target address:port will receive data. URI samples: rtp://streamname@192.168.0.170:1234/ udp://192.168.0.170:1234/ Receivers must bind to 192.168.0.170 at port 1234. RTCP will use port 1235. RAW/RTP UDP One-to-many streamingIn this mode 0.0.0.0 is specified as host address in URI, and port number specifies the port to "listen" for incoming requests. URI samples: rtp://streamname@0.0.0.0:1234/ udp://0.0.0.0:1234/ Receivers must send requests to transmitter host at port 1234. RTCP will use port 1235. NOTE for RAW streaming: this mode is NOT recommended, as there is no way to timeout dead receivers. RAW/RTP UDP Multicast streamingIn this mode URI specifies multicast group address and port number to be used for streaming. URI samples: rtp://streamname@224.0.1.2:1234/ udp://224.0.1.2:1234/ Receivers join multicast group 224.0.1.2 and wait for data at port 1234. RTCP will use port 1235. Icecast/SHOUTCast TCP streamingIn addition to UDP sockets, it is also possible to stream over TCP using SHOUTCast protocol. You should be running Icecast/DNAS server somewhere. URI samples: http://source:hackme@192.168.0.174:9000/stream_name Where 192.168.0.174 is host running Icecast/DNAS server at port 9000, "source" is client name and "hackme" is the password. "stream_name" specifies desired stream name. Receiver should connect to Icecast/DNAS server using same host address, port number and stream name: http://192.168.0.174:9000/stream_name Payload formatUse SDP property to specify how audio should be encoded before transmitting. Or set Some SDP examples shows how to use it. In addition you can specify TTL for multicast streaming and bitrate for some codecs, as showm below: v=0 m=audio 5004 RTP/AVP 14 a=rtpmap:14 mpa/44100/2 c=IN IP4 /2 a=fmtp:14; bitrate=256 Here 14 is pre-defined payload number for MPEG audio, "c=IN IP4 /2" specifies IP4 addressing and TTL=2, and bitrate is set to 256 kbps. List of supported payloads, defined in RFC 3551:
In addition, IPTransmitter is aware of the following dynamic payload numbers:
Streaming MPEG filesTo stream a file with MPEG audio, you can use WaveRiff component, with In this case MPEG frames are read directly from the file and no extreanal encoder is used. DownloadPrecompiled binary of this sample is included in the Demos package. |