spandsp  3.0.0
private/playout.h
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/playout.h
5  *
6  * Written by Steve Underwood <steveu@coppice.org>
7  *
8  * Copyright (C) 2005 Steve Underwood
9  *
10  * All rights reserved.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 2.1,
14  * as published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this program; if not, write to the Free Software
23  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25 
26 #if !defined(_SPANDSP_PRIVATE_PLAYOUT_H_)
27 #define _SPANDSP_PRIVATE_PLAYOUT_H_
28 
30 {
31  /*! The actual frame data */
32  void *data;
33  /*! The type of frame */
34  int type;
35  /*! The timestamp assigned by the sending end */
36  timestamp_t sender_stamp;
37  /*! The timespan covered by the data in this frame */
38  timestamp_t sender_len;
39  /*! The timestamp assigned by the receiving end */
40  timestamp_t receiver_stamp;
41  /*! Pointer to the next earlier frame */
43  /*! Pointer to the next later frame */
45 };
46 
47 /*!
48  Playout (jitter buffer) descriptor. This defines the working state
49  for a single instance of playout buffering.
50 */
52 {
53  /*! True if the buffer is dynamically sized */
54  bool dynamic;
55  /*! The minimum length (dynamic) or fixed length (static) of the buffer */
57  /*! The maximum length (dynamic) or fixed length (static) of the buffer */
59  /*! The target filter threshold for adjusting dynamic buffering. */
61 
62  int start;
63 
64  /*! The queued frame list */
66  playout_frame_t *last_frame;
67  /*! The free frame pool */
69 
70  /*! The total frames input to the buffer, to date. */
71  int frames_in;
72  /*! The total frames output from the buffer, to date. */
74  /*! The number of frames received out of sequence. */
76  /*! The number of frames which were discarded, due to late arrival. */
78  /*! The number of frames which were never received. */
80  /*! The number of frames trimmed from the stream, due to buffer shrinkage. */
82 
83  timestamp_t latest_expected;
84  /*! The present jitter adjustment */
85  timestamp_t current;
86  /*! The sender_stamp of the last speech frame */
88  /*! The duration of the last speech frame */
90 
91  int not_first;
92  /*! The time since the target buffer length was last changed. */
93  timestamp_t since_last_step;
94  /*! Filter state for tracking the packets arriving just in time */
96  /*! Filter state for tracking the packets arriving late */
97  int32_t state_late;
98  /*! The current target length of the buffer */
100  /*! The current actual length of the buffer, which may lag behind the target value */
102 };
103 
104 #endif
105 /*- End of file ------------------------------------------------------------*/
Definition: private/playout.h:30
timestamp_t receiver_stamp
Definition: private/playout.h:40
timestamp_t sender_len
Definition: private/playout.h:38
timestamp_t sender_stamp
Definition: private/playout.h:36
struct playout_frame_s * later
Definition: private/playout.h:44
void * data
Definition: private/playout.h:32
struct playout_frame_s * earlier
Definition: private/playout.h:42
int type
Definition: private/playout.h:34
Definition: private/playout.h:52
int frames_in
Definition: private/playout.h:71
int32_t state_just_in_time
Definition: private/playout.h:95
int frames_late
Definition: private/playout.h:77
timestamp_t since_last_step
Definition: private/playout.h:93
int target_buffer_length
Definition: private/playout.h:99
timestamp_t last_speech_sender_stamp
Definition: private/playout.h:87
int max_length
Definition: private/playout.h:58
int actual_buffer_length
Definition: private/playout.h:101
int frames_trimmed
Definition: private/playout.h:81
int frames_missing
Definition: private/playout.h:79
timestamp_t last_speech_sender_len
Definition: private/playout.h:89
bool dynamic
Definition: private/playout.h:54
int dropable_threshold
Definition: private/playout.h:60
int frames_out
Definition: private/playout.h:73
timestamp_t current
Definition: private/playout.h:85
int min_length
Definition: private/playout.h:56
playout_frame_t * free_frames
Definition: private/playout.h:68
playout_frame_t * first_frame
Definition: private/playout.h:65
int frames_oos
Definition: private/playout.h:75
int32_t state_late
Definition: private/playout.h:97