亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rtp.c

?? MPEG-4編解碼的實現(包括MPEG4視音頻編解碼)
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*
 * FILE:     rtp.c
 * AUTHOR:   Colin Perkins   <csp@isi.edu>
 * MODIFIED: Orion Hodson    <o.hodson@cs.ucl.ac.uk>
 *           Markus Germeier <mager@tzi.de>
 *           Bill Fenner     <fenner@research.att.com>
 *           Timur Friedman  <timur@research.att.com>
 *
 * The routines in this file implement the Real-time Transport Protocol,
 * RTP, as specified in RFC1889 with current updates under discussion in
 * the IETF audio/video transport working group. Portions of the code are
 * derived from the algorithms published in that specification.
 *
 * $Revision: 1.24 $ 
 * $Date: 2002/07/05 22:03:53 $
 * 
 * Copyright (c) 1998-2001 University College London
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, is permitted provided that the following conditions 
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *      This product includes software developed by the Computer Science
 *      Department at University College London.
 * 4. Neither the name of the University nor of the Department may be used
 *    to endorse or promote products derived from this software without
 *    specific prior written permission.
 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

#include "config_unix.h"
#include "config_win32.h"
#include "memory.h"
#include "debug.h"
#include "net_udp.h"
#include "crypt_random.h"
#include "rijndael-api-fst.h"
#include "drand48.h"
#include "gettimeofday.h"
#include "qfDES.h"
#include "md5.h"
#include "ntp.h"

#include "rtp.h"
typedef struct {
        uint32_t key;   /* Original allocation number   */
        uint32_t size;  /* Size of allocation requested */
        uint32_t pad;   /* Alignment padding to 8 bytes */
        uint32_t magic; /* Magic number                 */
} chk_header;
	  extern int chk_header_okay(const chk_header *ch);

/*
 * Encryption stuff.
 */
#define MAX_ENCRYPTION_PAD 16

static int rijndael_initialize(struct rtp *session, u_char *hash, int hash_len);

static int rijndael_decrypt(void *ifptr, uint8_t *data,
		    unsigned int *size);
static int rijndael_encrypt(void *ifptr, uint8_t *data,
	    unsigned int *size);

static int des_initialize(struct rtp *session, u_char *hash, int hash_len);
static int des_decrypt(void *ifptr, uint8_t *data,
	       unsigned int *size);
static int des_encrypt(void *ifptr, uint8_t *data,
	       unsigned int *size);

#define MAX_DROPOUT    3000
#define MAX_MISORDER   100
#define MIN_SEQUENTIAL 2

/*
 * Definitions for the RTP/RTCP packets on the wire...
 */

#define RTP_SEQ_MOD        0x10000
#define RTP_MAX_SDES_LEN   256

#define RTP_LOWER_LAYER_OVERHEAD 28	/* IPv4 + UDP */

#define RTCP_SR   200
#define RTCP_RR   201
#define RTCP_SDES 202
#define RTCP_BYE  203
#define RTCP_APP  204

typedef struct {
#ifdef WORDS_BIGENDIAN
	unsigned short  version:2;	/* packet type            */
	unsigned short  p:1;		/* padding flag           */
	unsigned short  count:5;	/* varies by payload type */
	unsigned short  pt:8;		/* payload type           */
#else
	unsigned short  count:5;	/* varies by payload type */
	unsigned short  p:1;		/* padding flag           */
	unsigned short  version:2;	/* packet type            */
	unsigned short  pt:8;		/* payload type           */
#endif
	uint16_t        length;		/* packet length          */
} rtcp_common;

