📄 rtpsessionapi.sgml
字号:
<listitem><simpara> a rtp session.</simpara></listitem></varlistentry><varlistentry><term><parameter>user_ts</parameter> :</term><listitem><simpara> a timestamp.</simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a rtp packet presented as a mblk_t.</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="rtp-session-create-packet" role="function">rtp_session_create_packet ()</title><indexterm><primary>rtp_session_create_packet</primary></indexterm><programlisting><link linkend="mblk-t">mblk_t</link>* rtp_session_create_packet (<link linkend="RtpSession">RtpSession</link> *session, <link linkend="int">int</link> header_size, const <link linkend="char">char</link> *payload, <link linkend="int">int</link> payload_size);</programlisting><para>Allocates a new rtp packet. In the header, ssrc and payload_type according to the session'scontext. Timestamp and seq number are not set, there will be set when the packet is going to besent with <link linkend="rtp-session-sendm-with-ts"><function>rtp_session_sendm_with_ts()</function></link>.If payload_size is zero, thus an empty packet (just a RTP header) is returned.</para><para></para><variablelist role="params"><varlistentry><term><parameter>session</parameter> :</term><listitem><simpara> a rtp session.</simpara></listitem></varlistentry><varlistentry><term><parameter>header_size</parameter> :</term><listitem><simpara> the rtp header size. For standart size (without extensions), it is <link linkend="RTP-FIXED-HEADER-SIZE:CAPS"><type>RTP_FIXED_HEADER_SIZE</type></link></simpara></listitem></varlistentry><varlistentry><term><parameter>payload</parameter> :</term><listitem><simpara>data to be copied into the rtp packet.</simpara></listitem></varlistentry><varlistentry><term><parameter>payload_size</parameter> :</term><listitem><simpara> size of data carried by the rtp packet.</simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a rtp packet in a mblk_t (message block) structure.</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="rtp-session-create-packet-with-data" role="function">rtp_session_create_packet_with_data ()</title><indexterm><primary>rtp_session_create_packet_with_data</primary></indexterm><programlisting><link linkend="mblk-t">mblk_t</link>* rtp_session_create_packet_with_data (<link linkend="RtpSession">RtpSession</link> *session, <link linkend="char">char</link> *payload, <link linkend="int">int</link> payload_size, <link linkend="void">void</link> (*freefn) (void*));</programlisting><para>Creates a new rtp packet using the given payload buffer (no copy). The header will be allocated separetely. In the header, ssrc and payload_type according to the session'scontext. Timestamp and seq number are not set, there will be set when the packet is going to besent with <link linkend="rtp-session-sendm-with-ts"><function>rtp_session_sendm_with_ts()</function></link>.oRTP will send this packet using libc's <link linkend="sendmsg"><function>sendmsg()</function></link> (if this function is availlable!) so that there will be nopacket concatenation involving copies to be done in user-space. <parameter>freefn</parameter> can be NULL, in that case payload will be kept untouched.</para><para></para><variablelist role="params"><varlistentry><term><parameter>session</parameter> :</term><listitem><simpara> a rtp session.</simpara></listitem></varlistentry><varlistentry><term><parameter>payload</parameter> :</term><listitem><simpara> the data to be sent with this packet</simpara></listitem></varlistentry><varlistentry><term><parameter>payload_size</parameter> :</term><listitem><simpara> size of data</simpara></listitem></varlistentry><varlistentry><term><parameter>freefn</parameter> :</term><listitem><simpara> a function that will be called when the payload buffer is no more needed.</simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a rtp packet in a mblk_t (message block) structure.</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="rtp-session-sendm-with-ts" role="function">rtp_session_sendm_with_ts ()</title><indexterm><primary>rtp_session_sendm_with_ts</primary></indexterm><programlisting><link linkend="int">int</link> rtp_session_sendm_with_ts (<link linkend="RtpSession">RtpSession</link> *session, <link linkend="mblk-t">mblk_t</link> *mp, <link linkend="uint32-t">uint32_t</link> userts);</programlisting><para>Send the rtp datagram <parameter>mp</parameter> to the destination set by <link linkend="rtp-session-set-remote-addr"><function>rtp_session_set_remote_addr()</function></link> with timestamp <parameter>timestamp</parameter>. For audio data, the timestamp is the numberof the first sample resulting of the data transmitted. See rfc1889 for details. The packet (<parameter>mp</parameter>) is freed once it is sended.</para><para></para><variablelist role="params"><varlistentry><term><parameter>session</parameter> :</term><listitem><simpara> a rtp session.</simpara></listitem></varlistentry><varlistentry><term><parameter>mp</parameter> :</term><listitem><simpara> a rtp packet presented as a mblk_t.</simpara></listitem></varlistentry><varlistentry><term><parameter>userts</parameter> :</term><listitem><simpara></simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the number of bytes sent over the network.</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="rtp-session-get-current-send-ts" role="function">rtp_session_get_current_send_ts ()</title><indexterm><primary>rtp_session_get_current_send_ts</primary></indexterm><programlisting><link linkend="uint32-t">uint32_t</link> rtp_session_get_current_send_ts (<link linkend="RtpSession">RtpSession</link> *session);</programlisting><para>When the rtp session is scheduled and has started to send packets, this functioncomputes the timestamp that matches to the present time. Using this function can be usefull when sending discontinuous streams. Some time can be elapsed between the endof a stream burst and the begin of a new stream burst, and the application may be notnot aware of this elapsed time. In order to get a valid (current) timestamp to pass to #<link linkend="rtp-session-send-with-ts"><function>rtp_session_send_with_ts()</function></link> or #<link linkend="rtp-session-sendm-with-ts"><function>rtp_session_sendm_with_ts()</function></link>, the application mayuse <link linkend="rtp-session-get-current-send-ts"><function>rtp_session_get_current_send_ts()</function></link>.</para><para></para><variablelist role="params"><varlistentry><term><parameter>session</parameter> :</term><listitem><simpara> a rtp session.</simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the current send timestamp for the rtp session.</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="rtp-session-flush-sockets" role="function">rtp_session_flush_sockets ()</title><indexterm><primary>rtp_session_flush_sockets</primary></indexterm><programlisting><link linkend="void">void</link> rtp_session_flush_sockets (<link linkend="RtpSession">RtpSession</link> *session);</programlisting><para>Flushes the sockets for all pending incoming packets.This can be usefull if you did not listen to the stream for a whileand wishes to start to receive again. During the time no receive is madepackets get bufferised into the internal kernel socket structure.</para><para></para><variablelist role="params"><varlistentry><term><parameter>session</parameter> :</term><listitem><simpara> a rtp session</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="rtp-session-set-time-jump-limit" role="function">rtp_session_set_time_jump_limit ()</title><indexterm><primary>rtp_session_set_time_jump_limit</primary></indexterm><programlisting><link linkend="void">void</link> rtp_session_set_time_jump_limit (<link linkend="RtpSession">RtpSession</link> *session, <link linkend="int">int</link> miliseconds);</programlisting><para>oRTP has the possibility to inform the application through a callback registered with rtp_session_signal_connect about crazy incoming RTP stream that jumps from a timestamp N to N+<some crazy value>. This lets the opportunity for the applicationto reset the session in order to resynchronize, or any other action like stopping the calland reporting an error.</para><para></para><variablelist role="params"><varlistentry><term><parameter>session</parameter> :</term><listitem><simpara> the rtp session</simpara></listitem></varlistentry><varlistentry><term><parameter>miliseconds</parameter> :</term><listitem><simpara></simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="rtp-session-set-recv-buf-size" role="function">rtp_session_set_recv_buf_size ()</title><indexterm><primary>rtp_session_set_recv_buf_size</primary></indexterm><programlisting><link linkend="void">void</link> rtp_session_set_recv_buf_size (<link linkend="RtpSession">RtpSession</link> *session, <link linkend="int">int</link> bufsize);</programlisting><para>The default value is 65535 bytes, a big value which is working for everyone.However if your application can make assumption on the MTU, it can be interestingto set it to a lower value in order to save memory.</para><para></para><variablelist role="params"><varlistentry><term><parameter>session</parameter> :</term><listitem><simpara> a rtp session</simpara></listitem></varlistentry><varlistentry><term><parameter>bufsize</parameter> :</term><listitem><simpara> buffer size in bytes for receiving packets</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="rtp-session-reset" role="function">rtp_session_reset ()</title><indexterm><primary>rtp_session_reset</primary></indexterm><programlisting><link linkend="void">void</link> rtp_session_reset (<link linkend="RtpSession">RtpSession</link> *session);</programlisting><para>Reset the session: local and remote addresses are kept unchanged but the internalqueue for ordering and buffering packets is flushed, the session is ready to bere-synchronised to another incoming stream.</para><para></para><variablelist role="params"><varlistentry><term><parameter>session</parameter> :</term><listitem><simpara> a rtp session.</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="rtp-session-set-data" role="function">rtp_session_set_data ()</title><indexterm><primary>rtp_session_set_data</primary></indexterm><programlisting><link linkend="void">void</link> rtp_session_set_data (<link linkend="RtpSession">RtpSession</link> *session, <link linkend="void">void</link> *data);</programlisting><para>Stores some application specific data into the session, so that it is easy to retrieve itfrom the signal callbacks using <link linkend="rtp-session-get-data"><function>rtp_session_get_data()</function></link>.</para><para></para><variablelist role="params"><varlistentry><term><parameter>session</parameter> :</term><listitem><simpara> a rtp session</simpara></listitem></varlistentry><varlistentry><term><parameter>data</parameter> :</term><listitem><simpara> an opaque pointer to be stored in the session</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="rtp-session-get-data" role="function">rtp_session_get_data ()</title><indexterm><primary>rtp_session_get_data</primary></indexterm><programlisting><link linkend="void">void</link>* rtp_session_get_data (const <link linkend="RtpSession">RtpSession</link> *session);</programlisting><para></para><para></para><variablelist role="params"><varlistentry><term><parameter>session</parameter> :</term><listitem><simpara> a rtp session</simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the void pointer previously set using <link linkend="rtp-session-set-data"><function>rtp_session_set_data()</function></link></simpara></listitem></varlistentry></variablelist></refsect2></refsect1></refentry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -