⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtpsessionapi.sgml

📁 ortp协议栈(实时传输协议)
💻 SGML
📖 第 1 页 / 共 3 页
字号:
<tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>session</parameter>&nbsp;:</entry><entry> a rtp session</entry></row><row><entry align="right"><parameter>signal</parameter>&nbsp;:</entry><entry>	a signal name</entry></row><row><entry align="right"><parameter>cb</parameter>&nbsp;:</entry><entry>		a callback function.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> 0 on success, -ENOENT if the callbacks was not found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-session-send-with-ts">rtp_session_send_with_ts ()</title><programlisting><link linkend="gint">gint</link>        rtp_session_send_with_ts        (<link linkend="RtpSession">RtpSession</link> *session,                                             <link linkend="gchar">gchar</link> *buffer,                                             <link linkend="gint">gint</link> len,                                             <link linkend="guint32">guint32</link> userts);</programlisting><para>Send a rtp datagram to the destination set by <link linkend="rtp-session-set-remote-addr">rtp_session_set_remote_addr</link>() containingthe data from <parameter>buffer</parameter> with timestamp <parameter>userts</parameter>. This is a high level function that uses<link linkend="rtp-session-create-packet">rtp_session_create_packet</link>() and <link linkend="rtp-session-sendm-with-ts">rtp_session_sendm_with_ts</link>() to send the data.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>session</parameter>&nbsp;:</entry><entry> a rtp session.</entry></row><row><entry align="right"><parameter>buffer</parameter>&nbsp;:</entry><entry>	a buffer containing the data to be sent in a rtp packet.</entry></row><row><entry align="right"><parameter>len</parameter>&nbsp;:</entry><entry>		the length of the data buffer, in bytes.</entry></row><row><entry align="right"><parameter>userts</parameter>&nbsp;:</entry><entry>	the timestamp of the data to be sent. Refer to the rfc to know what it is.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the number of bytes sent over the network.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-session-recv-with-ts">rtp_session_recv_with_ts ()</title><programlisting><link linkend="gint">gint</link>        rtp_session_recv_with_ts        (<link linkend="RtpSession">RtpSession</link> *session,                                             <link linkend="gchar">gchar</link> *buffer,                                             <link linkend="gint">gint</link> len,                                             <link linkend="guint32">guint32</link> time,                                             <link linkend="gint">gint</link> *have_more);</programlisting><para>Tries to read the bytes of the incoming rtp stream related to timestamp <parameter>time</parameter>. In case where the user supplied buffer <parameter>buffer</parameter> is not large enough to get all the data related to timestamp <parameter>time</parameter>, then *( <parameter>have_more</parameter>) is set to 1 to indicate that the applicationshould recall the function with the same timestamp to get more data.</para><para> When the rtp session is scheduled (see <link linkend="rtp-session-set-scheduling-mode">rtp_session_set_scheduling_mode</link>() ), and the blocking mode is on (see <link linkend="rtp-session-set-blocking-mode">rtp_session_set_blocking_mode</link>() ), then the calling threadis suspended until the timestamp given as argument expires, whatever a received packet fits the query or not.</para><para>Important note: it is clear that the application cannot know the timestamp of the firstpacket of the incoming stream, because it can be random. The <parameter>time</parameter> timestamp given to thefunction is used relatively to first timestamp of the stream. In simple words, 0 is a goodvalue to start calling this function.</para><para>This function internally calls <link linkend="rtp-session-recvm-with-ts">rtp_session_recvm_with_ts</link>() to get a rtp packet. The contentof this packet is then copied into the user supplied buffer in an intelligent manner:the function takes care of the size of the supplied buffer and the timestamp given in  argument. Using this function it is possible to read continous audio data (e.g. pcma,pcmu...)with for example a standart buffer of size of 160 with timestamp incrementing by 160 while the incomingstream has a different packet size.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>session</parameter>&nbsp;:</entry><entry> a rtp session.</entry></row><row><entry align="right"><parameter>buffer</parameter>&nbsp;:</entry><entry>	a user supplied buffer to write the data.</entry></row><row><entry align="right"><parameter>len</parameter>&nbsp;:</entry><entry>		the length in bytes of the user supplied buffer.</entry></row><row><entry align="right"><parameter>time</parameter>&nbsp;:</entry><entry>	the timestamp wanted.</entry></row><row><entry align="right"><parameter>have_more</parameter>&nbsp;:</entry><entry> the address of an integer to indicate if more data is availlable for the given timestamp.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> if a packet was availlable with the corresponding timestamp supplied in argument then the number of bytes written in the user supplied buffer is returned. If no packetsare availlable, either because the sender has not started to send the stream, or eitherbecause silence packet are not transmitted, or either because the packet was lost duringnetwork transport, then the function returns zero.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-session-sendm-with-ts">rtp_session_sendm_with_ts ()</title><programlisting><link linkend="gint">gint</link>        rtp_session_sendm_with_ts       (<link linkend="RtpSession">RtpSession</link> *session,                                             <link linkend="mblk-t">mblk_t</link> *mp,                                             <link linkend="guint32">guint32</link> userts);</programlisting><para>Send the rtp datagram <parameter>mp</parameter> to the destination set by <link linkend="rtp-session-set-remote-addr">rtp_session_set_remote_addr</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.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>session</parameter>&nbsp;:</entry><entry> a rtp session.</entry></row><row><entry align="right"><parameter>mp</parameter>&nbsp;:</entry><entry>	a rtp packet presented as a mblk_t.</entry></row><row><entry align="right"><parameter>userts</parameter>&nbsp;:</entry><entry></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the number of bytes sent over the network.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-session-recvm-with-ts">rtp_session_recvm_with_ts ()</title><programlisting><link linkend="mblk-t">mblk_t</link>*     rtp_session_recvm_with_ts       (<link linkend="RtpSession">RtpSession</link> *session,                                             <link linkend="guint32">guint32</link> user_ts);</programlisting><para>Try to get a rtp packet presented as a mblk_t structure from the rtp session.The <parameter>user_ts</parameter> parameter is relative to the first timestamp of the incoming stream. In otherwords, the application does not have to know the first timestamp of the stream, it cansimply call for the first time this function with <parameter>user_ts</parameter>=0, and then incrementing itas it want. The RtpSession takes care of synchronisation between the stream timestampand the user timestamp given here.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>session</parameter>&nbsp;:</entry><entry> a rtp session.</entry></row><row><entry align="right"><parameter>user_ts</parameter>&nbsp;:</entry><entry>	a timestamp.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> a rtp packet presented as a mblk_t.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-session-create-packet">rtp_session_create_packet ()</title><programlisting><link linkend="mblk-t">mblk_t</link>*     rtp_session_create_packet       (<link linkend="RtpSession">RtpSession</link> *session,                                             <link linkend="gint">gint</link> header_size,                                             char *payload,                                             <link linkend="gint">gint</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">rtp_session_sendm_with_ts</link>().</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>session</parameter>&nbsp;:</entry><entry>		a rtp session.</entry></row><row><entry align="right"><parameter>header_size</parameter>&nbsp;:</entry><entry>	the rtp header size. For standart size (without extensions), it is <link linkend="RTP-FIXED-HEADER-SIZE-CAPS">RTP_FIXED_HEADER_SIZE</link></entry></row><row><entry align="right"><parameter>payload</parameter>&nbsp;:</entry><entry>data to be copied into the rtp packet.</entry></row><row><entry align="right"><parameter>payload_size</parameter>&nbsp;:</entry><entry> size of data carried by the rtp packet.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> a rtp packet in a mblk_t (message block) structure.</entry></row></tbody></tgroup></informaltable></refsect2></refsect1></refentry>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -