ThreadX docsThreadX docs
ThreadX
ThreadX Modules
NetX Duo
FileX
GUIX
USBX
TraceX
LevelX
ThreadX
ThreadX Modules
NetX Duo
FileX
GUIX
USBX
TraceX
LevelX
  • NetX Duo Documentation

    • Understand NetX Duo
    • NetX Duo documentation
    • Chapter 1 - Introduction to NetX Duo
    • Chapter 2 - Installation and Use of NetX Duo
    • Chapter 3 - Functional Components of NetX Duo
    • Chapter 4 - Description of NetX Duo Services
    • Chapter 5 - NetX Duo Network Drivers
    • Appendix A - NetX Duo Services
    • Appendix B - NetX Duo Constants
    • Appendix C - NetX Duo Data Types
    • Appendix D - NetX Duo BSD-Compatible Socket API
    • Appendix E - NetX Duo ASCII Character Codes
    • Auto-IP

      • Chapter 1 - Introduction to NetX Duo AutoIP
      • Chapter 2 - Installation and use of NetX Duo AutoIP
      • Chapter 3 - Description of NetX Duo AutoIP services
    • BSD

      • Chapter 1 - Introduction to NetX Duo BSD
      • Chapter 2 - Installation and use of NetX Duo BSD
      • Chapter 3 - NetX Duo BSD Services
    • Crypto

      • Chapter 1 - Introduction to NetX Duo Crypto
      • Chapter 2 - Installation and use of NetX Duo Crypto
      • Chapter 3 - Functional description of NetX Duo Crypto
      • Chapter 4 - NetX Duo Crypto API description
      • Appendix - NetX Duo Crypto CAVS test
    • DHCP Client

      • Chapter 1 - Introduction to the NetX Duo DHCP Client
      • Chapter 2 - Installation and use of NetX Duo DHCP Client
      • Chapter 3 - Description of NetX Duo DHCP Client services
      • Appendix A - Description of the Restore state feature for NetX Duo DHCP Client services
    • DHCP Server

      • Chapter 1 - Introduction to NetX Duo DHCP Server
      • Chapter 2 - Installation and Use of the NetX Duo DHCP Server
      • Chapter 3 - Description of NetX Duo DHCP server services
    • DHCPv6 Client

      • Chapter 1 - Introduction to NetX Duo DHCPv6 Client
      • Chapter 2 - Installation and use of NetX Duo DHCPv6 Client
      • Chapter 3 - NetX Duo DHCPv6 configuration options
      • Chapter 4 - NetX Duo DHCPv6 Client services
      • Appendix A - Description of the Restore State Feature for NetX Duo DHCPv6 Client
    • DHCPv6 Server

      • Chapter 1 - Introduction to NetX Duo DHCPv6 server
      • Chapter 2 - Installation and use of NetX Duo DHCPv6 server
      • Chapter 3 - NetX Duo DHCPv6 server configuration options
      • Chapter 4 - NetX Duo DHCPv6 server services
      • Appendix A – NetX Duo DHCPv6 option codes
      • Appendix B - NetX Duo DHCPv6 server status codes
      • Appendix C - NetX Duo DHCPv6 unique identifiers (DUIDs)
      • Appendix D - NetX Duo Advanced DHCPv6 server example
    • DNS

      • Chapter 1 - Introduction to the NetX Duo DNS Client
      • Chapter 2 - Installation and Use of NetX Duo DNS Client
      • Chapter 3 - Description of NetX Duo DNS Client Services
    • FTP

      • Chapter 1 - Introduction to NetX Duo FTP
      • Chapter 2 - Installation and use of FTP
      • Chapter 3 - Description of FTP services
    • HTTP

      • Chapter 1 - Introduction to NetX Duo HTTP
      • Chapter 2 - Installation and Use of NetX Duo HTTP
      • Chapter 3 - Description of NetX Duo HTTP Services
    • iperf

      • Chapter 1 - Introduction to NetX Duo Iperf
      • Chapter 2 - Installing and using NetX Duo Iperf
      • Chapter 3 - Running the UDP Transmit Test
    • mDNS

      • Chapter 1 - Introduction to NetX Duo mDNS/DNS-SD
      • Chapter 2 - Installation and use of mDNS
      • Chapter 3 - Description of internal service cache
      • Chapter 4 - Description of mDNS services
    • mqtt

      • Chapter 1 - Introduction to NetX Duo MQTT
      • Chapter 2 - Installation and use of NetX Duo MQTT client
      • Chapter 3 - Description of NetX Duo MQTT Client Services
    • NAT

      • Chapter 1 - An introduction to Network Address Translation
      • Chapter 2 - Installation and use of NAT
      • Chapter 3 - NAT configuration options
      • Chapter 4 - Description of NAT services
    • POP3 Client

      • Chapter 1 - Introduction to NetX Duo POP3
      • Chapter 2 - Installation and use of NetX Duo POP3 Client
      • Chapter 3 - Description of POP3 Client services
    • PPP

      • Chapter 1 - Introduction to the NetX Duo Point-to-Point Protocol (PPP)
      • Chapter 2 - Installation and use of NetX Duo Point-to-Point Protocol (PPP)
      • Chapter 3 - Description of NetX Duo Point-to-Point Protocol (PPP) services
    • PTP Client

      • Chapter 1 - Introduction to NetX Duo PTP Client
      • Chapter 2 - Installation and Use of NetX Duo PTP Client
      • Chapter 3 - Description of NetX Duo PTP Client Services
    • rtp

      • Chapter 1 - Introduction to the NetX Duo RTP Sender
      • Chapter 2 - Installation and use of NetX Duo RTP Sender
      • Chapter 3 - Description of NetX Duo RTP Sender Services
    • rtsp

      • Chapter 1 - Introduction to the NetX Duo RTSP Server
      • Chapter 2 - Installation and use of NetX Duo RTSP Server
      • Chapter 3 - Description of NetX Duo RTSP Server Services
    • Secure DTLS

      • Chapter 1 - Introduction to NetX Duo Secure DTLS
      • Chapter 2 - Installation and use of NetX Duo Secure DTLS
      • Chapter 3 - Functional description of NetX Duo Secure DTLS
      • Chapter 4 - Description of NetX Duo Secure DTLS services
      • Appendix A - NetX Duo Secure DTLS return/error codes
    • Secure TLS

      • Chapter 1 - Introduction to NetX Duo Secure
      • Chapter 2 - Installation and use of NetX Duo Secure
      • Chapter 3 - Functional description of NetX Duo Secure
      • Chapter 4 - Description of NetX Duo Secure services
      • Appendix A - NetX Duo Secure return/error codes
    • SMTP Client

      • Chapter 1 - Introduction to NetX Duo SMTP client
      • Chapter 2 - Installation and use of NetX Duo SMTP client
      • Chapter 3 - Client description of SMTP Client services
    • snmp

      • Chapter 1 - Introduction to NetX Duo SNMP
      • Chapter 2 - Installation and use of the NetX Duo SNMP agent
      • Chapter 3 - Description of NetX Duo SNMP agent services
    • sntp client

      • Chapter 1 - Introduction to NetX Duo SNTP
      • Chapter 2 - Installation and Use of NetX Duo SNTP Client
      • Chapter 3 - Description of NetX Duo SNTP Client Services
      • Appendix A - NetX Duo SNTP Fatal Error Codes
    • telnet

      • Chapter 1 - Introduction to NetX Duo Telnet
      • Chapter 2 - Installation and use of NetX Duo Telnet
      • Chapter 3 - Description of NetX Duo Telnet services
    • TFTP

      • Chapter 1 - Introduction to NetX Duo TFTP
      • Chapter 2 - Installation and use of NetX Duo TFTP
      • Chapter 3 - Description of NetX Duo TFTP services
    • Web HTTP

      • Chapter 1 - Introduction to HTTP and HTTPS
      • Chapter 2 - Installation and use of HTTP and HTTPS
      • Chapter 3 - Description of HTTP services
    • About the NetX Duo User Guide

