summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2017-01-12 15:58:43 -0600
committerKevin Harwell <kharwell@digium.com>2017-01-17 17:08:36 -0600
commit883e7fde31ab9db886c482f12383f6baa57e9e92 (patch)
tree295cd8580105ad584c0636d40cc1309c91cd6a5d /include
parent473330983b47618772b1dd414df8e063e5da6a53 (diff)
abstract/fixed/adpative jitter buffer: disallow frame re-inserts
It was possible for a frame to be re-inserted into a jitter buffer after it had been removed from it. A case when this happened was if a frame was read out of the jitterbuffer, passed to the translation core, and then multiple frames were returned from said translation core. Upon multiple frames being returned the first is passed on, but sebsequently "chained" frames are put back into the read queue. Thus it was possible for a frame to go back into the jitter buffer where this would cause problems. This patch adds a flag to frames that are inserted into the channel's read queue after translation. The abstract jitter buffer code then checks for this flag and ignores any frames marked as such. Change-Id: I276c44edc9dcff61e606242f71274265c7779587
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/abstract_jb.h3
-rw-r--r--include/asterisk/frame.h2
-rw-r--r--include/jitterbuf.h3
3 files changed, 8 insertions, 0 deletions
diff --git a/include/asterisk/abstract_jb.h b/include/asterisk/abstract_jb.h
index 8a5e3d27f..173b22a5c 100644
--- a/include/asterisk/abstract_jb.h
+++ b/include/asterisk/abstract_jb.h
@@ -109,6 +109,8 @@ typedef int (*jb_remove_impl)(void *jb, struct ast_frame **fout);
typedef void (*jb_force_resynch_impl)(void *jb);
/*! \brief Empty and reset jb */
typedef void (*jb_empty_and_reset_impl)(void *jb);
+/*! \brief Check if late */
+typedef int (*jb_is_late_impl)(void *jb, long ts);
/*!
@@ -127,6 +129,7 @@ struct ast_jb_impl
jb_remove_impl remove;
jb_force_resynch_impl force_resync;
jb_empty_and_reset_impl empty_and_reset;
+ jb_is_late_impl is_late;
};
/*!
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index 20f40f863..108dcafe0 100644
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -133,6 +133,8 @@ enum ast_frame_type {
enum {
/*! This frame contains valid timing information */
AST_FRFLAG_HAS_TIMING_INFO = (1 << 0),
+ /*! This frame has been requeued */
+ AST_FRFLAG_REQUEUED = (1 << 1),
};
struct ast_frame_subclass {
diff --git a/include/jitterbuf.h b/include/jitterbuf.h
index 6da11a65b..32579fc6c 100644
--- a/include/jitterbuf.h
+++ b/include/jitterbuf.h
@@ -166,6 +166,9 @@ enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf);
typedef void __attribute__((format(printf, 1, 2))) (*jb_output_function_t)(const char *fmt, ...);
void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg);
+/*! \brief Checks if the given time stamp is late */
+int jb_is_late(jitterbuf *jb, long ts);
+
#ifdef __cplusplus
}
#endif