typedef struct {
	rtcp_common   common;	
	union {
		struct {
			rtcp_sr		sr;
			rtcp_rr       	rr[1];		/* variable-length list */
		} sr;
		struct {
			uint32_t        ssrc;		/* source this RTCP packet is coming from */
			rtcp_rr       	rr[1];		/* variable-length list */
		} rr;
		struct rtcp_sdes_t {
			uint32_t	ssrc;
			rtcp_sdes_item 	item[1];	/* list of SDES */
		} sdes;
		struct {
			uint32_t        ssrc[1];	/* list of sources */
							/* can't express the trailing text... */
		} bye;
		struct {
			uint32_t        ssrc;           
			uint8_t         name[4];
			uint8_t         data[1];
		} app;
	} r;
} rtcp_t;

typedef struct _rtcp_rr_wrapper {
	struct _rtcp_rr_wrapper	*next;
	struct _rtcp_rr_wrapper	*prev;
        uint32_t                 reporter_ssrc;
	rtcp_rr			*rr;
	struct timeval		*ts;	/* Arrival time of this RR */
} rtcp_rr_wrapper;

/*
 * The RTP database contains source-specific information needed 
 * to make it all work. 
 */

typedef struct _source {
	struct _source	*next;
	struct _source	*prev;
	uint32_t	 ssrc;
	char		*cname;
	char		*name;
	char		*email;
	char		*phone;
	char		*loc;
	char		*tool;
	char		*note;
	char		*priv;
	rtcp_sr		*sr;
	struct timeval	 last_sr;
	struct timeval	 last_active;
	int		 should_advertise_sdes;	/* TRUE if this source is a CSRC which we need to advertise SDES for */
	int		 sender;
	int		 got_bye;		/* TRUE if we've received an RTCP bye from this source */
	uint32_t	 base_seq;
	uint16_t	 max_seq;
	uint32_t	 bad_seq;
	uint32_t	 cycles;
	int		 received;
	int		 received_prior;
	int		 expected_prior;
	int		 probation;
	uint32_t	 jitter;
	uint32_t	 transit;
	uint32_t	 magic;			/* For debugging... */
} source;

/* The size of the hash table used to hold the source database. */
/* Should be large enough that we're unlikely to get collisions */
/* when sources are added, but not too large that we waste too  */
/* much memory. Sedgewick ("Algorithms", 2nd Ed, Addison-Wesley */
/* 1988) suggests that this should be around 1/10th the number  */
/* of entries that we expect to have in the database and should */
/* be a prime number. Everything continues to work if this is   */
/* too low, it just goes slower... for now we assume around 100 */
/* participants is a sensible limit so we set this to 11.       */   
#define RTP_DB_SIZE	11

/*
 *  Options for an RTP session are stored in the "options" struct.
 */

typedef struct {
	int 	promiscuous_mode;
	int	wait_for_rtcp;
	int	filter_my_packets;
} options;

/*
 * Encryption function types
 */

// moved to rtp.h by nori
/*
 * typedef int (*rtp_encrypt_func)(struct rtp *, unsigned char *data,
 *				unsigned int size);
 *
 * typedef int (*rtp_decrypt_func)(struct rtp *, unsigned char *data,
 *				unsigned int size);
 */
typedef int (*rtcp_send_f)(struct rtp *s, uint8_t *buffer, int buflen);

/*
 * The "struct rtp" defines an RTP session.
 */

