diff options
-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, |