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

📄 ortp-rtpsession-api.html

📁 ortp协议栈(实时传输协议)
💻 HTML
📖 第 1 页 / 共 3 页
字号:
></TT> with timestamp <TTCLASS="PARAMETER"><I>userts</I></TT>. This is a high level function that uses<AHREF="ortp-rtpsession-api.html#RTP-SESSION-CREATE-PACKET">rtp_session_create_packet</A>() and <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SENDM-WITH-TS">rtp_session_sendm_with_ts</A>() to send the data.</P><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN451"><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>session</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a rtp session.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>buffer</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">	a buffer containing the data to be sent in a rtp packet.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>len</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">		the length of the data buffer, in bytes.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>userts</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">	the timestamp of the data to be sent. Refer to the rfc to know what it is.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><SPANCLASS="emphasis"><ICLASS="EMPHASIS">Returns</I></SPAN> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> the number of bytes sent over the network.</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN476"></A><H3><ANAME="RTP-SESSION-RECV-WITH-TS"></A>rtp_session_recv_with_ts ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">gint        rtp_session_recv_with_ts        (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             gchar *buffer,                                             gint len,                                             guint32 time,                                             gint *have_more);</PRE></TD></TR></TABLE><P>Tries to read the bytes of the incoming rtp stream related to timestamp <TTCLASS="PARAMETER"><I>time</I></TT>. In case where the user supplied buffer <TTCLASS="PARAMETER"><I>buffer</I></TT> is not large enough to get all the data related to timestamp <TTCLASS="PARAMETER"><I>time</I></TT>, then *( <TTCLASS="PARAMETER"><I>have_more</I></TT>) is set to 1 to indicate that the applicationshould recall the function with the same timestamp to get more data.</P><P> When the rtp session is scheduled (see <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-SCHEDULING-MODE">rtp_session_set_scheduling_mode</A>() ), and the blocking mode is on (see <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-BLOCKING-MODE">rtp_session_set_blocking_mode</A>() ), then the calling threadis suspended until the timestamp given as argument expires, whatever a received packet fits the query or not.</P><P>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 <TTCLASS="PARAMETER"><I>time</I></TT> 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.</P><P>This function internally calls <AHREF="ortp-rtpsession-api.html#RTP-SESSION-RECVM-WITH-TS">rtp_session_recvm_with_ts</A>() 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.</P><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN499"><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>session</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a rtp session.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>buffer</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">	a user supplied buffer to write the data.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>len</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">		the length in bytes of the user supplied buffer.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>time</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">	the timestamp wanted.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>have_more</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> the address of an integer to indicate if more data is availlable for the given timestamp.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><SPANCLASS="emphasis"><ICLASS="EMPHASIS">Returns</I></SPAN> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> 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.</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN528"></A><H3><ANAME="RTP-SESSION-SENDM-WITH-TS"></A>rtp_session_sendm_with_ts ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">gint        rtp_session_sendm_with_ts       (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             mblk_t *mp,                                             guint32 userts);</PRE></TD></TR></TABLE><P>Send the rtp datagram <TTCLASS="PARAMETER"><I>mp</I></TT> to the destination set by <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-REMOTE-ADDR">rtp_session_set_remote_addr</A>() with timestamp <TTCLASS="PARAMETER"><I>timestamp</I></TT>. For audio data, the timestamp is the numberof the first sample resulting of the data transmitted. See rfc1889 for details.</P><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN541"><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>session</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a rtp session.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>mp</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">	a rtp packet presented as a mblk_t.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>userts</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">&nbsp;</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><SPANCLASS="emphasis"><ICLASS="EMPHASIS">Returns</I></SPAN> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> the number of bytes sent over the network.</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN562"></A><H3><ANAME="RTP-SESSION-RECVM-WITH-TS"></A>rtp_session_recvm_with_ts ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">mblk_t*     rtp_session_recvm_with_ts       (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             guint32 user_ts);</PRE></TD></TR></TABLE><P>Try to get a rtp packet presented as a mblk_t structure from the rtp session.The <TTCLASS="PARAMETER"><I>user_ts</I></TT> 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 <TTCLASS="PARAMETER"><I>user_ts</I></TT>=0, and then incrementing itas it want. The RtpSession takes care of synchronisation between the stream timestampand the user timestamp given here.</P><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN573"><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>session</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a rtp session.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>user_ts</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">	a timestamp.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><SPANCLASS="emphasis"><ICLASS="EMPHASIS">Returns</I></SPAN> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a rtp packet presented as a mblk_t.</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN590"></A><H3><ANAME="RTP-SESSION-CREATE-PACKET"></A>rtp_session_create_packet ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">mblk_t*     rtp_session_create_packet       (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             gint header_size,                                             char *payload,                                             gint payload_size);</PRE></TD></TR></TABLE><P>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 <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SENDM-WITH-TS">rtp_session_sendm_with_ts</A>().</P><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN601"><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>session</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">		a rtp session.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>header_size</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">	the rtp header size. For standart size (without extensions), it is RTP_FIXED_HEADER_SIZE</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>payload</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">data to be copied into the rtp packet.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>payload_size</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> size of data carried by the rtp packet.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><SPANCLASS="emphasis"><ICLASS="EMPHASIS">Returns</I></SPAN> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a rtp packet in a mblk_t (message block) structure.</TD></TR></TBODY></TABLE><P></P></DIV></DIV></DIV><DIVCLASS="NAVFOOTER"><BRCLEAR="all"><BR><TABLEWIDTH="100%"BORDER="0"BGCOLOR="#000000"CELLPADDING="1"CELLSPACING="0"><TR><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="left"><AHREF="ortp-stack-management-functions.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>&#60;&#60;&#60; Previous Page</B></FONT></A></TD><TDWIDTH="25%"BGCOLOR="#0000C0"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="book1.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Home</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#00C000"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="ortpapi.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Up</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="right"><AHREF="ortp-rtp-payloads-and-profiles.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Next Page &#62;&#62;&#62;</B></FONT></A></TD></TR><TR><TDCOLSPAN="2"ALIGN="left"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Stack management functions</B></FONT></TD><TDCOLSPAN="2"ALIGN="right"><FONTCOLOR="#FFFFFF"SIZE="3"><B>RTP payloads and profiles</B></FONT></TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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