struct rtp {
	socket_udp	*rtp_socket;
	socket_udp	*rtcp_socket;
	char		*addr;
	uint16_t	 rx_port;
	uint16_t	 tx_port;
	int		 ttl;
	uint32_t	 my_ssrc;
	int		 last_advertised_csrc;
	source		*db[RTP_DB_SIZE];
        rtcp_rr_wrapper  rr[RTP_DB_SIZE][RTP_DB_SIZE]; 	/* Indexed by [hash(reporter)][hash(reportee)] */
	options		*opt;
	uint8_t		*userdata;
	int		 invalid_rtp_count;
	int		 invalid_rtcp_count;
	int		 bye_count;
	int		 csrc_count;
	int		 ssrc_count;
	int		 ssrc_count_prev;		/* ssrc_count at the time we last recalculated our RTCP interval */
	int		 sender_count;
	int		 initial_rtcp;
	int		 sending_bye;			/* TRUE if we're in the process of sending a BYE packet */
	double		 avg_rtcp_size;
	int		 we_sent;
	double		 rtcp_bw;			/* RTCP bandwidth fraction, in octets per second. */
	struct timeval	 last_update;
	struct timeval	 last_rtp_send_time;
	struct timeval	 last_rtcp_send_time;
	struct timeval	 next_rtcp_send_time;
	double		 rtcp_interval;
	int		 sdes_count_pri;
	int		 sdes_count_sec;
	int		 sdes_count_ter;
	uint16_t	 rtp_seq;
	uint32_t	 rtp_pcount;
	uint32_t	 rtp_bcount;
    char *encryption_algorithm;
 	int encryption_enabled;
 	rtp_encrypt_func encrypt_func;
 	rtp_decrypt_func decrypt_func;
 	int encryption_pad_length;
  int encryption_lenadd;
  void *encrypt_userdata; // added by nori
 	union {
 		struct {
 			keyInstance keyInstEncrypt;
 			keyInstance keyInstDecrypt;
 			cipherInstance cipherInst;
 		} rijndael;
 		struct {
 			char            *encryption_key;
 		} des;
 	} crypto_state;
	rtp_callback	 callback;
  rtcp_send_f rtcp_send;
  rtcp_send_packet_t rtcp_send_packet;
	uint32_t	 magic;				/* For debugging...  */
};

static int filter_event(struct rtp *session, uint32_t ssrc)
{
	int	filter;

	rtp_get_option(session, RTP_OPT_FILTER_MY_PACKETS, &filter);
	return filter && (ssrc == rtp_my_ssrc(session));
}

static double tv_diff(struct timeval curr_time, struct timeval prev_time)
{
    /* Return curr_time - prev_time */
    double	ct, pt;

    ct = (double) curr_time.tv_sec + (((double) curr_time.tv_usec) / 1000000.0);
    pt = (double) prev_time.tv_sec + (((double) prev_time.tv_usec) / 1000000.0);
    return (ct - pt);
}

static void tv_add(struct timeval *ts, double offset)
{
	/* Add offset seconds to ts */
	double offset_sec, offset_usec;

	offset_usec = modf(offset, &offset_sec) * 1000000;
	ts->tv_sec  += (long) offset_sec;
	ts->tv_usec += (long) offset_usec;
	if (ts->tv_usec > 1000000) {
		ts->tv_sec++;
		ts->tv_usec -= 1000000;
	}
}

static int tv_gt(struct timeval a, struct timeval b)
{
	/* Returns (a>b) */
	if (a.tv_sec > b.tv_sec) {
		return TRUE;
	}
	if (a.tv_sec < b.tv_sec) {
		return FALSE;
	}
	ASSERT(a.tv_sec == b.tv_sec);
	return a.tv_usec > b.tv_usec;
}

static uint32_t next_csrc(struct rtp *session)
{
	/* This returns each source marked "should_advertise_sdes" in turn. */
	int	 chain, cc;
	source	*s;

	cc = 0;
	for (chain = 0; chain < RTP_DB_SIZE; chain++) {
		/* Check that the linked lists making up the chains in */
		/* the hash table are correctly linked together...     */
		for (s = session->db[chain]; s != NULL; s = s->next) {
			if (s->should_advertise_sdes) {
				if (cc == session->last_advertised_csrc) {
                                        session->last_advertised_csrc++;
                                        if (session->last_advertised_csrc == session->csrc_count) {
                                                session->last_advertised_csrc = 0;
                                        }
					return s->ssrc;
				} else {
					cc++;
				}
			}
		}
	}
	/* We should never get here... */
	abort();
}