Chapter 1 - Introduction to the NetX Duo RTP Sender

RTP Sender utilizes user datagram protocol (UDP) services to perform its data packets (RTP) and control packets (RTCP) transfer function. The real-time transport protocol (RTP) is a protocol designed for providing end-to-end real-time data delivery service, commonly for audio and video content. RTP relies on the transport protocol functionality provided by UDP, and contributes more transport protocol functionality for real-time transfer. The RTP control protocol (RTCP) works with RTP, provides periodic statistics to other session participants and parses received periodic statistics from other session participants in RTP session. Data distribution quality provided by RTCP helps the application to adjust the data distribution rate and quality. Moreover, the automatic sent RTCP sender report by RTP Sender includes the link information between RTP timestamp and NTP timestamp, which could be used by the application to synchronize RTP data packets in different sessions (e.g. video and audio synchronization).

RTP Sender typically works with RTSP server to provide the RTP/RTCP services for the RTSP server. The RTSP server is responsible for the RTSP session management, and the RTP Sender is responsible for the RTP/RTCP session management. The RTSP server shall create the RTP Sender instance, and then create the RTP session instance on the RTP Sender. The RTSP server shall also call the RTP Sender APIs to send the RTP/RTCP packets.

The RTP payload format is determined by the application. The RTP Sender supports the following payload formats: MJPEG and H.264 for video, PCM and AAC for audio. Users can also implement other payload formats by using the existing RTP Sender APIs.

NetX Duo RTP Sender Requirements

The NetX Duo RTP Sender requires that an IP instance has already been created. In addition, UDP must be enabled on that same IP instance.

NetX Duo RTP Sender Specification

The NetX Duo RTP Sender implement is compliant with RFC 3550.

Below table shows supported RTP payload format implementation details in RTP Sender:

FormatTypeSpecificationCorresponding RTP Sender API Function(s) to send
PCMAudioRFC 3551nx_rtp_sender_session_packet_send(), nx_rtp_sender_session_sample_factor_set()
AACAudioRFC 3640 and RFC 6416nx_rtp_sender_session_aac_send()
MJPEGVideoRFC 2435nx_rtp_sender_session_jpeg_send()
H.264VideoRFC 6184nx_rtp_sender_session_h264_send()

