diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2012-01-12 06:09:08 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2012-01-12 06:09:08 +0000 |
commit | 9a277148324b884961ee301376524f079dde0a81 (patch) | |
tree | 60caae41911548f72cf7cb95c566632f567ec585 /pjmedia/src | |
parent | 3c6c14b62f40b17715d82f395c0d4c65b473dbc4 (diff) |
Fix #1447: fix internal function write_frame() of the switchboard to copy the whole source frame to the destination port buffer if the destination port is port 0 (previously it only copied as much as samples-per-frame of port 0).
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3941 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src')
-rw-r--r-- | pjmedia/src/pjmedia/conf_switch.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/pjmedia/src/pjmedia/conf_switch.c b/pjmedia/src/pjmedia/conf_switch.c index d7df076e..3369b72e 100644 --- a/pjmedia/src/pjmedia/conf_switch.c +++ b/pjmedia/src/pjmedia/conf_switch.c @@ -1073,11 +1073,14 @@ static pj_status_t write_frame(struct conf_port *cport_dst, while (f_start < f_end) { unsigned nsamples_to_copy, nsamples_req; - /* Copy frame to listener's TX buffer. */ + /* Copy frame to listener's TX buffer. + * Note that if the destination is port 0, just copy the whole + * available samples. + */ nsamples_to_copy = f_end - f_start; nsamples_req = cport_dst->info->samples_per_frame - (frm_dst->size>>1); - if (nsamples_to_copy > nsamples_req) + if (cport_dst->slot && nsamples_to_copy > nsamples_req) nsamples_to_copy = nsamples_req; /* Adjust TX level. */ @@ -1110,16 +1113,19 @@ static pj_status_t write_frame(struct conf_port *cport_dst, /* Check if it's time to deliver the TX buffer to listener, * i.e: samples count in TX buffer equal to listener's - * samples per frame. + * samples per frame. Note that for destination port 0 this + * function will just populate all samples in the TX buffer. */ - if ((frm_dst->size >> 1) == cport_dst->info->samples_per_frame) + if (cport_dst->slot == 0) { + /* Update TX timestamp. */ + pj_add_timestamp32(&cport_dst->ts_tx, nsamples_to_copy); + } else if ((frm_dst->size >> 1) == + cport_dst->info->samples_per_frame) { - if (cport_dst->slot) { - pjmedia_port_put_frame(cport_dst->port, frm_dst); + pjmedia_port_put_frame(cport_dst->port, frm_dst); - /* Reset TX buffer. */ - frm_dst->size = 0; - } + /* Reset TX buffer. */ + frm_dst->size = 0; /* Update TX timestamp. */ pj_add_timestamp32(&cport_dst->ts_tx, |