static int ssrc_hash(uint32_t ssrc)
{
	/* Hash from an ssrc to a position in the source database.   */
	/* Assumes that ssrc values are uniformly distributed, which */
	/* should be true but probably isn't (Rosenberg has reported */
	/* that many implementations generate ssrc values which are  */
	/* not uniformly distributed over the space, and the H.323   */
	/* spec requires that they are non-uniformly distributed).   */
	/* This routine is written as a function rather than inline  */
	/* code to allow it to be made smart in future: probably we  */
	/* should run MD5 on the ssrc and derive a hash value from   */
	/* that, to ensure it's more uniformly distributed?          */
	return ssrc % RTP_DB_SIZE;
}

static void insert_rr(struct rtp *session, uint32_t reporter_ssrc, rtcp_rr *rr, struct timeval *ts)
{
        /* Insert the reception report into the receiver report      */
        /* database. This database is a two dimensional table of     */
        /* rr_wrappers indexed by hashes of reporter_ssrc and        */
        /* reportee_src.  The rr_wrappers in the database are        */
        /* sentinels to reduce conditions in list operations.        */
	/* The ts is used to determine when to timeout this rr.      */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
人禽交欧美网站| 一区二区在线观看视频在线观看| 日韩二区在线观看| 日韩午夜在线观看| 国产伦精品一区二区三区免费迷| 久久久精品蜜桃| av欧美精品.com| 亚洲一二三专区| 欧美一级精品在线| 岛国一区二区三区| 亚洲激情图片qvod| 日韩一级高清毛片| 国产成a人亚洲| 亚洲日本欧美天堂| 欧美一区二区三区视频在线| 国产成a人无v码亚洲福利| 亚洲免费观看高清| 欧美成人精品1314www| 国产成a人无v码亚洲福利| 亚洲一区二区在线观看视频| 亚洲精品一区二区三区四区高清| 99久久久精品免费观看国产蜜| 亚洲一二三四区| 国产婷婷色一区二区三区四区| 91老司机福利 在线| 免费xxxx性欧美18vr| 国产精品萝li| 欧美大片顶级少妇| 色偷偷成人一区二区三区91| 精品一区二区三区香蕉蜜桃 | 青青草原综合久久大伊人精品优势 | 欧美日韩综合不卡| 国产精品一品二品| 国产精品久久久久久久久搜平片| 制服.丝袜.亚洲.另类.中文| av电影在线观看完整版一区二区| 天堂资源在线中文精品| 国产精品久久久久一区| 日韩一级在线观看| 色婷婷av一区二区三区gif | 老司机精品视频在线| 亚洲天堂av老司机| 2021久久国产精品不只是精品 | 欧美电影在线免费观看| 不卡av免费在线观看| 久草精品在线观看| 日韩高清中文字幕一区| 亚洲精品免费电影| 国产精品无遮挡| 久久综合视频网| 3atv一区二区三区| 色视频成人在线观看免| 99久久婷婷国产综合精品电影| 极品少妇一区二区三区精品视频| 香蕉成人啪国产精品视频综合网| 亚洲欧洲一区二区三区| 国产欧美精品一区| www久久精品| 精品黑人一区二区三区久久| 欧美一区二区在线免费观看| 欧美色倩网站大全免费| 91久久精品日日躁夜夜躁欧美| 成人丝袜高跟foot| 国产成人午夜视频| 国产乱码精品一区二区三区av| 美女尤物国产一区| 在线亚洲一区二区| 99热精品一区二区| 波多野结衣在线一区| 成人精品在线视频观看| 国产成a人亚洲| 99免费精品在线观看| 99re这里只有精品首页| 99re热视频精品| 色偷偷久久人人79超碰人人澡| 在线国产电影不卡| 欧美日韩免费一区二区三区| 欧美日韩久久不卡| 91.com在线观看| 日韩一区二区三区三四区视频在线观看| 欧美日韩免费观看一区二区三区| 欧美日韩一区成人| 7777精品久久久大香线蕉| 5566中文字幕一区二区电影| 日韩欧美一区中文| 国产亚洲综合性久久久影院| 国产精品久线观看视频| 亚洲麻豆国产自偷在线| 亚洲一区二区三区免费视频| 日韩电影在线观看电影| 国产一区二区三区四区五区美女| 国产福利91精品| 天天亚洲美女在线视频| 欧美电影在哪看比较好| 蜜臀久久99精品久久久久久9| 91丨九色porny丨蝌蚪| 亚洲成人av福利| 亚洲欧美二区三区| 国产欧美日本一区视频| 精品国产sm最大网站免费看| 69精品人人人人| 欧美日韩一级片网站| 色欧美片视频在线观看| 91一区二区在线观看| av日韩在线网站| jiyouzz国产精品久久| 久久99热这里只有精品| 视频一区二区三区中文字幕| 一片黄亚洲嫩模| 亚洲精品福利视频网站| 亚洲情趣在线观看| 伊人开心综合网| 亚洲国产精品久久人人爱蜜臀 | 日本一区二区不卡视频| 久久蜜桃av一区精品变态类天堂| 精品欧美乱码久久久久久| 精品国产免费视频| 亚洲精品一区二区三区在线观看 | 亚洲制服欧美中文字幕中文字幕| 亚洲欧美欧美一区二区三区| 自拍偷自拍亚洲精品播放| 综合激情成人伊人| 亚洲在线中文字幕| 亚洲bt欧美bt精品| 美女视频黄免费的久久| 韩国在线一区二区| 国产乱子轮精品视频| 国产.欧美.日韩| 色噜噜久久综合| 欧美精品日韩一区| 久久先锋影音av鲁色资源网| 亚洲国产精品ⅴa在线观看| 国产精品免费久久| 亚洲欧美日韩精品久久久久| 亚洲午夜av在线| 久久精品国产成人一区二区三区| 国产又粗又猛又爽又黄91精品| 国产成人亚洲综合a∨猫咪| 91色porny| 精品国产一区二区三区四区四| 久久久精品免费免费| 亚洲欧美二区三区| 美女免费视频一区二区| 不卡一区二区三区四区| 欧美日韩另类一区| 国产亚洲一区二区三区在线观看| 亚洲欧美偷拍卡通变态| 秋霞午夜鲁丝一区二区老狼| 国产成人综合精品三级| 91福利视频在线| 精品成人在线观看| 亚洲最大成人网4388xx| 久久国产乱子精品免费女| eeuss鲁片一区二区三区| 在线播放中文字幕一区| 国产精品成人免费| 午夜视频一区二区三区| 成人网男人的天堂| 日韩一二三区不卡| 夜夜精品视频一区二区| 国产精品中文有码| 欧美性生活影院| 国产精品久久久久久久久免费相片| 秋霞成人午夜伦在线观看| 色综合欧美在线| 久久精品人人做| 奇米一区二区三区| 欧美伊人久久久久久午夜久久久久| 久久众筹精品私拍模特| 午夜视频一区二区| 色婷婷av一区| 中文欧美字幕免费| 美腿丝袜一区二区三区| 欧美亚洲一区二区在线| 中文字幕永久在线不卡| 精品一区二区三区欧美| 91精品欧美一区二区三区综合在| 亚洲欧洲av一区二区三区久久| 黄色资源网久久资源365| 在线91免费看| 亚洲成a天堂v人片| 欧美在线观看一区二区| 亚洲色图视频网| 成人精品国产免费网站| 国产香蕉久久精品综合网| 精久久久久久久久久久| 欧美一区欧美二区| 日本不卡高清视频| 91麻豆精品国产91久久久资源速度 | 午夜精品免费在线观看| 在线观看一区二区精品视频| 亚洲色图欧美偷拍| 99久久国产免费看| 国产精品久久久久久久久免费桃花 | 7777精品伊人久久久大香线蕉的| 亚洲一区二区黄色| 欧美精三区欧美精三区| 国产精品一品视频| 中文字幕欧美国产| 成人黄色777网|