summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-12-26 02:27:14 +0000
committerBenny Prijono <bennylp@teluu.com>2006-12-26 02:27:14 +0000
commit66ba60640c9016496736679a5f5d4f76ca9c92b4 (patch)
treea71e50cfd9d35fad717f020cc586c2fed0dd540f /pjmedia
parent2fe9c7e503a9599ed0361e10bb6ba1c4bf311e4c (diff)
Ticket #51: Added audio level adjustment to PJSUA-API
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@864 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/src/pjmedia/conference.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/pjmedia/src/pjmedia/conference.c b/pjmedia/src/pjmedia/conference.c
index 026f376a..75837c42 100644
--- a/pjmedia/src/pjmedia/conference.c
+++ b/pjmedia/src/pjmedia/conference.c
@@ -61,6 +61,7 @@ static FILE *fhnd_rec;
#define SIGNATURE PJMEDIA_PORT_SIGNATURE('C', 'O', 'N', 'F')
#define SIGNATURE_PORT PJMEDIA_PORT_SIGNATURE('C', 'O', 'N', 'P')
+/* Normal level is hardcodec to 128 in all over places */
#define NORMAL_LEVEL 128
#define SLOT_TYPE unsigned
#define INVALID_SLOT ((SLOT_TYPE)-1)
@@ -1137,7 +1138,10 @@ PJ_DEF(pj_status_t) pjmedia_conf_adjust_rx_level( pjmedia_conf *conf,
PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL);
/* Value must be from -128 to +127 */
- PJ_ASSERT_RETURN(adj_level >= -128 && adj_level <= 127, PJ_EINVAL);
+ /* Disabled, you can put more than +127, at your own risk:
+ PJ_ASSERT_RETURN(adj_level >= -128 && adj_level <= 127, PJ_EINVAL);
+ */
+ PJ_ASSERT_RETURN(adj_level >= -128, PJ_EINVAL);
conf_port = conf->ports[slot];
@@ -1164,7 +1168,10 @@ PJ_DEF(pj_status_t) pjmedia_conf_adjust_tx_level( pjmedia_conf *conf,
PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL);
/* Value must be from -128 to +127 */
- PJ_ASSERT_RETURN(adj_level >= -128 && adj_level <= 127, PJ_EINVAL);
+ /* Disabled, you can put more than +127,, at your own risk:
+ PJ_ASSERT_RETURN(adj_level >= -128 && adj_level <= 127, PJ_EINVAL);
+ */
+ PJ_ASSERT_RETURN(adj_level >= -128, PJ_EINVAL);
conf_port = conf->ports[slot];
@@ -1364,7 +1371,8 @@ static pj_status_t write_port(pjmedia_conf *conf, struct conf_port *cport,
* 16bit sample storage.
*/
itemp = input[j];
- itemp = itemp * adj / NORMAL_LEVEL;
+ /*itemp = itemp * adj / NORMAL_LEVEL; */
+ itemp = (itemp * adj) >> 7;
/* Clip the signal if it's too loud */
if (itemp > 32767) itemp = 32767;
@@ -1396,7 +1404,8 @@ static pj_status_t write_port(pjmedia_conf *conf, struct conf_port *cport,
itemp = unsigned2pcm(cport->mix_buf[j] / cport->src_level);
/* Adjust the level */
- itemp = itemp * adj_level / NORMAL_LEVEL;
+ /*itemp = itemp * adj_level / NORMAL_LEVEL;*/
+ itemp = (itemp * adj_level) >> 7;
/* Clip the signal if it's too loud */
if (itemp > 32767) itemp = 32767;
@@ -1650,7 +1659,8 @@ static pj_status_t get_frame(pjmedia_port *this_port,
* 16bit sample storage.
*/
itemp = input[j];
- itemp = itemp * adj / NORMAL_LEVEL;
+ /*itemp = itemp * adj / NORMAL_LEVEL;*/
+ itemp = (itemp * adj) >> 7;
/* Clip the signal if it's too loud */
if (itemp > 32767) itemp = 32767;