diff options
author | Mamadou DIOP <bossiel@yahoo.fr> | 2016-02-23 22:00:35 +0100 |
---|---|---|
committer | Mamadou DIOP <bossiel@yahoo.fr> | 2016-02-23 22:00:35 +0100 |
commit | 50dfb4359619563012997bc3ddafb7667741066c (patch) | |
tree | db234c1edc3240a653363b5735fc4077af4b8720 /tinyDAV/include/tinydav/audio | |
parent | 94b2219209038e05dd26395f6fb700be4d1062c0 (diff) | |
download | doubango-50dfb4359619563012997bc3ddafb7667741066c.zip doubango-50dfb4359619563012997bc3ddafb7667741066c.tar.gz |
Add new QoS implementation
Code formatting
Diffstat (limited to 'tinyDAV/include/tinydav/audio')
25 files changed, 294 insertions, 305 deletions
diff --git a/tinyDAV/include/tinydav/audio/alsa/tdav_common_alsa.h b/tinyDAV/include/tinydav/audio/alsa/tdav_common_alsa.h index d6b0673..5df148b 100755 --- a/tinyDAV/include/tinydav/audio/alsa/tdav_common_alsa.h +++ b/tinyDAV/include/tinydav/audio/alsa/tdav_common_alsa.h @@ -1,17 +1,17 @@ /* Copyright (C) 2014 Mamadou DIOP. -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ @@ -33,27 +33,26 @@ TDAV_BEGIN_DECLS #include <alsa/asoundlib.h> -typedef struct tdav_common_alsa_s -{ - tsk_bool_t b_initialized; - tsk_bool_t b_muted; - tsk_bool_t b_started; - tsk_bool_t b_prepared; - tsk_bool_t b_paused; - tsk_bool_t b_capture; - - tsk_size_t n_buff_size_in_bytes; - tsk_size_t n_buff_size_in_samples; - uint8_t* p_buff_ptr; +typedef struct tdav_common_alsa_s { + tsk_bool_t b_initialized; + tsk_bool_t b_muted; + tsk_bool_t b_started; + tsk_bool_t b_prepared; + tsk_bool_t b_paused; + tsk_bool_t b_capture; + + tsk_size_t n_buff_size_in_bytes; + tsk_size_t n_buff_size_in_samples; + uint8_t* p_buff_ptr; + + int channels; + int sample_rate; - int channels; - int sample_rate; - - snd_pcm_t *p_handle; - snd_pcm_hw_params_t *p_params; - char* p_device_name; + snd_pcm_t *p_handle; + snd_pcm_hw_params_t *p_params; + char* p_device_name; - TSK_DECLARE_SAFEOBJ; + TSK_DECLARE_SAFEOBJ; } tdav_common_alsa_t; diff --git a/tinyDAV/include/tinydav/audio/alsa/tdav_consumer_alsa.h b/tinyDAV/include/tinydav/audio/alsa/tdav_consumer_alsa.h index ae9f0f9..362cd03 100755 --- a/tinyDAV/include/tinydav/audio/alsa/tdav_consumer_alsa.h +++ b/tinyDAV/include/tinydav/audio/alsa/tdav_consumer_alsa.h @@ -1,17 +1,17 @@ /* Copyright (C) 2014 Mamadou DIOP. -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ diff --git a/tinyDAV/include/tinydav/audio/alsa/tdav_producer_alsa.h b/tinyDAV/include/tinydav/audio/alsa/tdav_producer_alsa.h index 78fd4eb..74561c4 100755 --- a/tinyDAV/include/tinydav/audio/alsa/tdav_producer_alsa.h +++ b/tinyDAV/include/tinydav/audio/alsa/tdav_producer_alsa.h @@ -1,17 +1,17 @@ /* Copyright (C) 2014 Mamadou DIOP. -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ diff --git a/tinyDAV/include/tinydav/audio/coreaudio/tdav_audiounit.h b/tinyDAV/include/tinydav/audio/coreaudio/tdav_audiounit.h index 128681a..3db4e6a 100755 --- a/tinyDAV/include/tinydav/audio/coreaudio/tdav_audiounit.h +++ b/tinyDAV/include/tinydav/audio/coreaudio/tdav_audiounit.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> - * + * * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audioqueue.h b/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audioqueue.h index c7b1954..f278b4c 100755 --- a/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audioqueue.h +++ b/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audioqueue.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2010-2015 Mamadou DIOP. - * + * * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -40,16 +40,15 @@ TDAV_BEGIN_DECLS # define CoreAudioPlayBuffers 3 #endif -typedef struct tdav_consumer_audioqueue_s -{ - TDAV_DECLARE_CONSUMER_AUDIO; - - tsk_bool_t started; - +typedef struct tdav_consumer_audioqueue_s { + TDAV_DECLARE_CONSUMER_AUDIO; + + tsk_bool_t started; + AudioStreamBasicDescription description; AudioQueueRef queue; AudioQueueBufferRef buffers[CoreAudioPlayBuffers]; - + tsk_size_t buffer_size; } tdav_consumer_audioqueue_t; diff --git a/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audiounit.h b/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audiounit.h index 509f787..ca48978 100755 --- a/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audiounit.h +++ b/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audiounit.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> - * + * * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -36,26 +36,25 @@ TDAV_BEGIN_DECLS -typedef struct tdav_consumer_audiounit_s -{ - TDAV_DECLARE_CONSUMER_AUDIO; - - tdav_audiounit_handle_t* audioUnitHandle; - unsigned started:1; - unsigned paused:1; - - struct { - struct { - void* buffer; - tsk_size_t size; - } chunck; - tsk_ssize_t leftBytes; - SpeexBuffer* buffer; - tsk_size_t size; - tsk_mutex_handle_t* mutex; - } ring; - - tmedia_resampler_t *resampler; +typedef struct tdav_consumer_audiounit_s { + TDAV_DECLARE_CONSUMER_AUDIO; + + tdav_audiounit_handle_t* audioUnitHandle; + unsigned started:1; + unsigned paused:1; + + struct { + struct { + void* buffer; + tsk_size_t size; + } chunck; + tsk_ssize_t leftBytes; + SpeexBuffer* buffer; + tsk_size_t size; + tsk_mutex_handle_t* mutex; + } ring; + + tmedia_resampler_t *resampler; } tdav_consumer_audiounit_t; diff --git a/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audioqueue.h b/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audioqueue.h index 27c9b98..4a858a9 100755 --- a/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audioqueue.h +++ b/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audioqueue.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> - * + * * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -40,16 +40,15 @@ TDAV_BEGIN_DECLS #define CoreAudioRecordBuffers 3 -typedef struct tdav_producer_audioqueue_s -{ - TDAV_DECLARE_PRODUCER_AUDIO; - - tsk_bool_t started; - +typedef struct tdav_producer_audioqueue_s { + TDAV_DECLARE_PRODUCER_AUDIO; + + tsk_bool_t started; + AudioStreamBasicDescription description; AudioQueueRef queue; AudioQueueBufferRef buffers[CoreAudioRecordBuffers]; - + tsk_size_t buffer_size; } tdav_producer_audioqueue_t; diff --git a/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audiounit.h b/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audiounit.h index c1a99cb..bcc44d7 100755 --- a/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audiounit.h +++ b/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audiounit.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> - * + * * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -35,23 +35,22 @@ TDAV_BEGIN_DECLS -typedef struct tdav_producer_audiounit_s -{ - TDAV_DECLARE_PRODUCER_AUDIO; - - tdav_audiounit_handle_t* audioUnitHandle; - unsigned started:1; - unsigned paused:1; +typedef struct tdav_producer_audiounit_s { + TDAV_DECLARE_PRODUCER_AUDIO; + + tdav_audiounit_handle_t* audioUnitHandle; + unsigned started:1; + unsigned paused:1; unsigned muted; - - struct { - struct { - void* buffer; - tsk_size_t size; - } chunck; - SpeexBuffer* buffer; - tsk_size_t size; - } ring; + + struct { + struct { + void* buffer; + tsk_size_t size; + } chunck; + SpeexBuffer* buffer; + tsk_size_t size; + } ring; } tdav_producer_audiounit_t; diff --git a/tinyDAV/include/tinydav/audio/directsound/tdav_consumer_dsound.h b/tinyDAV/include/tinydav/audio/directsound/tdav_consumer_dsound.h index dbba1a8..1cc5331 100755 --- a/tinyDAV/include/tinydav/audio/directsound/tdav_consumer_dsound.h +++ b/tinyDAV/include/tinydav/audio/directsound/tdav_consumer_dsound.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyDAV/include/tinydav/audio/directsound/tdav_producer_dsound.h b/tinyDAV/include/tinydav/audio/directsound/tdav_producer_dsound.h index 1f68008..7252fa9 100755 --- a/tinyDAV/include/tinydav/audio/directsound/tdav_producer_dsound.h +++ b/tinyDAV/include/tinydav/audio/directsound/tdav_producer_dsound.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyDAV/include/tinydav/audio/oss/tdav_consumer_oss.h b/tinyDAV/include/tinydav/audio/oss/tdav_consumer_oss.h index 64deeef..278457b 100755 --- a/tinyDAV/include/tinydav/audio/oss/tdav_consumer_oss.h +++ b/tinyDAV/include/tinydav/audio/oss/tdav_consumer_oss.h @@ -1,17 +1,17 @@ /* Copyright (C) 2014 Mamadou DIOP. -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ diff --git a/tinyDAV/include/tinydav/audio/oss/tdav_producer_oss.h b/tinyDAV/include/tinydav/audio/oss/tdav_producer_oss.h index 2fa00ff..c32462b 100755 --- a/tinyDAV/include/tinydav/audio/oss/tdav_producer_oss.h +++ b/tinyDAV/include/tinydav/audio/oss/tdav_producer_oss.h @@ -1,17 +1,17 @@ /* Copyright (C) 2014 Mamadou DIOP. -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ diff --git a/tinyDAV/include/tinydav/audio/tdav_consumer_audio.h b/tinyDAV/include/tinydav/audio/tdav_consumer_audio.h index c561d84..4f8cc48 100755 --- a/tinyDAV/include/tinydav/audio/tdav_consumer_audio.h +++ b/tinyDAV/include/tinydav/audio/tdav_consumer_audio.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -38,15 +38,14 @@ TDAV_BEGIN_DECLS #define TDAV_CONSUMER_AUDIO(self) ((tdav_consumer_audio_t*)(self)) -typedef struct tdav_consumer_audio_s -{ - TMEDIA_DECLARE_CONSUMER; - - struct tmedia_denoise_s* denoise; - struct tmedia_resampler_s* resampler; - struct tmedia_jitterbuffer_s* jitterbuffer; - - TSK_DECLARE_SAFEOBJ; +typedef struct tdav_consumer_audio_s { + TMEDIA_DECLARE_CONSUMER; + + struct tmedia_denoise_s* denoise; + struct tmedia_resampler_s* resampler; + struct tmedia_jitterbuffer_s* jitterbuffer; + + TSK_DECLARE_SAFEOBJ; } tdav_consumer_audio_t; diff --git a/tinyDAV/include/tinydav/audio/tdav_jitterbuffer.h b/tinyDAV/include/tinydav/audio/tdav_jitterbuffer.h index c6d2449..f248da1 100755 --- a/tinyDAV/include/tinydav/audio/tdav_jitterbuffer.h +++ b/tinyDAV/include/tinydav/audio/tdav_jitterbuffer.h @@ -1,21 +1,21 @@ /* File from: http://cms.speakup.nl/tech/opensource/jitterbuffer/verslag-20051209.pdf/ */ /******************************************************* - * jitterbuffer: - * an application-independent jitterbuffer, which tries + * jitterbuffer: + * an application-independent jitterbuffer, which tries * to achieve the maximum user perception during a call. * For more information look at: * http://www.speakup.nl/opensource/jitterbuffer/ * * Copyright on this file is held by: - * - Jesse Kaijen <jesse@speakup.nl> + * - Jesse Kaijen <jesse@speakup.nl> * - SpeakUp <info@speakup.nl> * * Contributors: * Jesse Kaijen <jesse@speakup.nl> * * Version: 1.1 - * + * * Changelog: * 1.0 => 1.1 (2006-03-24) (thanks to Micheal Jerris, freeswitch.org) * - added MSVC 2005 project files @@ -25,13 +25,13 @@ * This program is free software, distributed under the terms of: * - the GNU Lesser (Library) General Public License * - the Mozilla Public License - * + * * if you are interested in an different licence type, please contact us. * - * How to use the jitterbuffer, please look at the comments + * How to use the jitterbuffer, please look at the comments * in the headerfile. * - * Further details on specific implementations, + * Further details on specific implementations, * please look at the comments in the code file. */ @@ -48,26 +48,26 @@ TDAV_BEGIN_DECLS * The header file consists of four parts. * - configuration constants, structs and parameter definitions * - functions - * - How to use the jitterbuffer and + * - How to use the jitterbuffer and * which responsibilities do YOU have * - debug messages explained */ // configuration constants -/* Number of historical timestamps to use in calculating jitter and jitterbuffer size */ +/* Number of historical timestamps to use in calculating jitter and jitterbuffer size */ #ifndef JB_HISTORY_SIZE # define JB_HISTORY_SIZE 500 #endif /* minimum jitterbuffer size, disabled if 0 */ #define JB_MIN_SIZE 0 -/* maximum jitterbuffer size, disabled if 0 */ +/* maximum jitterbuffer size, disabled if 0 */ #define JB_MAX_SIZE 0 - /* maximum successive interpolating frames, disabled if 0 */ +/* maximum successive interpolating frames, disabled if 0 */ #define JB_MAX_SUCCESSIVE_INTERP 0 /* amount of extra delay allowed before shrinking */ -#define JB_ALLOW_EXTRA_DELAY 30 +#define JB_ALLOW_EXTRA_DELAY 30 /* ms between growing */ #define JB_WAIT_GROW 60 /* ms between shrinking */ @@ -77,70 +77,70 @@ TDAV_BEGIN_DECLS //structs typedef struct jb_info { - long frames_received; /* Number of frames received by the jitterbuffer */ - long frames_late; /* Number of frames that were late */ - long frames_lost; /* Number of frames that were lost */ - long frames_ooo; /* Number of frames that were Out Of Order */ - long frames_dropped; /* Number of frames that were dropped due shrinkage of the jitterbuffer */ - long frames_dropped_twice; /* Number of frames that were dropped because this timestamp was already in the jitterbuffer */ - - long delay; /* Current delay due the jitterbuffer */ - long jitter; /* jitter measured within current history interval*/ - long losspct; /* recent lost frame percentage (network and jitterbuffer loss) */ - - long delay_target; /* The delay where we want to grow to */ - long losspct_jb; /* recent lost percentage due the jitterbuffer */ - long last_voice_ms; /* the duration of the last voice frame */ - short silence; /* If we are in silence 1-yes 0-no */ - long iqr; /* Inter Quartile Range of current history, if the squareroot is taken it is a good estimate of jitter */ + long frames_received; /* Number of frames received by the jitterbuffer */ + long frames_late; /* Number of frames that were late */ + long frames_lost; /* Number of frames that were lost */ + long frames_ooo; /* Number of frames that were Out Of Order */ + long frames_dropped; /* Number of frames that were dropped due shrinkage of the jitterbuffer */ + long frames_dropped_twice; /* Number of frames that were dropped because this timestamp was already in the jitterbuffer */ + + long delay; /* Current delay due the jitterbuffer */ + long jitter; /* jitter measured within current history interval*/ + long losspct; /* recent lost frame percentage (network and jitterbuffer loss) */ + + long delay_target; /* The delay where we want to grow to */ + long losspct_jb; /* recent lost percentage due the jitterbuffer */ + long last_voice_ms; /* the duration of the last voice frame */ + short silence; /* If we are in silence 1-yes 0-no */ + long iqr; /* Inter Quartile Range of current history, if the squareroot is taken it is a good estimate of jitter */ } jb_info; typedef struct jb_frame { - void *data; /* the frame data */ - long ts; /* the senders timestamp */ - long ms; /* length of this frame in ms */ - int type; /* the type of frame */ - int codec; /* codec of this frame, undefined if nonvoice */ - struct jb_frame *next, *prev; /* pointers to the next and previous frames in the queue */ + void *data; /* the frame data */ + long ts; /* the senders timestamp */ + long ms; /* length of this frame in ms */ + int type; /* the type of frame */ + int codec; /* codec of this frame, undefined if nonvoice */ + struct jb_frame *next, *prev; /* pointers to the next and previous frames in the queue */ } jb_frame; typedef struct jb_hist_element { - long delay; /* difference between time of arrival and senders timestamp */ - long ts; /* senders timestamp */ - long ms; /* length of this frame in ms */ - int codec; /* wich codec this frame has */ -} jb_hist_element; + long delay; /* difference between time of arrival and senders timestamp */ + long ts; /* senders timestamp */ + long ms; /* length of this frame in ms */ + int codec; /* wich codec this frame has */ +} jb_hist_element; typedef struct jb_settings { - /* settings */ - long min_jb; /* defines a hard clamp to use in setting the jitterbuffer delay */ - long max_jb; /* defines a hard clamp to use in setting the jitterbuffer delay */ - long max_successive_interp; /* the maximum count of successive interpolations before assuming silence */ - long extra_delay; /* amount of extra delay allowed before shrinking */ - long wait_grow; /* ms between growing */ - long wait_shrink; /* ms between shrinking */ - long max_diff; /* maximum number of milliseconds the jitterbuffer may be off */ + /* settings */ + long min_jb; /* defines a hard clamp to use in setting the jitterbuffer delay */ + long max_jb; /* defines a hard clamp to use in setting the jitterbuffer delay */ + long max_successive_interp; /* the maximum count of successive interpolations before assuming silence */ + long extra_delay; /* amount of extra delay allowed before shrinking */ + long wait_grow; /* ms between growing */ + long wait_shrink; /* ms between shrinking */ + long max_diff; /* maximum number of milliseconds the jitterbuffer may be off */ } jb_settings; typedef struct jitterbuffer { - struct jb_hist_element hist[JB_HISTORY_SIZE]; /* the history of the last received frames */ - long hist_sorted_delay[JB_HISTORY_SIZE]; /* a sorted buffer of the delays (lowest first) */ - long hist_sorted_timestamp[JB_HISTORY_SIZE]; /* a sorted buffer of the timestamps (lowest first) */ - - int hist_pointer; /* points to index in history for next entry */ - long last_adjustment; /* the time of the last adjustment (growing or shrinking) */ - long next_voice_time; /* the next ts is to be read from the jb (senders timestamp) */ - long cnt_successive_interp; /* the count of consecutive interpolation frames */ - long silence_begin_ts; /* the time of the last CNG frame, when in silence */ - long min; /* the clock difference within current history interval */ - long current; /* the present jitterbuffer adjustment */ - long target; /* the target jitterbuffer adjustment */ - long last_delay; /* the delay of the last packet, used for calc. jitter */ - - jb_frame *voiceframes; /* queued voiceframes */ - jb_frame *controlframes; /* queued controlframes */ - jb_settings settings; /* the settings of the jitterbuffer */ - jb_info info; /* the statistics of the jitterbuffer */ + struct jb_hist_element hist[JB_HISTORY_SIZE]; /* the history of the last received frames */ + long hist_sorted_delay[JB_HISTORY_SIZE]; /* a sorted buffer of the delays (lowest first) */ + long hist_sorted_timestamp[JB_HISTORY_SIZE]; /* a sorted buffer of the timestamps (lowest first) */ + + int hist_pointer; /* points to index in history for next entry */ + long last_adjustment; /* the time of the last adjustment (growing or shrinking) */ + long next_voice_time; /* the next ts is to be read from the jb (senders timestamp) */ + long cnt_successive_interp; /* the count of consecutive interpolation frames */ + long silence_begin_ts; /* the time of the last CNG frame, when in silence */ + long min; /* the clock difference within current history interval */ + long current; /* the present jitterbuffer adjustment */ + long target; /* the target jitterbuffer adjustment */ + long last_delay; /* the delay of the last packet, used for calc. jitter */ + + jb_frame *voiceframes; /* queued voiceframes */ + jb_frame *controlframes; /* queued controlframes */ + jb_settings settings; /* the settings of the jitterbuffer */ + jb_info info; /* the statistics of the jitterbuffer */ } jitterbuffer; //parameter definitions @@ -174,24 +174,24 @@ typedef struct jitterbuffer { /* * Creates a new jitterbuffer and sets the default settings. - * Always use this function for creating a new jitterbuffer. + * Always use this function for creating a new jitterbuffer. */ jitterbuffer *jb_new(); /* - * The control frames and possible personal settings are kept. - * History and voice/silence frames are destroyed. + * The control frames and possible personal settings are kept. + * History and voice/silence frames are destroyed. */ void jb_reset(jitterbuffer *jb); /* * Resets the jitterbuffer totally, all the control/voice/silence frames are destroyed - * default settings are put as well. + * default settings are put as well. */ void jb_reset_all(jitterbuffer *jb); /* - * Destroy the jitterbuffer and any frame within. + * Destroy the jitterbuffer and any frame within. * Always use this function for destroying a jitterbuffer, * otherwise there is a chance of memory leaking. */ @@ -204,7 +204,7 @@ void jb_destroy(jitterbuffer *jb); void jb_set_settings(jitterbuffer *jb, jb_settings *settings); /* - * Get the statistics for the jitterbuffer. + * Get the statistics for the jitterbuffer. * Copying the statistics directly for the jitterbuffer won't work because * The statistics are only calculated when calling this function. */ @@ -248,7 +248,7 @@ void jb_put(jitterbuffer *jb, void *data, int type, long ms, long ts, long now, * Get a packet from the jitterbuffer if it's available. * control packets have a higher priority above voice and silence packets * they are always delivered as fast as possible. The delay of the jitterbuffer - * doesn't work for these packets. + * doesn't work for these packets. * @REQUIRE 1<interpl <= jb->settings->extra_delay (=default JB_ALLOW_EXTRA_DELAY) * * return will be: diff --git a/tinyDAV/include/tinydav/audio/tdav_producer_audio.h b/tinyDAV/include/tinydav/audio/tdav_producer_audio.h index 47e0a4f..2cd3808 100755 --- a/tinyDAV/include/tinydav/audio/tdav_producer_audio.h +++ b/tinyDAV/include/tinydav/audio/tdav_producer_audio.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -40,9 +40,8 @@ TDAV_BEGIN_DECLS #define TDAV_PRODUCER_AUDIO(self) ((tdav_producer_audio_t*)(self)) -typedef struct tdav_producer_audio_s -{ - TMEDIA_DECLARE_PRODUCER; +typedef struct tdav_producer_audio_s { + TMEDIA_DECLARE_PRODUCER; } tdav_producer_audio_t; diff --git a/tinyDAV/include/tinydav/audio/tdav_session_audio.h b/tinyDAV/include/tinydav/audio/tdav_session_audio.h index e2ab66f..4f1403b 100755 --- a/tinyDAV/include/tinydav/audio/tdav_session_audio.h +++ b/tinyDAV/include/tinydav/audio/tdav_session_audio.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -39,50 +39,49 @@ TDAV_BEGIN_DECLS typedef tsk_list_t tdav_session_audio_dtmfe_L_t; -typedef struct tdav_session_audio_s -{ - TDAV_DECLARE_SESSION_AV; - - tsk_bool_t is_started; - - struct { - unsigned started:1; - tsk_timer_manager_handle_t* handle_mgr_global; - } timer; - - struct { - uint32_t payload_type; - struct tmedia_codec_s* codec; - - void* buffer; - tsk_size_t buffer_size; - - struct { - void* buffer; - tsk_size_t buffer_size; - struct tmedia_resampler_s* instance; - } resampler; - } encoder; - - struct { - uint32_t payload_type; - struct tmedia_codec_s* codec; - - void* buffer; - tsk_size_t buffer_size; - - struct { - void* buffer; - tsk_size_t buffer_size; - struct tmedia_resampler_s* instance; - } resampler; - } decoder; - - struct tmedia_denoise_s* denoise; - struct tmedia_jitterbuffer_s* jitterbuffer; - - tdav_session_audio_dtmfe_L_t* dtmf_events; - tsk_bool_t is_sending_dtmf_events; +typedef struct tdav_session_audio_s { + TDAV_DECLARE_SESSION_AV; + + tsk_bool_t is_started; + + struct { + unsigned started:1; + tsk_timer_manager_handle_t* handle_mgr_global; + } timer; + + struct { + uint32_t payload_type; + struct tmedia_codec_s* codec; + + void* buffer; + tsk_size_t buffer_size; + + struct { + void* buffer; + tsk_size_t buffer_size; + struct tmedia_resampler_s* instance; + } resampler; + } encoder; + + struct { + uint32_t payload_type; + struct tmedia_codec_s* codec; + + void* buffer; + tsk_size_t buffer_size; + + struct { + void* buffer; + tsk_size_t buffer_size; + struct tmedia_resampler_s* instance; + } resampler; + } decoder; + + struct tmedia_denoise_s* denoise; + struct tmedia_jitterbuffer_s* jitterbuffer; + + tdav_session_audio_dtmfe_L_t* dtmf_events; + tsk_bool_t is_sending_dtmf_events; } tdav_session_audio_t; diff --git a/tinyDAV/include/tinydav/audio/tdav_speakup_jitterbuffer.h b/tinyDAV/include/tinydav/audio/tdav_speakup_jitterbuffer.h index e80c7b5..4eaa53d 100755 --- a/tinyDAV/include/tinydav/audio/tdav_speakup_jitterbuffer.h +++ b/tinyDAV/include/tinydav/audio/tdav_speakup_jitterbuffer.h @@ -2,19 +2,19 @@ * Copyright (C) 2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -39,17 +39,16 @@ TDAV_BEGIN_DECLS /** Speakuo JitterBufferr*/ -typedef struct tdav_speakup_jitterBuffer_s -{ - TMEDIA_DECLARE_JITTER_BUFFER; - - jitterbuffer *jbuffer; - uint8_t jcodec; - uint64_t ref_timestamp; - uint32_t frame_duration; - uint32_t rate; - uint32_t channels; - uint32_t _10ms_size_bytes; +typedef struct tdav_speakup_jitterBuffer_s { + TMEDIA_DECLARE_JITTER_BUFFER; + + jitterbuffer *jbuffer; + uint8_t jcodec; + uint64_t ref_timestamp; + uint32_t frame_duration; + uint32_t rate; + uint32_t channels; + uint32_t _10ms_size_bytes; } tdav_speakup_jitterbuffer_t; diff --git a/tinyDAV/include/tinydav/audio/tdav_speex_denoise.h b/tinyDAV/include/tinydav/audio/tdav_speex_denoise.h index 3271066..fe6d90f 100755 --- a/tinyDAV/include/tinydav/audio/tdav_speex_denoise.h +++ b/tinyDAV/include/tinydav/audio/tdav_speex_denoise.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyDAV/include/tinydav/audio/tdav_speex_jitterbuffer.h b/tinyDAV/include/tinydav/audio/tdav_speex_jitterbuffer.h index 019db5d..f54525a 100755 --- a/tinyDAV/include/tinydav/audio/tdav_speex_jitterbuffer.h +++ b/tinyDAV/include/tinydav/audio/tdav_speex_jitterbuffer.h @@ -2,19 +2,19 @@ * Copyright (C) 2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyDAV/include/tinydav/audio/tdav_speex_resampler.h b/tinyDAV/include/tinydav/audio/tdav_speex_resampler.h index 635882d..84d2296 100755 --- a/tinyDAV/include/tinydav/audio/tdav_speex_resampler.h +++ b/tinyDAV/include/tinydav/audio/tdav_speex_resampler.h @@ -2,19 +2,19 @@ * Copyright (C) 2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyDAV/include/tinydav/audio/tdav_webrtc_denoise.h b/tinyDAV/include/tinydav/audio/tdav_webrtc_denoise.h index 7c5e956..69ab671 100755 --- a/tinyDAV/include/tinydav/audio/tdav_webrtc_denoise.h +++ b/tinyDAV/include/tinydav/audio/tdav_webrtc_denoise.h @@ -2,19 +2,19 @@ * Copyright (C) 2011 Doubango Telecom <http://www.doubango.org> * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyDAV/include/tinydav/audio/wasapi/tdav_consumer_wasapi.h b/tinyDAV/include/tinydav/audio/wasapi/tdav_consumer_wasapi.h index 0da22e8..ab581e5 100755 --- a/tinyDAV/include/tinydav/audio/wasapi/tdav_consumer_wasapi.h +++ b/tinyDAV/include/tinydav/audio/wasapi/tdav_consumer_wasapi.h @@ -1,17 +1,17 @@ /*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ diff --git a/tinyDAV/include/tinydav/audio/wasapi/tdav_producer_wasapi.h b/tinyDAV/include/tinydav/audio/wasapi/tdav_producer_wasapi.h index e215769..9e58ef1 100755 --- a/tinyDAV/include/tinydav/audio/wasapi/tdav_producer_wasapi.h +++ b/tinyDAV/include/tinydav/audio/wasapi/tdav_producer_wasapi.h @@ -1,18 +1,18 @@ /*Copyright (C) 2013 Mamadou Diop * Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ diff --git a/tinyDAV/include/tinydav/audio/waveapi/tdav_consumer_waveapi.h b/tinyDAV/include/tinydav/audio/waveapi/tdav_consumer_waveapi.h index 7e136cd..bb4f01d 100755 --- a/tinyDAV/include/tinydav/audio/waveapi/tdav_consumer_waveapi.h +++ b/tinyDAV/include/tinydav/audio/waveapi/tdav_consumer_waveapi.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -42,20 +42,19 @@ TDAV_BEGIN_DECLS #define TDAV_WAVEAPI_CONSUMER_NOTIF_POS_COUNT 4 -typedef struct tdav_consumer_waveapi_s -{ - TDAV_DECLARE_CONSUMER_AUDIO; +typedef struct tdav_consumer_waveapi_s { + TDAV_DECLARE_CONSUMER_AUDIO; - tsk_bool_t started; + tsk_bool_t started; - WAVEFORMATEX wfx; - HWAVEOUT hWaveOut; - LPWAVEHDR hWaveHeaders[TDAV_WAVEAPI_CONSUMER_NOTIF_POS_COUNT]; - tsk_size_t bytes_per_notif; + WAVEFORMATEX wfx; + HWAVEOUT hWaveOut; + LPWAVEHDR hWaveHeaders[TDAV_WAVEAPI_CONSUMER_NOTIF_POS_COUNT]; + tsk_size_t bytes_per_notif; - void* tid[1]; - HANDLE events[2]; - CRITICAL_SECTION cs; + void* tid[1]; + HANDLE events[2]; + CRITICAL_SECTION cs; } tdav_consumer_waveapi_t; diff --git a/tinyDAV/include/tinydav/audio/waveapi/tdav_producer_waveapi.h b/tinyDAV/include/tinydav/audio/waveapi/tdav_producer_waveapi.h index 67614cf..593c7e8 100755 --- a/tinyDAV/include/tinydav/audio/waveapi/tdav_producer_waveapi.h +++ b/tinyDAV/include/tinydav/audio/waveapi/tdav_producer_waveapi.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -42,20 +42,19 @@ TDAV_BEGIN_DECLS #define TDAV_WAVEAPI_PRODUCER_NOTIF_POS_COUNT 4 -typedef struct tdav_producer_waveapi_s -{ - TDAV_DECLARE_PRODUCER_AUDIO; - - tsk_bool_t started; - - WAVEFORMATEX wfx; - HWAVEIN hWaveIn; - LPWAVEHDR hWaveHeaders[TDAV_WAVEAPI_PRODUCER_NOTIF_POS_COUNT]; - tsk_size_t bytes_per_notif; - - void* tid[1]; - HANDLE events[2]; - CRITICAL_SECTION cs; +typedef struct tdav_producer_waveapi_s { + TDAV_DECLARE_PRODUCER_AUDIO; + + tsk_bool_t started; + + WAVEFORMATEX wfx; + HWAVEIN hWaveIn; + LPWAVEHDR hWaveHeaders[TDAV_WAVEAPI_PRODUCER_NOTIF_POS_COUNT]; + tsk_size_t bytes_per_notif; + + void* tid[1]; + HANDLE events[2]; + CRITICAL_SECTION cs; } tdav_producer_waveapi_t; |