NetX Duo RTP Sender Constraints

RTP:

  • CSRC: contributing source feature is not supported since RTP sender is not targeted for RTP mixer application. Thus, the CSRC count is always zero in RTP header (i.e. no CSRC list).

RTP Payload Format:

  • Complete frame data is required (i.e. marker bit shall always be NX_TRUE) to send RTP payload format data including JPEG/MJPEG, H.264 and AAC.
  • JPEG/MJPEG: 8-bit sample precision only, YUV420 or YUV422 type only, encoded with standard huffman tables only.
  • H.264: non-interleaved mode only (i.e. indicate packetization-mode=1 in SDP).
  • AAC: aac-hbr mode only, 13-bit frame length only.

RTCP:

  • Packet chain is not supported.
  • SDES: only CNAME field is parsed for both sent and received RTCP SDES packet.
  • BYE: the goodbye RTCP packet is ignored and not known by the user.

NetX Duo RTP Sender Basic Operation

An application creates an RTP sender by calling nx_rtp_sender_create(). Once the RTP sender is created, the application can get the bound RTP/RTCP port pair by calling nx_rtp_sender_port_get(). Within the RTP sender, the application can then create an RTP session by calling nx_rtp_sender_session_create(). In RTP layer, there is no limitation for the number of sessions created within an RTP sender.

An RTP session is responsible for sending one specific type of RTP packets to one specific receiver (the receiver could be a multicast group). Once the RTP session is created, many configurations or parameters are fixed such as the payload type transferred in the session, the ip interface used to transfer RTP packets, the receiver's ip address and RTP/RTCP port pair, the initial random SSRC and sequence number for the session. The application can get the session SSRC by calling nx_rtp_sender_session_ssrc_get(), and get the current sequence number in the session by calling nx_rtp_sender_session_sequence_number_get().

The application chooses different RTP session send function(s) in RTP sender depending on the payload type. So far, the application can call nx_rtp_sender_session_jpeg_send() to send JPEG payload, and call nx_rtp_sender_session_h264_send() to send H.264 payload, and call nx_rtp_sender_session_aac_send() to send AAC payload. The application can also call nx_rtp_sender_session_packet_send() to send other payload types or send own implemented RTP sender not supported features for the existing payload types. The procedure for the application to use the function nx_rtp_sender_session_packet_send:

  • Step 1: allocate an RTP packet by calling nx_rtp_sender_session_packet_allocate().
  • Step 2: fill the RTP packet with the payload data by calling nx_packet_data_append().
  • Step 3: send the RTP packet by calling nx_rtp_sender_session_packet_send().

Warning: Unless an error is returned, the application should not release the allocated RTP packet by calling nx_packet_release() after calling the function nx_packet_data_append() or nx_rtp_sender_session_packet_send(). Doing so will cause unpredictable results because the network driver will also try to release the packet after transmission.

Transferring sample-based encoding payload such as PCM audio payload is special, due to the way how RTP timestamp increases. The application shall call enable sample-based encoding payload transfer for the session by calling nx_rtp_sender_session_sample_factor_set() and set a none-zero value. The sample factor is computed and provided by the application. With the sample factor configured, when fragmentation happens, the function nx_rtp_sender_session_packet_send is able to handle the automatic increase RTP timestamp as required for each fragmented packet. The application can then send sample-based encoding payload through the procedure described above.

Received RTCP RR reports (receiver report) are parsed by RTP sender automatically. The application can choose to get RR reports through registering the callback function by calling nx_rtp_sender_rtcp_receiver_report_callback_set(). The callback function is declared as:

UINT nx_rtp_sender_rtcp_receiver_report_callback_set(NX_RTP_SENDER *rtp_sender,
    UINT (*rtcp_rr_cb)(NX_RTP_SESSION *, NX_RTCP_RECEIVER_REPORT *));

As the RTP sender receives a RTCP RR packet inside a specific session, it invokes the callback function if the function is set. The callback function passes the pointer to the session and the pointer to the receiver report structure. The application can then parse the receiver report structure to get the information it needs.

Received RTCP SDES packets are parsed by RTP sender automatically as well. In SDES packet, only the CNAME field is parsed and extracted. The application can choose to get CNAME through registering the callback function by calling nx_rtp_sender_rtcp_sdes_callback_set(). The callback function is declared as:

UINT nx_rtp_sender_rtcp_sdes_callback_set(NX_RTP_SENDER *rtp_sender,
    UINT (*rtcp_sdes_cb)(NX_RTCP_SDES_INFO *));

As the RTP sender receives a RTCP SDES packet, it invokes the callback function if the function is set. The callback function passes the pointer to the SDES information structure. The application can then parse the SDES information structure to get the CNAME information.

When the connection with the receiver ends, the application can unlink the session(s) corresponding to the receiver from the RTP sender by calling nx_rtp_sender_session_delete(). The application can also release all the resources of the RTP sender by calling nx_rtp_sender_delete().

Note: The application can successfully delete an RTP sender only when all linked sessions having been deleted.

Next
Chapter 2 - Installation and use of NetX Duo RTP Sender