本文整理汇总了PHP中Timestamp::asNTP方法的典型用法代码示例。如果您正苦于以下问题:PHP Timestamp::asNTP方法的具体用法?PHP Timestamp::asNTP怎么用?PHP Timestamp::asNTP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timestamp
的用法示例。
在下文中一共展示了Timestamp::asNTP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_sdp
/**
* Takes raw SDP header and use it to generate a .sdp file describing the RTP stream
* Primary use is to tell the caller to send RTP data to $dst_ip
*
* @param $raw_sdp unparsed sdp header
* @param $dst_ip ip address to tell the client to send media streams to
* @param $port specifies lower port number to use. this +3 ports will be allocated
* @return generated sdp header to use as response for $raw_sdp
*/
function generate_sdp($raw_sdp, $dst_ip, $port)
{
$sdp_arr = parse_sdp($raw_sdp);
$ts = new Timestamp();
//Session description
$sdp = "v=0\r\n" . "o=- " . $ts->asNTP() . " 0 IN IP4 " . $sdp_arr['ip'] . "\r\n" . "s=core_dev\r\n" . "c=IN IP4 " . $dst_ip . "\r\n" . "t=0 0\r\n";
//Time active. "0 0" means the session is regarded as permanent
if (!empty($sdp_arr['video'])) {
$sdp .= generate_sdp_media_tag(SDP_VIDEO, $sdp_arr['video'], $port);
$port += 2;
}
if (!empty($sdp_arr['audio'])) {
$sdp .= generate_sdp_media_tag(SDP_AUDIO, $sdp_arr['audio'], $port);
}
return $sdp;
}