| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (C) 2005, Attractel OOD | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Contributors: | 
					
						
							|  |  |  |  * Slav Klenov <slav@securax.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright on this file is disclaimed to Digium for inclusion in Asterisk | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * See http://www.asterisk.org for more information about
 | 
					
						
							|  |  |  |  * the Asterisk project. Please do not directly contact | 
					
						
							|  |  |  |  * any of the maintainers of this project for assistance; | 
					
						
							|  |  |  |  * the project provides a web site, mailing lists and IRC | 
					
						
							|  |  |  |  * channels for your use. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software, distributed under the terms of | 
					
						
							|  |  |  |  * the GNU General Public License Version 2. See the LICENSE file | 
					
						
							|  |  |  |  * at the top of the source tree. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-22 19:51:16 +00:00
										 |  |  | /*! \file
 | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  |  * \brief Jitterbuffering algorithm. | 
					
						
							| 
									
										
										
										
											2012-03-22 19:51:16 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | #ifndef _FIXEDJITTERBUF_H_
 | 
					
						
							|  |  |  | #define _FIXEDJITTERBUF_H_
 | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #if defined(__cplusplus) || defined(c_plusplus)
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* return codes */ | 
					
						
							| 
									
										
										
										
											2006-05-31 18:09:52 +00:00
										 |  |  | enum { | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | 	FIXED_JB_OK, | 
					
						
							|  |  |  | 	FIXED_JB_DROP, | 
					
						
							|  |  |  | 	FIXED_JB_INTERP, | 
					
						
							|  |  |  | 	FIXED_JB_NOFRAME | 
					
						
							| 
									
										
										
										
											2006-05-31 18:09:52 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* defaults */ | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | #define FIXED_JB_SIZE_DEFAULT 200
 | 
					
						
							|  |  |  | #define FIXED_JB_RESYNCH_THRESHOLD_DEFAULT 1000
 | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* jb configuration properties */ | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | struct fixed_jb_conf | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	long jbsize; | 
					
						
							| 
									
										
										
										
											2012-03-22 19:51:16 +00:00
										 |  |  | 	long resync_threshold; | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | struct fixed_jb_frame | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	void *data; | 
					
						
							|  |  |  | 	long ts; | 
					
						
							|  |  |  | 	long ms; | 
					
						
							|  |  |  | 	long delivery; | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | 	struct fixed_jb_frame *next; | 
					
						
							|  |  |  | 	struct fixed_jb_frame *prev; | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | struct fixed_jb; | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* jb interface */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | struct fixed_jb * fixed_jb_new(struct fixed_jb_conf *conf); | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | void fixed_jb_destroy(struct fixed_jb *jb); | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | int fixed_jb_put_first(struct fixed_jb *jb, void *data, long ms, long ts, long now); | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | int fixed_jb_put(struct fixed_jb *jb, void *data, long ms, long ts, long now); | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | int fixed_jb_get(struct fixed_jb *jb, struct fixed_jb_frame *frame, long now, long interpl); | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | long fixed_jb_next(struct fixed_jb *jb); | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | int fixed_jb_remove(struct fixed_jb *jb, struct fixed_jb_frame *frameout); | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | void fixed_jb_set_force_resynch(struct fixed_jb *jb); | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-12 15:58:43 -06:00
										 |  |  | /*! \brief Checks if the given time stamp is late */ | 
					
						
							|  |  |  | int fixed_jb_is_late(struct fixed_jb *jb, long ts); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-05-31 16:56:50 +00:00
										 |  |  | #if defined(__cplusplus) || defined(c_plusplus)
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 14:07:03 +00:00
										 |  |  | #endif /* _FIXEDJITTERBUF_H_ */
 |