summaryrefslogtreecommitdiff
path: root/pjmedia/src/test
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2011-10-24 09:28:13 +0000
committerLiong Sauw Ming <ming@teluu.com>2011-10-24 09:28:13 +0000
commit2068f13bc42cf3a47374aa2765f82724a5782028 (patch)
tree29fbeaa152ab51e59b650c0d7cd83a38111e1ecc /pjmedia/src/test
parent1c72a42676e7aa0c2ae0734549050f738f3bdf02 (diff)
Re #1395: Backport of PJSIP 1.x branch into PJSIP 2.0 trunk
* Backport of r3557:r3832 TODO: ticket #1268 (Option for automatic/manual sending of RTCP SDES/BYE for the stream) for video stream. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3841 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src/test')
-rw-r--r--pjmedia/src/test/jbuf_test.c11
-rw-r--r--pjmedia/src/test/mips_test.c40
-rw-r--r--pjmedia/src/test/test.c11
3 files changed, 61 insertions, 1 deletions
diff --git a/pjmedia/src/test/jbuf_test.c b/pjmedia/src/test/jbuf_test.c
index 9cffa921..309459b0 100644
--- a/pjmedia/src/test/jbuf_test.c
+++ b/pjmedia/src/test/jbuf_test.c
@@ -43,7 +43,8 @@ typedef struct test_cond_t {
int discard;
int lost;
int empty;
- int delay; /**< Maximum delay, in frames. */
+ int delay; /**< Average delay, in frames. */
+ int delay_min; /**< Minimum delay, in frames. */
} test_cond_t;
static pj_bool_t parse_test_headers(char *line, test_param_t *param,
@@ -69,6 +70,8 @@ static pj_bool_t parse_test_headers(char *line, test_param_t *param,
cond->burst = cond_val;
else if (pj_ansi_stricmp(cond_st, "delay") == 0)
cond->delay = cond_val;
+ else if (pj_ansi_stricmp(cond_st, "delay_min") == 0)
+ cond->delay_min = cond_val;
else if (pj_ansi_stricmp(cond_st, "discard") == 0)
cond->discard = cond_val;
else if (pj_ansi_stricmp(cond_st, "empty") == 0)
@@ -217,6 +220,7 @@ int jbuf_main(void)
cond.burst = -1;
cond.delay = -1;
+ cond.delay_min = -1;
cond.discard = -1;
cond.empty = -1;
cond.lost = -1;
@@ -313,6 +317,11 @@ int jbuf_main(void)
cond.delay, state.avg_delay/JB_PTIME);
rc |= 2;
}
+ if (cond.delay_min >= 0 && (int)state.min_delay/JB_PTIME > cond.delay_min) {
+ printf("! 'Minimum delay' should be %d, it is %d\n",
+ cond.delay_min, state.min_delay/JB_PTIME);
+ rc |= 32;
+ }
if (cond.discard >= 0 && (int)state.discard > cond.discard) {
printf("! 'Discard' should be %d, it is %d\n",
cond.discard, state.discard);
diff --git a/pjmedia/src/test/mips_test.c b/pjmedia/src/test/mips_test.c
index 91551196..977fe9a0 100644
--- a/pjmedia/src/test/mips_test.c
+++ b/pjmedia/src/test/mips_test.c
@@ -916,6 +916,23 @@ static pjmedia_port* g7221c_encode_decode(pj_pool_t *pool,
}
#endif /* PJMEDIA_HAS_G7221_CODEC */
+#if PJMEDIA_HAS_OPENCORE_AMRNB_CODEC
+/* AMR-NB benchmark benchmark */
+static pjmedia_port* amr_encode_decode(pj_pool_t *pool,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned flags,
+ struct test_entry *te)
+{
+ return codec_encode_decode(pool, "AMR/8000",
+ &pjmedia_codec_opencore_amrnb_init,
+ &pjmedia_codec_opencore_amrnb_deinit,
+ clock_rate, channel_count,
+ samples_per_frame, flags, te);
+}
+#endif /* PJMEDIA_HAS_OPENCORE_AMRNB_CODEC */
+
#if defined(PJMEDIA_HAS_L16_CODEC) && PJMEDIA_HAS_L16_CODEC!=0
static pj_status_t init_l16_default(pjmedia_endpt *endpt)
{
@@ -1976,6 +1993,23 @@ static pjmedia_port* create_stream_g7221c( pj_pool_t *pool,
}
#endif /* PJMEDIA_HAS_G7221_CODEC */
+/* AMR-NB stream */
+#if PJMEDIA_HAS_OPENCORE_AMRNB_CODEC
+static pjmedia_port* create_stream_amr( pj_pool_t *pool,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned flags,
+ struct test_entry *te)
+{
+ return create_stream(pool, "AMR/8000", &pjmedia_codec_opencore_amrnb_init,
+ &pjmedia_codec_opencore_amrnb_deinit,
+ PJ_FALSE, PJ_FALSE, PJ_FALSE,
+ clock_rate, channel_count,
+ samples_per_frame, flags, te);
+}
+#endif /* PJMEDIA_HAS_OPENCORE_AMRNB_CODEC */
+
/***************************************************************************/
/* Delay buffer */
enum {DELAY_BUF_MAX_DELAY = 80};
@@ -2366,6 +2400,9 @@ int mips_test(void)
{ "codec encode/decode - G.722.1", OP_PUT, K16, &g7221_encode_decode},
{ "codec encode/decode - G.722.1c", OP_PUT, K32, &g7221c_encode_decode},
#endif
+#if PJMEDIA_HAS_OPENCORE_AMRNB_CODEC
+ { "codec encode/decode - AMR-NB", OP_PUT, K8, &amr_encode_decode},
+#endif
#if PJMEDIA_HAS_L16_CODEC
{ "codec encode/decode - L16/8000/1", OP_PUT, K8, &l16_8_encode_decode},
{ "codec encode/decode - L16/16000/1", OP_PUT, K16, &l16_16_encode_decode},
@@ -2391,6 +2428,9 @@ int mips_test(void)
{ "stream TX/RX - G.722.1", OP_PUT_GET, K16, &create_stream_g7221},
{ "stream TX/RX - G.722.1c", OP_PUT_GET, K32, &create_stream_g7221c},
#endif
+#if PJMEDIA_HAS_OPENCORE_AMRNB_CODEC
+ { "stream TX/RX - AMR-NB", OP_PUT_GET, K8, &create_stream_amr},
+#endif
};
unsigned i, c, k[3] = {K8, K16, K32}, clock_rates[3] = {8000, 16000, 32000};
diff --git a/pjmedia/src/test/test.c b/pjmedia/src/test/test.c
index 82b20e17..2b7c9ca5 100644
--- a/pjmedia/src/test/test.c
+++ b/pjmedia/src/test/test.c
@@ -43,6 +43,17 @@ void app_perror(pj_status_t status, const char *msg)
PJ_LOG(3,(THIS_FILE, "%s: %s", msg, errbuf));
}
+/* Force linking PLC stuff if G.711 is disabled. See:
+ * https://trac.pjsip.org/repos/ticket/1337
+ */
+#if PJMEDIA_HAS_G711_CODEC==0
+int dummy()
+{
+ // Dummy
+ return (int) &pjmedia_plc_save;
+}
+#endif
+
int test_main(void)
{
int rc = 0;